From: Michał S. <mi...@sa...> - 2011-01-25 22:03:29
|
Dnia 2011-01-25, wto o godzinie 15:49 -0600, Robert Boehne pisze: > Michał Sawicz wrote: > > I also tried tsql itself, which seemed to connect (I got a 1> prompt) > > but regardless of what query I tried to execute, I got no response, > > dropping me to another prompt (2>). > > > did you type "go" at the 2nd prompt and hit <Enter> ? Right, new to Sybase, thanks for that - it worked. > It sounds like you're not specifying the right arguments to allow these > pieces of software to connect to the server. > Normally, you need a hostname, port, username and password. How you > combine those to get a connection would depend on the specific software > you're using. > > Post the details of how you create the connection - better yet - try and > connect with explicit arguments, after you make sure you know what to > set where. OK, so: > tsql -S asademo -U DBA works. But in python, either of: > conn = pymssql.connect(host='asademo', user='DBA', password='SQL', > database='asademo') > conn = pymssql.connect(host='asademo', user='DBA', password='SQL') result in: > --------------------------------------------------------------------------- > InterfaceError Traceback (most recent call last) > > /root/<ipython console> in <module>() > > /usr/lib/pymodules/python2.6/pymssql.pyc in connect(dsn, user, password, host, database, timeout, login_timeout, trusted, charset, as_dict, max_conn) > 607 raise OperationalError, e[0] > 608 except _mssql.MssqlDriverException, e: > --> 609 raise InterfaceError, e[0] > 610 > 611 # default query timeout > > > InterfaceError: Could not set connection properties Using dsn: > conn = pymssql.connect(dsn='asademo', user='DBA', password='SQL', > database='asademo') or > conn = pymssql.connect(dsn='asademo', user='DBA', password='SQL') both yield: > --------------------------------------------------------------------------- > InterfaceError Traceback (most recent call last) > > /root/<ipython console> in <module>() > > /usr/lib/pymodules/python2.6/pymssql.pyc in connect(dsn, user, password, host, database, timeout, login_timeout, trusted, charset, as_dict, max_conn) > 607 raise OperationalError, e[0] > 608 except _mssql.MssqlDriverException, e: > --> 609 raise InterfaceError, e[0] > 610 > 611 # default query timeout > > > InterfaceError: Connection to the database failed for an unknown reason. Hope that clears things up... BTW, here's a relevant part of my freetds.conf: > [asademo] > host = 127.0.0.1 > port = 2638 > tds version = 5.0 > dump file = /tmp/freetds.log > debug flags = 0xffff I can provide the freetds.log file, if it would help, of course. Thanks for the fast response, -- Michał Sawicz <mi...@sa...> |