manishtyagi83 Posted December 10, 2010 Share Posted December 10, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/221261-multiple-connections-using-mssql_connect/ Share on other sites More sharing options...
Adam Posted December 12, 2010 Share Posted December 12, 2010 Have you checked the error message with mssql_get_last_message? Quote Link to comment https://forums.phpfreaks.com/topic/221261-multiple-connections-using-mssql_connect/#findComment-1146392 Share on other sites More sharing options...
manishtyagi83 Posted December 13, 2010 Author Share Posted December 13, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/221261-multiple-connections-using-mssql_connect/#findComment-1146677 Share on other sites More sharing options...
Adam Posted December 13, 2010 Share Posted December 13, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/221261-multiple-connections-using-mssql_connect/#findComment-1146683 Share on other sites More sharing options...
manishtyagi83 Posted December 13, 2010 Author Share Posted December 13, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/221261-multiple-connections-using-mssql_connect/#findComment-1146687 Share on other sites More sharing options...
Adam Posted December 13, 2010 Share Posted December 13, 2010 It's quite likely they're just blocking >25 connections from a single user. Quote Link to comment https://forums.phpfreaks.com/topic/221261-multiple-connections-using-mssql_connect/#findComment-1146690 Share on other sites More sharing options...
manishtyagi83 Posted December 13, 2010 Author Share Posted December 13, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/221261-multiple-connections-using-mssql_connect/#findComment-1146809 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.