469,626 Members | 996 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

trouble with mxODBC, unixODBC and MSSQL

I am using a script that's worked for me in the past on Windows, but
now that i've moved it to a Linux machine it is not. The trouble seems
to be when trying to insert escaped characters into a varchar field
(\n \r ,etc.).

# conn = mx.ODBC.WINDOWS.DriverConnect('DSN=myDSN;UID=sa;PW D=pwd')

conn = mx.ODBC.unixODBC.DriverConnect('DSN=myDSN;UID=sa;P WD=pwd')
curr = conn.cursor()

# These strings do not work:
# mystring = "Some text \n and some other text"
# mystring = "Some text \t and some other text"
# mystring = """Some text
and some other text"""

# This tring works just fine:
mystring = "Some text and some other text"
sql_insert = "insert into DEV..msg(message_id,body) values(?,?)"

curr.execute(sql_insert, (1,mystring))

Here's the error message:

Error Type: OperationalError
Error Value: ('', 8179, '[unixODBC][FreeTDS][SQL Server]Could not find
prepared statement with handle 0.', 6083)

Any ideas greatly appreciated.

Apr 1 '06 #1
0 964

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Cary | last post: by
9 posts views Thread by Penn Markham | last post: by
reply views Thread by Tbird67ForSale | last post: by
3 posts views Thread by Roy Souther | last post: by
1 post views Thread by Sean Davis | last post: by
12 posts views Thread by Todd Michels | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.