Connecting with SQL Server
Connecting with SQL Server
Following code snippet connect PHP Grid Framework to SQL Server.
$db_conf = array();
$db_conf["type"] = "mssqlnative";
$db_conf["server"] = "(local)\sqlexpress";
$db_conf["user"] = null;
$db_conf["password"] = null;
$db_conf["database"] = "master";
$g = new jqgrid($db_conf);
...
$g->table = "[msdb].[dbo].[syscategories]";
Resources
- Sample Code
- You can check this demo in archive
demos/loading/db-layer-sqlsvr.php
Connecting Azure database:
$db_conf = array();
$db_conf["type"] = "mssqlnative";
$db_conf["server"] = "phpgrid.database.windows.net"; // ip:port
$db_conf["user"] = "admin_phpgrid";
$db_conf["password"] = "xxxxx";
$db_conf["database"] = "griddemo";
include("../../lib/inc/jqgrid_dist.php");
$g = new jqgrid($db_conf);
Using PDO for SQL Server Azure:
$db_conf = array();
$db_conf["type"] = "pdo";
$db_conf["server"] = "sqlsrv:Server=phpgrid.database.windows.net";
$db_conf["user"] = "admin_phpgrid"; // username
$db_conf["password"] = "xxxxx"; // password
$db_conf["database"] = "griddemo"; // database
include("../../lib/inc/jqgrid_dist.php");
$g = new jqgrid($db_conf);
Resources
- Sample Code
- You can check this demo in archive
demos/loading/db-layer-sqlsvr-azure.php