473,803 Members | 4,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DB2 connection Pooling

Does COM.ibm.db2.jdb c.DB2DataSource , (which supports connection
pooling) need to be run within a J2EE container environment before the
connection pooling facility is actually available to a user?

Thanks John
Nov 12 '05 #1
5 12755
COM.ibm.db2.jdb c.DB2DataSource is an implementation of the Type 2
connection driver. This driver goes through the (UDB) client code
installed on the system where the application is running.

As far as I know, any connection pooler that sits between applications
and the CLI code should work.

Connection pooling is usually not considered to be "available to the
user". It's an interfacing layer for performance that lies outside the
application; which should have no access to it. The presence or absence
of connection pooling shouldn't make any difference to the application code.
Phil Sherman

John wrote:
Does COM.ibm.db2.jdb c.DB2DataSource , (which supports connection
pooling) need to be run within a J2EE container environment before the
connection pooling facility is actually available to a user?

Thanks John


Nov 12 '05 #2
aka
Hi John,

perhaps you want to try something like this:

COM.ibm.db2.jdb c.DB2Connection PoolDataSource ds = new
COM.ibm.db2.jdb c.DB2Connection PoolDataSource( );
ds.setDatabaseN ame(...);
ds.setUser(...) ;
ds.setPassword( ...);

javax.sql.Poole dConnection c = null;
c = ds.getPooledCon nection(...)

I dont't know which connection type this is, but I would think this is type
2...

Regards aka.
"John" wrote in message
news:e5******** *************** ***@posting.goo gle.com...
Does COM.ibm.db2.jdb c.DB2DataSource , (which supports connection
pooling) need to be run within a J2EE container environment before the
connection pooling facility is actually available to a user?

Thanks John

Nov 12 '05 #3
Phil,

The problem - I have 'working' JDBC code that makes use of data source
and pooling, called as follows (its happens to be as aka's post
described.) I use DB2 UDB 7 fix (pack 12). The problem is it takes
600msec to get a connection - I suspect pooling is not 'turned on'.
The crux is I'm running outside of a container - What am I doing
wrong? DB2Java.zip facilitates a developer creating your own pooling -
but I dont want to do that!

dsource = new COM.ibm.db2.jdb c.DB2DataSource ();
Context ctx = null;
Hashtable env = new Hashtable(5);
env.put ("java.naming.f actory.initial" ,
"COM.ibm.db2.jn di.DB2InitialCo ntextFactory");
ctx = new InitialContext( env);
ctx.bind(dataSo urceName, dsource);
ds = (DataSource) ctx.lookup(data SourceName);
conn = ds.getConnectio n(datasourceUse r, datasourcePassw ord);
Nov 12 '05 #4
aka

"John" wrote in message
news:e5******** *************** ***@posting.goo gle.com...
Phil,

The problem - I have 'working' JDBC code that makes use of data source
and pooling, called as follows (its happens to be as aka's post
described.) I use DB2 UDB 7 fix (pack 12). The problem is it takes
600msec to get a connection - I suspect pooling is not 'turned on'.
The crux is I'm running outside of a container - What am I doing
wrong? DB2Java.zip facilitates a developer creating your own pooling -
but I dont want to do that!

dsource = new COM.ibm.db2.jdb c.DB2DataSource ();
Context ctx = null;
Hashtable env = new Hashtable(5);
env.put ("java.naming.f actory.initial" ,
"COM.ibm.db2.jn di.DB2InitialCo ntextFactory");
ctx = new InitialContext( env);
ctx.bind(dataSo urceName, dsource);
ds = (DataSource) ctx.lookup(data SourceName);
conn = ds.getConnectio n(datasourceUse r, datasourcePassw ord);


if you say that the last line of your code takes 600ms on subsequent calls,
then this could be some problem (depending on your environment, machine,
network and so on), if you mean all of the above lines take 600ms that
should be a reasonable time, in particular if it is for your first
connection. one other thing that could speed things up is to set the userid
and password on the data source rather then doing authentication every time
when getting a connection from the pool (or context), if this is applicable
in your case. if you mean application server when speeking of j2ee
container, then the app server will most likely do the connection pooling
stuff, if you run your code outside then you have to do the work by
yourself...in the above example you create a new connection capable of
pooling every time you run it.
by only getting the connection i achieve typically about 31ms or even 0ms
(due to the bad granularity of timer updates about 1/17sec) on my Wintel box
with local db, but the first connection takes notably longer, espacially if
it is the first connection to the db at all.

maybe i didn't get your problem?

Regards aka.
Nov 12 '05 #5
Thanks for the response(s),

Its the last line that takes ages & I am running it outside of a J2EE
container. I get the impression that you believe it needs to run
within a container to get the benefit of pooling?

My problem is compounded in that I have to port it to Oracle. Since I
made use of DB2Java.zip '.jndi.DB2Initi alContextFactor y' and an
equivelent is not available withon Oracles classes12.zip. I will have
to resort to using JDBC and forget DataSources. Since I only need a
single connection per process - I'l hold it open passing it forward
for the next client user.

Thanks John
Nov 12 '05 #6

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

Similar topics

18
3253
by: Rob Nicholson | last post by:
We're getting an occasional occurrence of the following error when two users try and open the same record in our ASP.NET app: "There is already an open DataReader associated with this Connection which must be closed first." As suggested, I was closing the connection in the Finally part of the outer Try but I wasn't closing the data reader as well so I assume that if the following happens, the above error could occur
1
5731
by: Lenny Shprekher | last post by:
Hi, I am getting issues that Oracle collecting opened sessions (connections) from my webservice using regular System.Data.OleDb.OleDbConnection object. I am guessing that this is connection pooling issue. Is there is any way to disable connection pooling for one particular .net webservice? Thanks, Leonid
7
2210
by: Mrinal Kamboj | last post by:
Hi , I am using OracleConnection object from Oracle ODP.net provider and following is the behaviour which i am finding bit strange : To start with my argument is based on followings facts : 1. Connection object is a reference type object . 2. All reference types are passed by reference even when done without using modifier like ref / out .
3
10299
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database I use System.Data.Common.DBConnection and .DBCommand. How can I keep aware from connection losses (network not availeable, db-server not available...)? Are there any strategies to detect this broken connections, and how can I
2
2350
by: JimLad | last post by:
Hi, In an existing ASP/ASP.NET 1.1 app running on IIS 6, I need to RELIABLY pass the logged in username through to the SQL Server 2000 database for auditing purposes. The current method is hideously unreliable. The app includes updategrams, XML Templates and ADO connections. I don't want to use impersonation because of the direct db access that allows.
16
2877
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with a worker thread that would execute the db commands. The pool was fixed and all the connections were created when the db access class was instantiated. The connections remained opened during the whole execution. If a connection was not available...
20
3304
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how many connection has been used ? 2. If the maximum pool size has been reached, what happens when I call the method Open to open the connection ? Will I get an error ? MSDN says the request is queued, but will I get an error in the open method ? ...
3
4895
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable g_sConnectionString and leave this connection open and not close it until it exits the application. Then on each thread/each subsequent sub that needs the connection I create a local OleDBConnection variable, open the connection using the exact...
0
6626
viswarajan
by: viswarajan | last post by:
Introduction This article is to go in deep in dome key features in the ADO.NET 2 which was shipped with VS 2005. In this article I will go trough one of the key features which is the Connection Pooling. This feature is a key feature plays an important role in the performance in most of business application or Data driven application. What's Connection Pooling?
15
3291
by: Sylvie | last post by:
I have a static function in a class, everytime I call this function, I am creating a SQLconnection, open it, use it, and null it, All my functions and application logic is like this, Every connection is creating self connection object and null it after the some process, Is this wrong ? One of my friend told me about "Connection Pooling", and I am confused
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10548
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
10069
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
9125
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
7604
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
5500
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
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.