Pergunta

I have a SQL Server database named pm-eng that I need to connect to from a linux box. I've setup unixODBC and configured my odbc.ini as follows:

[pm_production]
Driver    = FreeTDS
Server    = mssql.server
Database  = pm-eng

When I test with iSQL, I get an error connecting saying that the the 'pm' database does not exist. I've tried wrapping the database name in [] and quotes with no luck. Ideally I would just change the name of the DB but that is not possible in this environment. I've verified my connection with a DB name that is not hyphenated and it works fine. Is it possible to connect to ODBC DSNs with hyphenated DB names?

Foi útil?

Solução 2

This turned out to be an issue with FreeTDS, not unixODBC. I needed to specify a TDS_Version in the odbc.ini file and it started working. Final config looks like this:

[pm_production]
Driver    = FreeTDS
Server    = mssql.server
Database  = pm-eng
TDS_Version = 8.0

Outras dicas

Since you're connecting to a MSSQL database maybe you can try this:

[pm_production]
Driver = FreeTDS
Server = mssql.server

And then connect with a user who's default Database is pm-eng

According to documentation found on MSDN: "If Database is not specified, the default database defined for the login is used."

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top