Jump to content

MySQL Connection Problem through Dream Weaver


Recommended Posts

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!

 

 

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;

 

?>

 

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.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.