sql server - Apache 2.4.7 on Ubuntu 14.04 will not connect to MSSQL through PHP 5.5 -


I am trying to connect to remote MSSQL servers using the platforms listed in the title. I have free TDS and all relevant ODBC packages. Here's my FRIEDIDES. Configuration:

  $ $ Id: freetds.conf, v 1.12 2007/12/25 06:02:36 jklowden exp $ # # This file is set by Free TDS, if not by the same name The file is found in the installation directory. # # For information about the layout of this file and its settings, see #freetds.conf Manpage "man freetds.conf". # Global Settings are overridden by those in a Database # Server-specific section [Global] # TDS Protocol version; TDS version = 4.2 # Write a TDSMMMP file for diagnostic purposes # (This setting / TMP is unsafe on multi-user systems); Dump file = /tmp/freetds.log; Debug Flags = 0xffff # Order and Connection Timeout; Timeout = 10; Connect timeout = 10 # If you exit the memory errors, this may mean that your client is trying to allocate a huge buffer for the # text field. # 'The more appropriate range text size setting' 64512 [DEVSQL] host = xxxx example = DEVSQL tds version = 8.0   

Here is my odbc.ini:

 [ODBC Data Source] DEVSQL = FreeTDS Connection Server [DEVSQL] Description = MSSQL Server Driver = Freetds ServerName = DEVSQL Database = Testing TDS_Version = 8.0   

This is my PHP code:

  & lt ;? Php $ dbname = "test"; $ ServerName = "DEVSQL"; $ Username = "myuser"; $ Password = "mypassword"; {$ Db = new PDO ('odbc: driver = free TDS; server ='. $ Servername. '; Database ='. $ Dbname. '; UID =' .US username ''; PWD = '. $ Password .; ';); Database = '. $ Dbname. '; Uid = '. $ Username. '; PWD = '. $ Password. '; '); } Hold (PDOException $ Exception) {Dead ("Unable to open database. 
Error message:






} Echo & lt; H1 & gt; Connect successfully! & Lt; / H1> '; ? & Gt;

I am able to connect properly using the following command in the terminal:

  TDS = 8.0 tsql -s devsql -U myuser-P Mypassword   

Also:

  isql -v devsql myuser mypassword   

But when I browse in index.php I get Firefox the following error:

Exception 'with message' PDOException 'SQLSTATE [08001] SQLDriverConnect: 0 [unixODBC] [Free TDS] [SQL Server] to connect to data source Unable to 'var / www / html / index.php: 16 st IAC Trace: # 0 /var/www/html/index.php(16): PDO-> __Construct ('ODBC: Driver = FRE ...') # 1 {main}.

Any help much appreciated! Allos, if anyone has a better way of connecting to Linux than using a SQL server from a SQL server, then I have all the ears. Thanks again!

Edit: I forgot to say: Ubuntu and Apache are running on a Win7 host inside a V7 issue. The Win7 environment on the same machine is where SQL Server is running. I'm not sure that this is relevant because they are talking just fine, but I thought I would take it out of there.

This article helps me, in my case it was Yii with MySQL sync MSSQL

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -