Eu tenho um servidor Ubuntu 12.04 e estou tentando estabelecer uma conexão com um banco de dados MSSQL.
Eu consegui me conectar usando tsql
e isql
, mas osql
não funciona e conectar com o PHP usando o PDO também não está funcionando .. Vou tentar fornecer o máximo de informações possível e se você precisar de mais, é só me avisar e eu vou editar.
freetds.conf :
[MSSQL]
host = TPSACC
port = 54488
tds version = 8.0
odbc.ini :
[MSSQL]
Description = MS SQL connection to PRODUCTION database
Driver = FreeTDS
Database = PRODUCTION
Server = TPSACC
UserName = sa
Password = pass
Trace = No
TDS_Version = 8.0
Port = 54488
odbcinst.ini :
[FreeTDS]
Description = ODBC for Microsoft SQL
Driver = /usr/local/lib/libtdsodbc.so
UsageCount = 1
Threading = 2
~ > isql MSSQL sa pass
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
~ > tsql -S MSSQL -U 'sa' -P 'pass'
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1>
~ > osql -S MSSQL -U sa -P passe
checking shared odbc libraries linked to isql for default directories...
strings: '': No such file
trying /tmp/sql ... no
trying /tmp/sql ... no
trying /etc ... OK
checking odbc.ini files
reading /home/toolplas/.odbc.ini
[MSSQL] not found in /home/toolplas/.odbc.ini
reading /etc/odbc.ini
[MSSQL] found in /etc/odbc.ini
found this section:
[MSSQL]
Description = MS SQL connection to PRODUCTION database
Driver = FreeTDS
Database = PRODUCTION
Server = TPSACC
UserName = sa
Password = pass
Trace = No
TDS_Version = 8.0
Port = 54488
looking for driver for DSN [MSSQL] in /etc/odbc.ini
found driver line: " Driver = FreeTDS"
driver "FreeTDS" found for [MSSQL] in odbc.ini
found driver named "FreeTDS"
"FreeTDS" is not an executable file
looking for entry named [FreeTDS] in /etc/odbcinst.ini
found driver line: " Driver = /usr/local/lib/libtdsodbc.so"
found driver /usr/local/lib/libtdsodbc.so for [FreeTDS] in odbcinst.ini
/usr/local/lib/libtdsodbc.so is an executable file
"Server" found, not using freetds.conf
Server is "TPSACC"
osql: no IP address found for "TPSACC"
No PHP eu tenho:
$conn = new PDO ("dblib:host=TPSACC;dbname=PRODUCTION","$username","$pw");
.. ou ..
$conn = new PDO ("dblib:host=TPSACC;port=54488;dbname=PRODUCTION","$username","$pw");
E ambos retornam esse erro:
SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)
Estou preso aqui há alguns dias e não entendi por que apenas metade das conexões realmente funciona.
Toda e qualquer ajuda é muito apreciada, obrigado!