Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inconsistent Database Connection

Status
Not open for further replies.

BiJae

Programmer
Oct 1, 2002
154
US
Greetings. I'm hoping someone can help me with this issue. I'm pretty sure it's a Microsoft SQL Licensing Issue, but would like confirmation... Here's the situation...

I use this file to connect to the database:

Code:
define("DATABASE_HOST","localhost");
define("DATABASE_PORT","");
define("DATABASE_OPTIONS","");
define("DATABASE_TTY","");
define("DATABASE_NAME","EventDB");
define("DATABASE_USER","status_user");
define("DATABASE_PASSWORD","status_user");


class DBManager
{
        var $conn_id;
        var $db_id;
        var $result;
        var $row_number;
        /**
        Constructor for class
        */
        function DBManager()
        {
  $this->conn_id = mssql_pconnect(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD);

   return $this->db_id = mssql_select_db(DATABASE_NAME);
}
It has worked for me for years without fail, (on MySql). My new company is using MSSQL. I've installed the libraries and see the following in phpinfo():

php_info() said:
mssql
MSSQL Support enabled
Active Persistent Links 9
Active Links 9
Library version 7.0

Directive Local Value Master Value
mssql.allow_persistent On On
mssql.batchsize 0 0
mssql.compatability_mode Off Off
mssql.connect_timeout 5 5
mssql.datetimeconvert On On
mssql.max_links Unlimited Unlimited
mssql.max_persistent Unlimited Unlimited
mssql.max_procs Unlimited Unlimited
mssql.min_error_severity 10 10
mssql.min_message_severity 10 10
mssql.secure_connection Off Off
mssql.textlimit Server default Server default
mssql.textsize Server default Server default
mssql.timeout 60 60

I built a page that runs several different queries to display various pieces of information. All queries use this DBManager connection to connect. I had no problem building this out and getting the information to return to the page. Things were going smoothly. So I sent the page to my team for review.

Two of them came back to me immediately with errors. They are showing:

MS IE6 said:
Warning: mssql_pconnect() [function.mssql-pconnect]: Unable to connect to server: localhost in C:\Program Files\Apache Group\Apache2\htdocs\airtran\portal\scripts\DBManagerDS.php on line 42

I had the page up at the same time and I refreshed without error. So I went over to their computer and had them refresh. The error message is random and appears in different sections, meaning it will run the first and second query fine then fail on the third during the first refresh. On the next refresh it might fail on all four then on another refresh it will run the first and third fine and fail on the second and fourth. If I close the connection to the application on the second computer all errors go away on my machine.

Is this a licensing issue for MSSQL? When I look at the Activity Monitor for MSSQL I see four threads (all sleeping). Earlier I saw nine threads. I've killed all the threads on the server for this user and reloaded all the pages with the same error.

Anybody have a suggestion?

Thank you for your time...


"If the only prayer you said in
your whole life was, 'thank you,'
that would suffice."
-- Meister Eckhart
 
Check out the following link in the php manual for mssql_pconnect [ ] and have a look at the comment from the person at burntpopcorn.net. You "could" be running into a threading issue (I ran into the same thing using MySQL pconnect).

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top