ironman Posted January 22, 2008 Share Posted January 22, 2008 Hello all. I'm having an issue connection to my database through Dreamweaver. I receive the following error message when I try to connect: "Error: 2005 Unknown MySQL Server Host " I am using XP Home Edition with Microsoft SQL Server 2008 Express along with Microsoft SQL Server Management Studio Express version 9.00.2047.00. Using the Management Studio I can connect to the SQL server just fine using both SQL Server Authentication or Windows Authentication. However when I try and make the connection within Dreamweaver I receive the above error message. I've searched around to see if it was something I had to enable within the SQL Server Configuration, but all research has led me to a dead end. As far as the connection through Dreamweaver, I use the following to try and connect. Connection Name: dataconn MySQL Server: COMPUTERNAME\SQLEXPRESS User Name: username Password: password Datbase: the correct database Any help would be much appreciated Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/87233-mysql-connection-problem-through-dream-weaver/ Share on other sites More sharing options...
wildteen88 Posted January 22, 2008 Share Posted January 22, 2008 This part: MySQL Server: COMPUTERNAME\SQLEXPRESS Should be set to localhost Make sure MySQL is running before attempting a connection. Quote Link to comment https://forums.phpfreaks.com/topic/87233-mysql-connection-problem-through-dream-weaver/#findComment-446249 Share on other sites More sharing options...
ironman Posted January 22, 2008 Author Share Posted January 22, 2008 Thanks for your reply. I've tried changing it to localhost with no success. Do you think the issue has something to do with using dreamweaver to connect to my Microsoft SQL Server 2008 Express? Does the connection string need to change maybe? Right now, i've just tried to use the following connection string, but it does on the MSSQL_CONNECT line. <?php $hostname = "localhost"; $username = "name"; $password = "password"; $dbName = "database"; MSSQL_CONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND."); mssql_select_db($dbName) or DIE("Table unavailable"); $query = "SELECT * FROM users"; $result = MSSQL_QUERY($query); $number = MSSQL_NUM_ROWS($result); $i=0; if ($number == 0) : print "No data?"; elseif ($number > 0) : print "Data: "; while ($i < $number) : $name = mssql_result($result,$i,"Name"); print $name; print " "; $i++; endwhile; endif; ?> Quote Link to comment https://forums.phpfreaks.com/topic/87233-mysql-connection-problem-through-dream-weaver/#findComment-446256 Share on other sites More sharing options...
wildteen88 Posted January 22, 2008 Share Posted January 22, 2008 If you want to connect to an SQL database with PHP you'll need to use the mssql_* functions or odbc_* functions. The mysql_* functions are for use with MySQL databases only. As for connecting to an SQL server through Dreamweaver you'll have to download an extension for that. Dreamweaver by default comes only with MySQL database support. Quote Link to comment https://forums.phpfreaks.com/topic/87233-mysql-connection-problem-through-dream-weaver/#findComment-446293 Share on other sites More sharing options...
ironman Posted January 23, 2008 Author Share Posted January 23, 2008 Thanks for the reply. I've changed the code to the following so that it should connect to the mssql database, but still the same error. Its gotta be a port issue, or something silly like that. Anyone else have any input? I changed the code to: <?php session_start(); set_time_limit(0); error_reporting(E_ALL); //complete "station\sqlexpress" with your particular case $SERVER = "localhost"; $ADMIN_NAME = "name"; //complete pass with your pass $ADMIN_PASS = "password"; //complete database witht the name of database you whant to connect to $DATABASE = "database"; $Conexion = mssql_connect($SERVER, $ADMIN_NAME, $ADMIN_PASS) or die ("Can't connect to Microsoft SQL Server"); mssql_select_db($DATABASE, $Conexion) or die ("Can't connect to Database"); ?> I've changed the $SERVER = "localhost"; and i've changed it to the ip address, as well as station\sqlexpress all with the same error message. The error message is: "Fatal error: Call to undefined function: mssql_connect() in c:\apache\htdocs\mastec\db_connect.php on line 14" Line 14 is "$Conexion = mssql_connect($SERVER, $ADMIN_NAME, $ADMIN_PASS)" Another note- I can: Connect to the database through Management Studio just fine (sql auth and windows auth) Verify SQL is running Verifed the user name and password for the db connect is active and works Verify SQL is running Quote Link to comment https://forums.phpfreaks.com/topic/87233-mysql-connection-problem-through-dream-weaver/#findComment-446975 Share on other sites More sharing options...
wildteen88 Posted January 23, 2008 Share Posted January 23, 2008 Make sure the mssql extension is enabled within the php.ini, currently mssql is not enabled with your php setup this is why you're getting the undefined function mssql_connect error message Quote Link to comment https://forums.phpfreaks.com/topic/87233-mysql-connection-problem-through-dream-weaver/#findComment-447097 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.