Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Sharing database handle

by Zapawork (Beadle)
on Apr 18, 2002 at 19:58 UTC ( #160327=note: print w/replies, xml ) Need Help??

in reply to Sharing database handle

Here is another idea,
You are already spawning child processes so why not set up either a bidirectional pipe or a seperate IPC to allow the child to send requests to the parent. In this fashion the parent could have one main routine to poll the child processes for queries, test the connect (dbi->ping, dbi is just a great package) and then execute and return the information to the child.

In this model you would seem to accomplish your goal, you wuold allow all of your child processes to communicate through one ODBC connection, you'd have only one ODBC connection and for fun you'd have one place to check for improper data within queries.
Dave -- Saving the world one node at a time

Replies are listed 'Best First'.
Re: Re: Sharing database handle
by graff (Chancellor) on Apr 20, 2002 at 01:02 UTC
    This is a nifty thought, but I'd worry that it would make the parent/server a bit monstrous and hard to get right. I guess if each child request is read, executed and answered back to the child in one block, it's certainly manageable.

    There still is the empirical question: is it better to serialize all activity through a single, very active connection, as opposed to having a bunch of connections (leaving it to the DBMS to coordinate the actions, which is, in part, what it was written to do)? I don't really know that yet (sorry).

      Sorry about the late response,
      Proof to the pudding, so to speak, for this type of practive goes back to the ODBC models that all of your modern day websties use.
      Having one central connection allows you to control access while guaranting preformance. If you need data in a large scale form, you usually implement application servers to cache and give performance enhancements.
      Hope this helps
      Dave -- Saving the world one node at a time

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://160327]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-06-23 06:42 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.