wmjie / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

TEXT / BLOB fields always returning empty #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. setup the ibm-db driver and an Informix database server
2. connect to Informix from Python
3. run a query that returns rows with fields of type TEXT (BLOBs)

What is the expected output? What do you see instead?

The result should include the contents of those TEXT fields but instead only 
returns empty strings (ie, u'') instead.

What version of the product are you using? On what operating system?

Tried on both Ubuntu and Mac OS, using Informix Dynamic Server Version 11.50.FC6

Original issue reported on code.google.com by rsolo...@gmail.com on 10 Sep 2012 at 4:59

GoogleCodeExporter commented 9 years ago
By the way, I've tried ibm_db.fetch_tuple(), ibm_db.fetch_assoc() and 
ibm_db.fetch_both() but all seem to return an empty string for these TEXT 
fields.

Any ideas? Thanks!

Original comment by rsolo...@gmail.com on 11 Sep 2012 at 6:31

GoogleCodeExporter commented 9 years ago
I am looking into this issue and able to reproduce this, will get back to you 
once I will found the root cause.

Thanks,
rahul

Original comment by rahul.pr...@in.ibm.com on 12 Sep 2012 at 12:00

GoogleCodeExporter commented 9 years ago
There is a workaround to this problem which may temporary resolve your problem
while retrieving Large Object like TEXT/BYTE you can cast it to smart Large 
Objects(CLOB/BLOB) by this you will get the correct result.

Your select statement would become like follows
"SELECT text_col::CLOB from textTable" 

If you change the TEXT/BYTE column type of the table to CLOB/BLOB then also the 
above problem will not arise.

Thanks,
Rahul

Original comment by rahul.pr...@in.ibm.com on 13 Sep 2012 at 8:30

GoogleCodeExporter commented 9 years ago
Hi Rahul,

Thanks for this suggestion. When I try this I seem to get the following error:

Exception: Fetch Failure: [IBM][CLI Driver][IDS/UNIX64] Smart-large-object 
error. SQLCODE=-9810

I am looking into this now myself. But, any ideas?  

Thanks.

Original comment by rsolo...@gmail.com on 13 Sep 2012 at 7:49

GoogleCodeExporter commented 9 years ago
You are getting this error after applying which workaround? By casting to Smart 
Large Object(CLOB) or changing column type to CLOB.

Original comment by rahul.pr...@in.ibm.com on 17 Sep 2012 at 11:16

GoogleCodeExporter commented 9 years ago
I am getting this error when attempting to cast to Smart Large Object(CLOB). I 
have not attempted to change the column type yet, as I'm not sure that is 
possible in our situation.

I'm still looking into what this error means when casting to a CLOB but haven't 
made much progress.

Any ideas would be much appreciated.

thanks,
R

Original comment by rsolo...@gmail.com on 17 Sep 2012 at 4:38

GoogleCodeExporter commented 9 years ago
You need to create sb space to start using CLOB. This is a manual process, 
please execute following steps on Informix server to make CLOB working.

Make sure that you have login as informix user and then execute following steps

i) touch /PATH/TO/SBSAPCE/sbspace (you can give any path where informix has 
write permission)
ii) chmod 660 /PATH/TO/SBSAPCE/sbspace
iii) onmode -ky (Stop server)
iv) chmod 660 /PATH/TO/ONCONFIG/onconfig
v) vi /PATH/TO/ONCONFIG/onconfig (search for SBSPACENAME and add sbspace to it 
eg SBSPACENAME sbspace)
vi) oninit -vy (Start the server)

Original comment by rahul.pr...@in.ibm.com on 21 Sep 2012 at 5:46

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 1 Mar 2013 at 10:06