[egenix-users] Initial Install - Error 'vars not set'
Nick Albright
nick.albright at v-space.org
Wed Jun 7 17:55:02 CEST 2006
Hello! I was wondering if anyone could help me troubleshoot my fresh
install of mxODBC. I'm using iODBC with freeTDS to connect to a MS SQL
server. I execute a select statement and do a fetchone() and I get the
error:
-----Begin Error-----
Traceback (most recent call last):
File "tmp/sql_test.py", line 35, in ?
data = curs.fetchone()
mxODBC.InterfaceError: mxODBCursor_Fetch called, but vars not set
-----Begin Error-----
The full code is:
-----Begin Code-----
import mx.ODBC.iODBC as A
db = A.connect( "MSSQL", "USER", "PASS" )
curs = db.cursor()
curs.execute( "SELECT COUNT(*) AS c FROM items" )
data = curs.fetchone()
print data
-----End Code-----
And I believe the odbc and freetds side is setup correctly as I can use
isql just fine:
-----Begin isql-----
$ isql -v MSSQL USER PASS
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> SELECT COUNT(*) AS c FROM items;
+------------+
| c |
+------------+
| 3897 |
+------------+
SQLRowCount returns 1
1 rows fetched
SQL>
-----End isql-----
I know it is connecting OK, as if I change any of the connection
parameters, I get an exception connecting. However, it is strange in that
if I change iODBC to unixODBC (Which I don't have installed), I get the
same error.. And after the execute the curs.rowcount is -1.
Any help would be most appreciated.
Thanks for your time,
-Nick
---
"I'm happy with where I'm at now. Its never good enough of course, but
I'm not extremely pissed at least."
-- John Mancine on some code (1/10/2005)
More information about the egenix-users
mailing list