MarkOB
July 12, 2013, 4:32pm
#1
I am currenty unable to connect to a MS SQL Express 2012 database using the grid connector. From what I can tell, the grid_connector.php and db_mssql.php files are not the problem. The following is my php code:
<?php
require("../xml/grid_connector.php");
require("../connector_codebase/db_mssql.php");
$res=mssql_connect('.\SQLEXPRESS',"sa","mark",false);
mssql_select_db("Grid");
$gridConn = new GridConnector($res,"MsSQL");
$gridConn->render_table("dbo.Quotes","Id","Quote,ProjectName,PM");
?>
I appreciate any assistance you can offer.
Mark
If you are using latest PHP driver from Microsoft, you need to use db_sqlsrv.php not db_mssql.php and connect to DB like
[code]require("…/connector_codebase/db_sqlsrv.php");
$connectionInfo = array( “Database”=>“dbName”);
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$gridConn = new GridConnector($conn,“SQLSrv”);[/code]
Also, beware that Express edition of MsSQL do not allow login for “sa” user by default, it need to be enabled in server configuration.
MarkOB
July 19, 2013, 4:32pm
#3
Thank you! This code worked great! I also discovered I needed to add the native client and update my php.ini file. Now, I’m up and running.