By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,888 Members | 1,525 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,888 IT Pros & Developers. It's quick & easy.

Can't get LCHARVAR's with InformixDB

P: n/a
I'm using the InformixDB package, which has been a real lifesaver, but
I'm finding I can't get any data from the Informix LCHARVAR types.
They're coming in as empty strings.

The cursor._description for the field in question is:
('msg_text', 'lvarchar', 0, 0, None, None, 1)

Appreciate any help... thanks.

Aug 1 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Tue, 2006-08-01 at 09:02, fh*****@gmail.com wrote:
I'm using the InformixDB package, which has been a real lifesaver, but
I'm finding I can't get any data from the Informix LCHARVAR types.
They're coming in as empty strings.

The cursor._description for the field in question is:
('msg_text', 'lvarchar', 0, 0, None, None, 1)

Appreciate any help... thanks.
What version are you using? I thought I fixed lvarchars a long time ago.

-Carsten
Aug 1 '06 #2

P: n/a

Carsten Haese wrote:
What version are you using? I thought I fixed lvarchars a long time ago.
2.2, with Python 2.4 on Windows... I installed via
InformixDB-2.2.win32-py2.4.exe

I can see the data with other tools... it's multi-line, stuff like
stack traces, etc., and many start with newlines... but whatever it is,
I'm consistently getting empty strings.

Aug 1 '06 #3

P: n/a
On Tue, 2006-08-01 at 09:27, fh*****@gmail.com wrote:
Carsten Haese wrote:
What version are you using? I thought I fixed lvarchars a long time ago.

2.2, with Python 2.4 on Windows... I installed via
InformixDB-2.2.win32-py2.4.exe
Hm, this certainly warrants further investigation. I don't use lvarchars
myself, so it's possible that I did something that accidentally broke
the output binding for lvarchars.

Could you possibly send me a minimal test script that shows the problem?
Also, in case it matters, I'd like to know which versions of IDS and
CSDK or Informix Connect you're using.

Thanks,

Carsten.
Aug 1 '06 #4

P: n/a

Carsten Haese wrote:
Could you possibly send me a minimal test script that shows the problem?
Also, in case it matters, I'd like to know which versions of IDS and
CSDK or Informix Connect you're using.

Here's a sample script:

sql = '''select msg_tx from dev_log'''
import informixdb
conn = informixdb.connect('mydb')
cursor = conn.cursor()
cursor.execute(sql)
print 'description is <%s>' % cursor.description
print cursor.fetchall()

Output is:
description is <('msg_tx', 'lvarchar', 0, 0, None, None, 1)>
[('',), ('',), ('',), ('',), ('',), ('',)]

But one of them should be:
'''Something:SomethingElse - going for 221 possibilities [User:
HOST-NAME\XYZZY]:
Id OtherData
5878 C
5968 X
6732 V
[many more lines like this]
'''

Some hunting around, and I found this:

C:\Program Files\Informix\Client-SDK\bin>esql
IBM Informix CSDK Version 2.80, IBM Informix-ESQL Version 9.52.TC1

Not sure what IDS is... the Informix Server version is: 9.3 FC3,
according to the DBA guy.

Thanks much.

Aug 1 '06 #5

P: n/a

Another thing...
Output is:
description is <('msg_tx', 'lvarchar', 0, 0, None, None, 1)>
The 0's worried me, as I could see where they could be used as parms to
allocate/trim things as necessary... just a thought.

Aug 1 '06 #6

P: n/a
On Tue, 2006-08-01 at 11:41, fh*****@gmail.com wrote:
Carsten Haese wrote:
Could you possibly send me a minimal test script that shows the problem?
Also, in case it matters, I'd like to know which versions of IDS and
CSDK or Informix Connect you're using.


Here's a sample script:

sql = '''select msg_tx from dev_log'''
import informixdb
conn = informixdb.connect('mydb')
cursor = conn.cursor()
cursor.execute(sql)
print 'description is <%s>' % cursor.description
print cursor.fetchall()
Thanks, but I can't use this to reproduce the problem. I'll need the
create table statement for dev_log.
Output is:
description is <('msg_tx', 'lvarchar', 0, 0, None, None, 1)>
[('',), ('',), ('',), ('',), ('',), ('',)]

But one of them should be:
'''Something:SomethingElse - going for 221 possibilities [User:
HOST-NAME\XYZZY]:
Id OtherData
5878 C
5968 X
6732 V
[many more lines like this]
'''

Some hunting around, and I found this:

C:\Program Files\Informix\Client-SDK\bin>esql
IBM Informix CSDK Version 2.80, IBM Informix-ESQL Version 9.52.TC1

Not sure what IDS is... the Informix Server version is: 9.3 FC3,
according to the DBA guy.
IDS = Informix Dynamic Server. The version numbers you gave me are what
I was looking for.

For what it's worth, I've tried a simple test script on my Linux server
that creates a temp table with an lvarchar column, inserts into it, and
reads from it, all without a problem. However, there are many
differences between my test environment and yours, and I'll need to know
your specific circumstances to isolate which difference is causing the
problem.

Thanks,

Carsten.
Aug 1 '06 #7

P: n/a
On Tue, 2006-08-01 at 11:47, fh*****@gmail.com wrote:
Another thing...
Output is:
description is <('msg_tx', 'lvarchar', 0, 0, None, None, 1)>

The 0's worried me, as I could see where they could be used as parms to
allocate/trim things as necessary... just a thought.
That is indeed a problem. For some as of yet undetermined reason, the
client thinks that msg_tx is a column of length zero, so it's no big
surprise that all you get back is empty strings. Once again, I'll need
the create table statement for the table you're selecting from in order
to investigate what's happening.

-Carsten
Aug 1 '06 #8

P: n/a

Carsten Haese wrote:
Once again, I'll need
the create table statement for the table you're selecting from in order
to investigate what's happening.
Here it is:

CREATE TABLE DEV_LOG(
LOG_ID SERIAL,
LEVEL VARCHAR (10),
POI_NM VARCHAR (255),
MSG_TX LVARCHAR(2000),
MSG2_TX LVARCHAR(5000)
) LOCK MODE ROW;

Thanks.

Aug 1 '06 #9

P: n/a
On Tue, 2006-08-01 at 14:05, fh*****@gmail.com wrote:
Carsten Haese wrote:
Once again, I'll need
the create table statement for the table you're selecting from in order
to investigate what's happening.

Here it is:

CREATE TABLE DEV_LOG(
LOG_ID SERIAL,
LEVEL VARCHAR (10),
POI_NM VARCHAR (255),
MSG_TX LVARCHAR(2000),
MSG2_TX LVARCHAR(5000)
) LOCK MODE ROW;
The following test script works fine for me:

---------------------------------------------------------
import informixdb

conn = informixdb.connect("mydb")
cur = conn.cursor()
cur.execute("""
CREATE temp TABLE DEV_LOG(
LOG_ID SERIAL,
LEVEL VARCHAR (10),
POI_NM VARCHAR (255),
MSG_TX LVARCHAR(2000),
MSG2_TX LVARCHAR(5000))""")
str1 = "ABCDEFGHIJ"*200
str2 = "ABCDEFGHIJ"*500
cur.execute("insert into dev_log values(?,?,?,?,?)",
(0,'MEDIUM','TESTMAN',str1,str2) )
cur.execute("select * from dev_log")
row = cur.fetchone()
assert row[3]==str1
assert row[4]==str2
print cur.description
---------------------------------------------------------

I have tested this two ways, once directly on the server on Linux, once
with a client-server connection from Windows to Linux. In both cases,
both lvarchars are being read back correctly. One notable difference
between your environment and mine is that I'm using CSDK version
2.90.TC3, which is more recent than the version of CSDK that you're
using.

I'd suggest upgrading to the newest version of CSDK. Please let me know
what happens after the upgrade.

-Carsten
Aug 1 '06 #10

P: n/a

Carsten Haese wrote:
I'd suggest upgrading to the newest version of CSDK. Please let me know
what happens after the upgrade.
That did the trick.... thanks very much.

Aug 5 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.