I am currently connecting to a Sybase 15.7 server using sybpydb . This seems to be fine:
import sys sys.path.append('/dba/sybase/ase/15.7/OCS-15_0/python/python26_64r/lib') sys.path.append('/dba/sybase/ase/15.7/OCS-15_0/lib') import sybpydb conn = sybpydb.connect(user='usr', password='pass', servername='serv')
works fine. Changing any of my connection data results in a connection error.
Then I select the database:
curr = conn.cursor() curr.execute('use db_1')
however now when i try to run queries it always returns None
print curr.execute('select * from table_1')
I tried to run use and select queries in the same execute , I tried to include go commands after each of them, I tried to use curr.connection.commit() after each of them, without success. I have confirmed using dbartisan and isql that the same queries as me use the returned records.
Why am I not getting results from my queries in python?
EDIT:
Just extra info. To make sybpydb import work, I had to change two environment variables. I added the lib paths (the same ones that I added to sys.path ) in $LD_LIBRARY_PATH , i.e.:
setenv LD_LIBRARY_PATH "$LD_LIBRARY_PATH":dba/sybase/ase/15.7/OCS-15_0/python/python26_64r/lib:/dba/sybase/ase/15.7/OCS-15_0/lib
and I had to change the SYBASE path from 12.5 to 15.7. All this was done in csh .
If I print conn.error (), after each curr.execute (), I get:
("Server message: number(5701) severity(10) state(2) line(0)\n\tChanged database context to 'master'.\n\n", 5701)