Jump to content

Archived

This topic is now archived and is closed to further replies.

manishtyagi83

multiple connections using mssql_connect()

Recommended Posts

Hi everyone,

 

I have written a script to do multiple connections with mssql server. To accomplish this I do mssql_connect(servername, username, pass, 1) in a loop which runs 50 times. But always after 25 iterations, my script fails to make a connection. I am doing this from APTANA IDE using the php5.3.3(CGI) plugin on my desktop.

 

Can someone please let me know what I am missing here?

 

Thanks,

Manish

Share this post


Link to post
Share on other sites

Thanks MrAdam for the reply!

 

Following is some logging information:

 

For 25 iterations:

 

I don't get any warnings and mssql_get_last_message() gives "Changed database context to 'master'"

 

After 25 iterations:

 

I start getting a warning i.e.  mssql_connect() [<a href='function.mssql-connect'>function.mssql-connect</a>]: Unable to connect to server:'server name'

 

and mssql_get_last_message() gives "Changed database context to 'database name'"

 

 

Thanks

 

 

Share this post


Link to post
Share on other sites

Is this a local or remote server? There may be a connection limit imposed. If you close the connection within the loop do you still get the same error, or are you already?

Share this post


Link to post
Share on other sites

This is a remote server. I am not closing the connection in same loop as the whole purpose of script was to have multiple connections open but I just tried it now and it doesn't throw that error. I am trying to get hold of someone from network team to check if there is any connection limit imposed on servers.

 

Thanks for the suggestion!

Share this post


Link to post
Share on other sites

It's quite likely they're just blocking >25 connections from a single user.

Share this post


Link to post
Share on other sites

I just heard from Network and they said there is no such limitation on server and the maximum concurrent users is set to 0 which means unlimited. Is there anything else you can think of? I just tried to connect to mysql as localhost and I was able to do more than 25 connections.

 

Thanks 

Share this post


Link to post
Share on other sites

×
×
  • 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.