Skip to Content.
Sympa Menu

freetds - AW: [freetds] connect problem to mssql 7.0

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "roland bole" <roland.bole AT gmx.at>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: AW: [freetds] connect problem to mssql 7.0
  • Date: Wed, 10 Dec 2003 19:25:11 +0100


Ok,

this is the testscript i use.
<?php
$sql_host="xxx.xxx.xxx.xxx:1433";
$sql_user="test";
$sql_pass="test";
$sql_name="test";

echo
"
<form method='post' action = '".$HTTP_SERVER_VARS["PHP_SELF"]."'>
<input type='text' name='search'><br><br>
<input type='hidden' name='test' value='teste'>
<input type='submit' name='submit' value='test'>
</form>

";

if($HTTP_POST_VARS["test"] == "teste")
{
$db_conn = mssql_pconnect ($sql_host,$sql_user,$sql_pass) or die
("Could not connect to database: ".mssql_get_last_message());


mssql_select_db ($sql_name, $db_conn) or die ("Could not select
database: ".mssql_get_last_message());

$sql = "select a.C003 as Name , b.C052 as Ort, b.C019 as Telefon1,
b.C020 as Telefon2, a.C002 as kundennr
from T0550203 a left outer join
T0510203 b on a.C002 = b.C001 where a.C003 like
'".$HTTP_POST_VARS["search"]."%' order by a.C003";


$query_result = mssql_query ($sql,$db_conn) or die ("query faild:
".mssql_get_last_message());


while ($result = mssql_fetch_array($query_result)){

echo $result["Name"]."<br>";

}


}

?>

the connection and the script work fine, but if you do nothing ca. 30 - 60
minutes the following error will reported from php

Fatal error: Maximum execution time of 40 seconds exceeded in mssql.php on
line 24

That’s it.


-----Ursprüngliche Nachricht-----
Von: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] Im Auftrag von ZIGLIO Frediano
Gesendet: Mittwoch, 10. Dezember 2003 17:15
An: FreeTDS Development Group
Betreff: RE: [freetds] connect problem to mssql 7.0

>
> Thanks for our help and effort.
>
> With netstat i can see that they are divers connections to my
> mssql server. If I compare the PID I can see one httpd id is
> equal to one connection to my mssql server on port 1433
>
> That means php open a new connection to the new PID from httpd.
>
> > When first process finish connections are automatically closed... or
> > not ??
> I think so,
>
> i can not reproduce the error, with my testscript, because the error
> occurred without any system. (I can see anyone)
>

I don't follow you...

> after a restart the apache it works fine, and the connections closed
> automatically.
>
> what should I do to get a stable connection?
>
>
> Roland
>
>

PHP speaks about persistent connections... I don't know how to fix your
problem however in every script you use you have to use mssql_pconnect
to get a valid connection. Do not expect to use the connection id (the
mssql_pconnect result) in another script.

freddy77
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds







Archive powered by MHonArc 2.6.24.

Top of Page