Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / August 2004

Tip: Looking for answers? Try searching our database.

Question understanding Connection/Statement

Thread view: 
Saad Malik - 20 Aug 2004 08:04 GMT
Hi There,
Just had a quick question. Assume that we made a singleton class which
would return the reference to an already existing Connection (made
using DriverManager.. no connection pooling).

I would assume, that calling createStatements in a server/client
application would fail because a connection encapsulates the database
server and client information (IP ADDRESSES). So multiple clients with
different ip addresses would not be able to use someone's else
connection object... is this right?

Now, what if in a multi-threaded environment there is only one client
and one server... There is stil only one connection object (created by
the client). Calling createStatement should work everytime, right? Now
what about cuncurrency issues... if two statements are created then
they execute excuteUpdate() at the same time, will the connection
object simultaneously execute the queries, or will it queue them up?

Thanks..
Fredrik Bertilsson - 20 Aug 2004 16:40 GMT
A java.sql.Connection object is only valid and useful on one machine
(client or server). It is not Serializable. Each client need to have
their own connection object. But if the connection object are pooled
on the server side, the pool have to be thread-safe. It can be very
confusing results, if two threads are using the same connection object
concurrent.

/Fredrik


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.