john.doo
john.doo

Reputation: 23

Client side to connect to sybase IQ using Python3

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?

Upvotes: 2

Views: 5042

Answers (2)

Saurabh
Saurabh

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

Graeme Perrow
Graeme Perrow

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

Related Questions