Re: db performance

From: Date: Thu, 21 Jun 2001 18:10:31 +0000
Subject: Re: db performance
Groups: php.windows 
Request: Send a blank email to php-windows+get-7972@lists.php.net to get a copy of this message
Hi Scott, This could be an networking issue. Is the SQL server and the Web server on the same computer ? Are you using tcp/ip or netbeui to communicate from web server (php) to the database server ? If web and database is on the same platform I would recommend using netbeui and connect to a server named local. This gives a direct connection to the server. If you are using two different boxes I would use tcp/ip. This uses you approx. 8 times less bandwidth. You have to configure the client (the MSSQL Client tools on the web server) to either use the protocol you prefer as default or by adding a client network configuration. mssql_connect() calls a MSSQL function to connect to the database. It first looks for a client configuration that matches the name you are specifying as first parameter. If that fails it tries to connect using the default protocol (doing a DNS lookup for tcp/ip or a netbeu broadcast). These can take some time depending on network settings. When you create a client network configuration using tcp/ip, you can connect directly to an ip address so you wount have to do DNS lookups. - Frank > Hi- > > I have a Microsoft SQL 2000 server that I am running a simple query > from. It is > taking up to a minute to call. Running IIS 5.0, IE 5.5. > > Any thoughts? I checked the following: > > 1-A similar ASP script is fine. > 2-I can ping the server > 3-In MS Query analyzer it takes milliseconds to finish > > Here is the code: > > <select name="RESORT_ID"> > <option value="All">Search All Resorts</option> > <? > $connection = mssql_connect("scott", "blah", "blah!!") or die > ("Can't > connect to db server"); > $db = mssql_select_db("webdb", $connection) or die ("Can't select > db!"); > $sql = "select resort_id,resort_name from resort order by resort_name"; > $sql_result = mssql_query($sql,$connection) or die ("Can't run query!"); > while ($row = mssql_fetch_array($sql_result)){ > $resort_id = $row["resort_id"]; > $resort_name = $row["resort_name"]; > echo "<option value=\"$resort_id\">$resort_name</option>"; > } > mssql_free_result($sql_result); > mssql_close($connection); > ?> > </select> > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.windows (#7972) next »