How to use dblib
How to use dblib
Hi Allan and community. I have a editable table and I need to connect a database in SQL SERVER.
My Apache server is mounted in Linux and I can't install de sqlsrv because this driver only for Systems Windows.
DB SERVER INFO: SQL SERVER 2008 in Windows.
Client Server: Apache, PHP versión 5.3.3 in Linux Red Hat.
I've installed freetds:
$ tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v0.91
freetds.conf directory: /etc/freetds
MS db-lib source compatibility: no
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 4.2
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: yes
my freetds conf:
[global]
; tds version = 4.2
; dump file = /tmp/freetds.log
; debug flags = 0xffff
; timeout = 10
; connect timeout = 10
text size = 64512
# A typical Microsoft server
[192.168.xxx.xx]
host = 192.168.xxx.xx
port = 1433
tds version = 8.0
dump file = /var/log/freetds.log
I did a test connection:
$ tsql -S 192.168.xxx.xx TS -U user_db -P password
locale is "es_ES.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1>
and in my Database/Driver/Sqlserver/Query.php
try {
$pdo = new PDO(
"dblib:Server={$host}{$port};Database={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
)
);
When I execute my web app says me:
DataTables warning: table id=example - An error ocurred while coneccgin to the database 'Aseguradoras'. The error reported by the server was: SQLSTATE[HY000] unable ti connect: Adaptive Server is unavailable or does exist (severiry 9)
I hope your help. Thanks in advance.
This question has an accepted answers - jump to answer
Answers
Are you able to create a PDO connection to the server without using the Editor libraries?
Allan
Thanks for the answer Allan, In fact, I have no idea how to create a connection.
How I can make the connection with the libraries of the editor?
My DB server is Windows, But my client server in Linux
I would suggest trying to make the connection outside of Editor first to make sure that your setup is correctly configured to be able to make a PDO connection.
Allan