Reputation: 23
I am using Ubuntu and I want to connect to a sybase IQ server (remote) from my client machine ,I tried installing/using sqlanydb according to sybase documentation, but i don't see any parameter in sqlanydb.connect() related to IP of the sybase server. I think this routine imagines that sybase db is on localhost, am I right?
Do i need to install the sybase on client side as well to be able to connect to that remote sybase db? or just the sqlanydb is enough?
How can I make this driver to connect to a remote server?
Upvotes: 2
Views: 5042
Reputation: 7833
You can connect with below api,
import Sybase
db = Sybase.connect('server','name','pass','database')
c = db.cursor()
c.execute("sql statement")
Make sure dsn is present in sql.ini file.
Upvotes: 0
Reputation: 57248
You do need to install the client software. The python driver is basically a python interface to the dbcapi client library, so you can't use it without the client software installed on the machine.
For connecting to a remote server, you can use the HOST parameter. The connect()
function takes as arguments any valid connection parameter, so a connection string like uid=steve;pwd=secretpassword;host=myserverhost:4567;dbn=mydatabase
would translate to:
sqlanydb.connect( uid = 'steve',
pwd = 'secretpassword',
host = 'myserverhost:4567',
dbn = 'mydatabase' )
Connection parameters are documented here. If HOST is not used, the client attempts a shared memory connection. Shared memory is faster than TCP but obviously only works if the client and server are on the same machine.
Upvotes: 4