473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Holding Static data links?


Hello!

I have designed a website with a servlet that holds on to a database
connection statically so as not to have to re-establish the data connection
with every single page request. (and it detects if the link went down, of
course). This connection has a bunch of prepared statements on it to make
things easier.

Now, the question is: Am I begging for trouble by doing this? What
happens if two page requests come in extremely close together? Is there a
guarantee that the servlet will only process one page at a time? Could it
be that two page requests will come in and cause the database connections
to step on each other?

Thanks!

mark.

--
-- I am not an ANGRY man. Take the rage out of my e-mail address to reply
please.
Jul 17 '05 #1
1 1327
Mark,

Servlets are multi-threaded -- if you're saying that each instance of your
servlet gets its own database connection (preferrably from a connection
pool), then you should be okay. On the other hand, if you have a database
connection that is a singleton object that you're sharing between servlet
threads, i believe you may be asking for trouble.

I'd recommend utilizing third party connection pooling software, as it will
take care of 'dead' connections, keeping a min/max # of connections open,
etc. For decent open-source connection pooling software, check out
http://proxool.sourceforge.net/.

Steve David

Mark <ne**@ANGRYlanfear.com> wrote in message news:<R7v2c.130526$4o.169281@attbi_s52>...
Hello!

I have designed a website with a servlet that holds on to a database
connection statically so as not to have to re-establish the data connection
with every single page request. (and it detects if the link went down, of
course). This connection has a bunch of prepared statements on it to make
things easier.

Now, the question is: Am I begging for trouble by doing this? What
happens if two page requests come in extremely close together? Is there a
guarantee that the servlet will only process one page at a time? Could it
be that two page requests will come in and cause the database connections
to step on each other?

Thanks!

mark.

Jul 17 '05 #2

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

Similar topics

2
by: wkaras | last post by:
Section 9.4.2 paragraph 4 of the draft Standard says: If a static data member is of const integral or const enumeration type, its declaration in the class definition can specify a constant-...
27
by: Daniel Vallstrom | last post by:
I'm having problems with inconsistent floating point behavior resulting in e.g. assert( x > 0.0 && putchar('\n') && x == 0.0 ); holding. (Actually, my problem is the dual one where I get...
4
by: MPF | last post by:
When designing a n-tier architecture, what is the preferred method/function accessibility? <Specifically for asp.net apps> A private constructor and shared/static methods & functions? A public...
3
by: Adam | last post by:
I can't seem to find one spot on the net that specifies exactly what I need to do. Situation: Native dll needs to hold a static reference to a managed class in .net 2.0 (whidbey) which needs to...
3
by: Faisal | last post by:
Hi. I'm in the process of moving an application from ASP to ASP.NET, & I'm writing in VB, using VS.NET. I'm new to the .NET framework & have a basic question regarding static objects defined in...
3
by: Joel Barsotti | last post by:
What I mean here is that I have to build an HTML interface for a CD catalouge. All the contents for this catalouge are in a DB right now for the current ..net website. Since the CD catalouge...
4
by: Nalaka | last post by:
Hi, I have some request specific data that gets created in a "early event", that I need to pass around to many other events. I need access to this data during that request. (and more importantly...
2
by: davidjgonzalez | last post by:
I have an ASP .NET web application written in VS 2003. The web application's UI (aspx.cs files) call static WebService accessor methods. Example.aspx MyWebserviceAccessor.CallWebService("foo");...
0
by: Alex Brown | last post by:
Is it a problem to attach Non-static site map providers under one that inherits from StaticSiteMapProvider ? We are implementing a custom site map provider for a website that is being converted...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.