14 May 08:34
Newlines and VARBINARY
From: Alexandre Pigolkine <pigolkine@...>
Subject: Newlines and VARBINARY
Newsgroups: gmane.comp.python.egenix.user
Date: 2008-05-14 06:37:12 GMT
Subject: Newlines and VARBINARY
Newsgroups: gmane.comp.python.egenix.user
Date: 2008-05-14 06:37:12 GMT
Hello all,
I try to use mx.ODBC in the following environment:
mx.ODBC, Linux, iODBC, FreeTDS-Library, Microsoft SQL Server.
I get an error message when I try to insert a string with
new lines into a table with a TEXT field:
import mx.ODBC
con = mx.ODBC.iODBC.DriverConnect("DRIVER={SQL Server};SERVER=<server_ip>;DATABASE=<dbname>;UID=<user>;PWD=<pwd>")
cur = con.cursor()
cur.execute("CREATE TABLE #test (t text)")
cur.close()
cur = con.cursor()
cur.execute("INSERT INTO #test(t) VALUES(?)", ('test\n',))
cur.close()
con.close()
/etc/odbcinst.ini:
[ODBC Drivers]
TDS MSSQL = installed
[SQL Server]
Description = TDS MSSQL ODBC Driver v 4.2
Driver = /usr/local/lib/libtdsodbc.so
after the line cur.execute("INSERT ... ") I get an error:
>>> cur.execute("INSERT INTO #test(t) VALUES(?)", ('test\n',))
Traceback (most recent call last):
(Continue reading)
RSS Feed