Closed GoogleCodeExporter closed 9 years ago
Although pymssql uses FreeTDS, I don't intend for it to be used in conjunction
with entries int the freetds.conf file. I want to abstract away FreeTDS as
much as possible that python developers don't need to know anything about it.
Therefore, you should use the port parameter on the connection:
conn = pymssql.connect(host='sql10.example.com', user='usr',
password='pwd',database='my_db', port='3010')
> However these are not ideal as I want tds to sort out the port number.
Sorry, as explained above, thats pretty much the exact opposite of how I'd like
to see pymssql work. If you have a legitimate reason why freetds.conf is
needed over setting the port in the connection, please explain your use case.
Original comment by rsyr...@gmail.com
on 24 Nov 2011 at 4:13
Hi - thanks for the reply. My use-case is quite specific to my situation -
where a web-service passes me a hostname and I then use that to connect to the
db via freetds.conf. The port-number is not currently included in that
web-service.
Based on your comment - I'll take the route of getting that web-service updated
to pass me a port number.
Thanks for looking at this - great product...
Original comment by christop...@bankofamerica.com
on 24 Nov 2011 at 10:24
FYI, you can also add the port to the hostname:
conn = pymssql.connect(host='sql10.example.com:3010', user='usr',
password='pwd',database='my_db')
Not sure if that helps your use-case, but figured I would mention it.
Original comment by rsyr...@gmail.com
on 26 Nov 2011 at 3:09
I may be missing something in Pymssql which is doing this already, but the
approach implemented is difficult to use when the database you want to connect
to has an instance name. In that case the port is given out dynamically by sql
server. There is a service running by default on port 1434 that returns
information about the instances. FreeTDS must be using it to allow you to
specify the instance name in Freetds.conf. If we could have an "instance"
parameter in pymssql and use it instead of the port it would be very helpful.
It could be a passthrough to FreeTDS or separately implemented behavior in
pymssql.
Original comment by larry.da...@gmail.com
on 27 Jan 2012 at 11:07
Its already supported:
connect(server=r'myserver\instance1', user=username, password=password)
Original comment by rsyr...@gmail.com
on 30 Jan 2012 at 4:45
Original issue reported on code.google.com by
christop...@bankofamerica.com
on 23 Nov 2011 at 3:41