danishabdullah / pyodbc

Automatically exported from code.google.com/p/pyodbc
Other
0 stars 0 forks source link

PyODBC Connect to Ingres String Insert Greater Than 255 Fails with No Error #394

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Insert a string > than length 255

What is the expected output? What do you see instead?
No error exception is thrown, DBMS errors are present in the log, and no row is 
inserted.

databasehost::[56410           , 02684100]: Tue Mar  3 09:27:22 2015 
E_DM9B08_DMPE_NEED_TRAN An attempt was made to define a temporary DMPE object 
while no transaction was in progress.
databasehost::[56410           , 02684100]: Tue Mar  3 09:27:22 2015 
E_AD7008_ADP_DELETE_FAILURE An error was encountered performing an ADP_DELETE 
operation on a peripheral datatype.

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

See below

Please provide any additional information below.

Hi,

I'm trying to insert a string into a table with a single varchar(2000) column 
for these tests. The insert fails and the Ingres DBMS logs an error to it's log 
file but cursor.execute does not throw an exception so from the python 
perspective it appears that the insert was successful. The same insert will 
work using Anaconda python and a trial version of their pyodbc module which 
would be using the same Ingres shared object module.

All tests performed using python2.7 on Ubuntu 8.04.3 LTS

The following table is used.

create table testing (                                             
    col1 varchar(2000) not null with default                                
);                                                                       

Ingres environment variables

II_ODBC_WCHAR_SIZE=2
LD_LIBRARY_PATH=/opt/Ingres/IngresII/ingres/lib
ODBCSYSINI=/opt/Ingres/IngresII/ingres/files/
ODBCINI=/opt/Ingres/IngresII/ingres/files/odbc.ini
II_SYSTEM=/opt/Ingres/IngresII

TEST 1 Using Ingres version II 2.5/0011 (su4.us5/00)

>>> db=pyodbc.connect("DRIVER=Ingres;SRVR=HOSTNAME;DB=devdata")
>>> cursor = db.cursor()
>>> sql2='insert into testing(col1) values (?)'
>>> bigStr=''        
>>> for i in range(0,1500):
...  bigStr += 'a'
...
>>> cursor.execute(sql2,[bigStr])
<pyodbc.Cursor object at 0xb7d3a918>
>>> db.commit()
>>> sql3='select * from testing'
>>> cursor2=db.cursor()
>>> cursor2.execute(sql3)
<pyodbc.Cursor object at 0xb7aacb80>
>>> res=cursor2.fetchall()
#No results. Failed to insert row and did not throw an exception
>>> res
[]
>>> len(bigStr)
1500
#Try inserting string with length 255
>>> cursor.execute(sql2,[bigStr[0:255]])
<pyodbc.Cursor object at 0xb7d3a918>
>>> db.commit()
>>> cursor2.execute(sql3)
<pyodbc.Cursor object at 0xb7aacb80>
>>> res=cursor2.fetchall()
>>> res
[('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa', )]
>>> bigStr=''
>>> for a in range(0,1500):
...  bigStr += 'b'
#Now prove that 255 is the magic number by trying 256
>>> cursor.execute(sql2,[bigStr[0:256]])
<pyodbc.Cursor object at 0xb7d3a918>
>>> db.commit()
>>> cursor2.execute(sql3)
<pyodbc.Cursor object at 0xb7aacb80>
>>> res=cursor2.fetchall()
#No results for bigStr with b
>>> res
[('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa', )]
>>> 

TEST 2 NEW ATTEMPT USING Ingres version II 10.2.0 (a64.lnx/100) YIELDS THE SAME 
RESULTS

>>> import pyodbc
>>> db=pyodbc.connect("DRIVER=Ingres;SRVR=HOSTNAME;DB=modeldata")
>>> cursor = db.cursor()
>>> sql2='insert into testing(col1) values (?)'
>>> bigStr=''  
>>> for i in range(0,1500):
...  bigStr += 'a'
...
>>> cursor.execute(sql2,[bigStr])
<pyodbc.Cursor object at 0xb7c77c98>
>>> db.commit()
>>> sql3='select * from testing'
>>> cursor2=db.cursor()
>>> cursor2.execute(sql3)
<pyodbc.Cursor object at 0xb79ee790>
>>> res=cursor2.fetchall()
>>> res
[]
>>> len(bigStr)
1500
>>> cursor.execute(sql2,[bigStr[0:255]])
<pyodbc.Cursor object at 0xb7c77c98>
>>> db.commit()
>>> cursor2.execute(sql3)
<pyodbc.Cursor object at 0xb79ee790>
>>> res=cursor2.fetchall()
>>> res
[('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa', )]
>>> bigStr=''
>>> for a in range(0,1500):
...  bigStr += 'b'
...
>>> cursor.execute(sql2,[bigStr[0:256]])
<pyodbc.Cursor object at 0xb7c77c98>
>>> db.commit()
>>> cursor2.execute(sql3)
<pyodbc.Cursor object at 0xb79ee790>
>>> res=cursor2.fetchall()
>>> res
[('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa', )]
>>> 

TEST 3 ANACONDA PYTHON WITH io.pyodbc trial driver version from Continuum 
Analytics using Ingres version II 2.5/0011 (su4.us5/00)

Python 2.7.9 |Anaconda 2.1.0 (32-bit)| (default, Dec 15 2014, 10:34:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import iopro.pyodbc as pyodbc
Vendor:  Continuum Analytics, Inc.
Package: iopro
Message: trial mode expires in 26 days
>>> db=pyodbc.connect("DRIVER=Ingres;SRVR=sheridan;DB=devdata")
>>> cursor = db.cursor()
>>> sql2='insert into testing(col1) values (?)'
>>> bigStr=''     
>>> for i in range(0,1500):
...   bigStr += 'a'
...
>>> cursor.execute(sql2,[bigStr])
<pyodbc.Cursor object at 0xb65d1ad8>
>>> db.commit()
>>> sql3='select * from testing'
>>> cursor2=db.cursor()
>>> cursor2.execute(sql3)
<pyodbc.Cursor object at 0xb65d1b10>
>>> res=cursor2.fetchall()
>>> res
[('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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