473,516 Members | 3,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Jython Data Extraction problem

The data is an 8-byte 2s complement binary integer stored in a MSSQL
2005 CHAR column. (COBOL did that, not me). I'm using zxJDBC to read
the data and Jython to process.
I could extract the integer if it wasn't returned in the resultset as
unicode. Things like ord(char) and struct.unpack('>B',char) to get at
the bits don't seem to work. struct.unpack('>g',string) is not available.
I've tried fooling with charset in the url and the connect statement and
tried encode, but I have no experience here.
Is there anyway to get Jython/zxJDBC to stop converting the string to
unicode?
Any advice is welcome.
Mar 8 '07 #1
1 1197
Steve Williams wrote:
The data is an 8-byte 2s complement binary integer stored in a MSSQL
2005 CHAR column. (COBOL did that, not me). I'm using zxJDBC to read
the data and Jython to process.
I could extract the integer if it wasn't returned in the resultset as
unicode. Things like ord(char) and struct.unpack('>B',char) to get at
the bits don't seem to work. struct.unpack('>g',string) is not available.
I've tried fooling with charset in the url and the connect statement and
tried encode, but I have no experience here.
Is there anyway to get Jython/zxJDBC to stop converting the string to
unicode?
Any advice is welcome.
It's a JDBC-thing in the end, see if you find a solution there. Apart from
that, I don't see the problem really - why can't you just create a
byte-string by using the .encode-method? Sure, you need to know which
encoding was actually used when reading the bytes from the DB. But you
should be able to figure that out, there aren't too much candidates -
basically the usual suspects of cp1250, latin1 and the like.

Diez
Mar 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1739
by: sameer | last post by:
hi guys, plzz give ur valuable suggestion for the following problem..... my objective is to retrieve a row from jtable using jython scripting.so i started from jython where i mentioned connection and with the help ofcursor ,retrieve records from table. then import(let mytable.class)class file into jython. from this i get all the data from...
6
2101
by: Dave Benjamin | last post by:
Hey good people, I've been doing a lot of simultaneous Jython and CPython programming lately, and just wanted to say, with no intended ill will toward any of the individuals who have been generous enough to make the two languages possible, that, well, they're kinda different. I guess it was inevitable, but with Jython stuck at Python 2.1,...
4
3410
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
7
12735
by: Jan Gregor | last post by:
Hello I found that jython catches exact java exceptions, not their subclasses. Is there some way to get around this limitation (or error) ? My program has class representing database source and specialed classes for particulars databases. Now there are two options - to include exception (subclasses of SQLException) for every db in except...
5
3669
by: Maurice Ling | last post by:
Hi, I have read that this had been asked before but there's no satisfactory replies then. I have a module (pA) written in python, which originally is called by another python module (pB), and passes a python object (pO) to pB. Now I require pA to be called in a java class (jC) and pass pO into jC. As pA uses non-python modules, I am not...
1
2274
by: scott | last post by:
I installed darwinports and did a "sudo port install jython" ------------------------- scott$ which jython /opt/local/bin/jython ------------------------- Jython works in interactive mode as shown below:
1
2358
by: Mark Fink | last post by:
Hi there, unfortunately I am new to Jython and my "Jython Essentials" book is still in the mail. I looked into the Jython API Doc but could not find the information. I am porting a Python library to Jython and some parts are missing. My question basically is where do I find information on what to use instead. E.g. I could not find...
3
1234
by: nmin | last post by:
Hi, I'm using Jython in combination with java. I wrote a jython skript, which calls a function from another jython module called library.py. So, executing the function genData() in skript .py runs without problem but if I execute the same function again, the data from the first run is stored somehow and is added to the new data.
4
2035
by: Neil Wallace | last post by:
Hi all, I am a novice Python/Jython programmer, and Ubuntu user. Ubuntu still only supports only version 2.1 of Jython. I have used the GUI installer of Jython 2.2, and installed it to the default /root/jython2.2 directory. The install went without issues. However, typing ............jython --version in a teminal still gives me ...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.