473,651 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excessive socket usage using MS-SQL server via ADO COMobject


Hi,

I've an database import script written in PHP which used ADO via COM.
It makes thousands of queries to a MS-SQL server. The problem is that
the process runs out of sockets.
The MSSQL server is used in the following way:

// In the beginning of the script, the connection is set up
$dbc=new COM("ADODB.Conn ection");
$dbc->ConnectionStri ng="Provider=sq loledb;Network
Library=DBMSSOC N;Data Source=FOO;Data base=BAR;User ID=FOO;Password =BAR";
$dbc->Open();

// Typical query
$rs=$dbc->execute("SELEC T ... FROM ...");
// process the result set here

// Close and free the resultset object:
$rs->Close();
unset($rs);

The script executes many queries in rapid succession. When I inspect
the output of 'netstat -an' during execution, I see thousands of open
sockets:

...
TCP 192.168.1.210:3 960 192.168.1.13:14 33 TIME_WAIT
TCP 192.168.1.210:3 961 192.168.1.13:14 33 TIME_WAIT
TCP 192.168.1.210:3 964 192.168.1.13:14 33 TIME_WAIT
....

Sometimes the script even dies with a COM exception error, that it can't
make a connection to the MSSQL server anymore. This happens when +/-
4000 sockets are in the TIME_WAIT state. After two minutes these
sockets are automatically closed by Windows and MSSQL connections are
possible again.

Is this a known problem? I couldn't find it in Google.

is there a way to make ADO (or PHP) reuse the existing socket, instead
of opening a new one for each Execute?

Greetings,

Nov 25 '05 #1
2 3064
I am not sure how helpful this will be (probably not very) but if you
are using the ADOdb Library for PHP try $dbc->PConnect() instead of
$dbc->Open(). This should open a persistent connection instead of a new
connection each time.

Nov 25 '05 #2
"Sean" <or**********@g mail.com> wrote:
I am not sure how helpful this will be (probably not very) but if you
are using the ADOdb Library for PHP try $dbc->PConnect() instead of
$dbc->Open(). This should open a persistent connection instead of a new
connection each time.


I am not using the ADOdb library, but thanks for the tip anyway: I will
look into the source code of ADOdb to see how PConnect() is implemented.
Maybe that will give some insight.

What do they mean by 'persistent connection'? That the connection is
kept alive between script invocations? Or that multiple queries done
from the same script invocation reuse the existing MSSQL socket?

Greetings,
Nov 25 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
10929
by: Richard | last post by:
Level: Java newbie, C experienced Platform: Linux and Win32, Intel Another programmer and I are working on a small project together. He's writing a server process in Java that accepts input from processes I've written over a TCP connection. My processes are all written in C; his are all done in Java. He's new to Java, and I've never really used it. My input is basically a stream of 32-bit unsigned integers (e.g., the
1
9429
by: Bob | last post by:
I am trying to reuse a socket address but I am having problems. What I am doing is creating a socket, connecting, then getting the LocalEnd point. I then Disconnect and try to connect again using the same address but I get an error 10048 . Can someone tell me what I am doing wrong. Here is the code... ws_socket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); //Set the reuse address flag....
3
4287
by: BuddyWork | last post by:
Hello, Could someone please explain why the Socket.Send is slow to send to the same process it sending from. Eg. Process1 calls Socket.Send which sends to the same IP address and port, the receiver is running within Process1. If I move the receiver into Process2 then its fast. Please can someone explain.
0
3156
by: Buddy Home | last post by:
There is two examples of code. Example 1. Send and Receive within the same process. Put this code in a console app called SendAndReceive and run the code. using System; using System.Collections.Generic; using System.Net; using System.Net.Sockets; using System.Runtime.Serialization.Formatters.Binary;
11
8593
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling mechanisms. I use a non-blocking approach for this, using the call to 'poll' to support the async mechanism - rather than the 'begin' and 'end' functions. I already found that connecting doesn't set the "isconnected" variable correctly...
0
3115
by: jkhan | last post by:
Hi! I have problem which I shown in title and below as well. I have a Form name as Cancelation. The clientThread2() method is called on Form Load if I Close the Form and want to reload then the above error is generated as I tried to close, shutdown etc for closing the socket or thread but useless. Any one have idea about it. The above error is generated when it reached to this line ==> sender = new IPEndPoint(IPAddress.Any, 0); as I...
1
2698
by: ssherm01 | last post by:
I'm using MS VS C++ .NET. I've written a multicast test utility that can send IGMP packets for a user specified group address. As well, it can send and receive UDP packets for a specified multicast group. I'm using the Sockets Class methods for sending and receiving packets. One area I'm having problems with is recieving IGMP packets on the Raw IP socket. Here is the main calls I am using to receive IGMP packets. s = new...
16
3843
by: =?iso-8859-1?q?|-|e|=5F|=5F_B0=DD?= | last post by:
hi all! I got a problem. I declared a SOCKET var in my C program but when i compiled the program it displayed like *--------------------------------------------------------------* *'SOCKET': illegal use of this type as an expression * * C:\..\..\..\include\winsock2.h: see declaration of 'SOCKET' * *--------------------------------------------------------------* What i wrote in my program is like this..:
4
2298
by: kimiraikkonen | last post by:
Hi, On my system which is 2.4GHZ P4 CPU, 1GB memory + 64MB DDR graphic card, if i create a simple picturebox docked on a form sized about 500x350 or less or more, doesn't matter, and also if i place a normal sized picture on the control, while dragging the form having with picturebox + image, it costs about %90-%100 CPU while dragging form around the screen. And screen is shown as very noticeably sluttering and distorted etc. Note that i...
0
2106
by: jcarneiro | last post by:
Hi, Can someone provide comparison for using socket prgramming vs web services. I'm particularly interested on bandwidth/traffic usage such as the overhead required by webservices and battery usage for several connection/disconnection required by webservice vs maintaining connection with socket. Thanks Joao
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8576
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.