sql server - php pdo with mssql and a dns -


trying see if can make pdo open mssql database on server. vbscript call connection looks this:

set myconn = server.createobject("adodb.connection") myconn.open("dsn=mydsn;uid=myuid;pwd=mypwd;database=mydatabase;app=asp script") 

then when trying port on php using pdo unable find information on using dsn pdo.

here have far:

try {     $conn = new pdo('mssql:server=localhost;database=mydsn','myuid','mypwd') or die('error');     $conn->setattribute( pdo::attr_errmode, pdo::errmode_exception );     $sql = "select name people";     $qresult = $conn->prepare($sql);     $qresult->execute();     foreach ($qresult->fetch(pdo::fetch_assoc) $row){         echo $row['name'].'<br/>';     } } catch (pdoexception $e) {     print "error!: ".$e->getmessage()."<br/>";     die(); } 

but get

error!: sqlstate[hy000]: general error: 10007 invalid object name 'name'. [10007] (severity 5) [(null)] 

my guess because cannot put dsn anywhere in pdo code.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -