lingo
lingo

Reputation: 1908

ODBC driver with Zend Server

I just installed the Zend Server on my system and I'm trying to test my database connections. I prefer using PDO to connect my databases.

MySQL connection works very well, but when I'm trying to connect MS SQL server I got an error.

Connection to MSSQL Server failed: SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified

This is the code that I'm trying to run

try {
    $pdo = new PDO('odbc:host=ip-addr; dbname=my-database', 'user', 'password');
    echo "Successfully connected to MSSQL Server";
} catch (PDOException $e) {
    echo "Connection to MSSQL Server failed: " . $e->getMessage();
}

I have successfully enabled odbc and pdo_odbc in the configuration panel. I'm running this on macOS Sierra 10.12.

Thanks in advance.

Upvotes: 1

Views: 720

Answers (1)

lingo
lingo

Reputation: 1908

I found this tutorial, and it brought me to succeed. It's written for Linux, but I just installed Homebrew and followed the tutorial a bit adapting.

Upvotes: 1

Related Questions