SQL server odbc setup issue

QuestionsSQL server odbc setup issue
NP asked 6 years ago

I'm a beginner in PHP.

<?php
include("phpgrid-full-v1.5.2/lib/inc/jqgrid_dist.php");
$db_conf = array();
$db_conf["type"] = "odbc_mssql";
$db_conf["server"] = "Driver={SQL Server};Server=ip:port;Database=dbname;";
$db_conf["user"] = "userid";
$db_conf["password"] = "password";
$db_conf["database"] = "dbname";

$g = new jqgrid($db_conf);

$grid["caption"] = "Sample Grid";
$g->set_options($grid);
$g->set_actions(array("inlineadd"=>true));

$g->select_command = "select * from dbTable";

// render grid
$out = $g->render("list1");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/themes/redmond/jquery-ui.custom.css"></link>
<link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/jqgrid/css/ui.jqgrid.css"></link>

<script src="../../lib/js/jquery.min.js" type="text/javascript"></script>
<script src="../../lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="../../lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="../../lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
</head>
<body>
You must have SQL Server installed: for this demo. Also set database credentials in this demo.
<div style="margin:10px">
<?php echo $out?>
</div>
</body>
</html>

This code always yields :You must have SQL Server installed: for this demo. Also set database credentials in this demo.

I have SQL server installed and my credentials work when I setup an windows ODBC but it doesn't seem to be the case with PHP.

Also is there any sql server prep that I need to do set this up?

NP

2 Answers
Abu Ghufran answered 6 years ago

Hello,

Configuration seems fine … i tested the scenario with odbc_mssql with following config.

$db_conf = array();
$db_conf["type"] = "odbc_mssql";
$db_conf["server"] = "Driver={SQL Server};Server=(local)sqlexpress;Database=master;";
$db_conf["user"] = null;
$db_conf["password"] = null;
$db_conf["database"] = null;

Ange answered 5 years ago

What are you supposed to write under "{SQL Server}".

Your Answer

20 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?