1 Replies - 797 Views - Last Post: 04 January 2008 - 10:14 AM Rate Topic: -----

#1 cododonnell   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 02-January 08

auto updating databasing

Post icon  Posted 03 January 2008 - 05:59 AM

Hi, I have a quick question about auto-updating databases and connection pooling. I was just wondering what these were and is it possible to do them in PHP and JSP??

Thanks a million
Is This A Good Question/Topic? 0
  • +

Replies To: auto updating databasing

#2 Martyr2   User is online

  • Programming Theoretician
  • member icon

Reputation: 5226
  • View blog
  • Posts: 14,006
  • Joined: 18-April 07

Re: auto updating databasing

Posted 04 January 2008 - 10:14 AM

Auto-updating a database is a loose term and could mean a few things. However one item that comes to mind is a known as "triggers". These are code statements usually written in something like T-SQL (transaction SQL) where if a table or database is modified, it "triggers" an event which then the code is run. It is like an event in event driven programming.

For instance, if you setup a trigger to run a delete on users when the last item of their order is removed, you would create a trigger on the event "delete" of the orders table which runs T-SQL to check how many items are left in the order. If the item was the last and now there are no more items, you would automatically delete the user from the users table.

This is one form of auto-updating. Triggers are heavily used in databases such as Oracle and MS SQL Server. You can find much more about these on the net by searching for things like "oracle triggers" or "MS SQL server triggers"

Connection pooling is the process of assigning/managing resources (in this case connections) for applications. The best way to think of this is that you have a limited number of connections... lets say 5. When an application needs to connect, either the OS or Database in charge of managing that connection assigns your application one of the connections, leaving 4 in the pool. When your application is done with it, you free it back to the pool.

So what good is this? Well, as a developer or networker, you can assign how large that pool can be and control the resources. You can do things like assign higher priority to certain applications and deny others from using the pool.

Another great thing about connection pooling is that it can assign a connection to an application and lets say that application crashes, when it starts up again they can be reassigned their original connection instead of leaving one connection unassigned but unavailable and take a fresh one from the pool. This builds in a sort of integrity and stability that was before a problem with not having a pool.

As a software developer you are most concerned with taking a connection from the pool only when needed, use it quickly, and immediately return it to the pool. If you sit on a connection (leave it open and thus used) it is not in the pool for other applications to use. If your application does this too often it may eat up the entire pool and no other applications can get a connection resource. So that is why it is important to always return your resources.

You can have other pools besides connection pooling. You can have pools for printers, other computers on the network, hard drives, servers, etc. Anything that may be a limited resource and has to be shared among several types of computers.

I hope you understand. :)

"At DIC we be pooling...skyhawk is on an air mattress, Psycho the innertube, amadeus the diving board and me, I am the bar tender at the pool bar that looks like the guy from the love boat... except not black." :snap:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1