Its looking good - just what I wanted.
Thanks.

The one issue I have now is trying to decipher a failure I have when I
have 2 different concurrent Datasources in the JVM.

I build and register an Oracle and a DB2 DataSource as you have
documented, though using SharedPoolDataSource rather than
PerUserPoolDataSource in both cases.

InstanceKeyObjectFactory.getObjectInstance() can do an
instanceMap.put(key, ds);
under some circumstances where key = eg: "jdbc/oDS"

InstanceKeyObjectFactory.registerNewInstance()is also doing
instanceMap.put(instanceKey, ds);
where key = eg: "1" (asserted from int max)

However there is code in InstanceKeyObjectFactory.registerNewInstance()
to determine
a new instanceKey and it expects every key in instanceMap to be numeric:

        while (i.hasNext()) {
            Object obj = i.next();
            if (obj instanceof String) 
            {
                max = Math.max(max, Integer.parseInt((String)obj));
            }
        }

Since there are keys like "jdbc/oDS" in the collection in additon to
keys like "1"
a NumberFormatException occurs when the second DataSource is first
accessed.

No doubt this is a usage or setup problem but I haven't figured it out
yet.
I do know that it works fine if I trap and ignore the
NumberFormatException.
It also works fine if only one DataSource is registered since from the
2nd time on
the lookup on the key (eg jdbc/oDS) works so there are no further
registrations required (registerNewInstance())

Any illumination would be helpful.

Thanks for all the help.

------------
Creighton Malet
SBC Services, Inc.
(925)823-1463
[EMAIL PROTECTED]


-----Original Message-----
From: Dirk Verbeeck [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 16, 2004 12:32 PM
To: Jakarta Commons Users List
Subject: Re: [DBCP] Example of SharedPooledDataSource with JNDI


OK, I have been looking how tomcat & naming are using DBCP with JNDI.

I have made a page with 2 example:
http://jakarta.apache.org/commons/dbcp/guide/jndi-howto.html

Let me know if this works for you.
Improvements are also welcome ;-)

Cheers
Dirk

MALET, CREIGHTON C (SBCSI) wrote:
> No, I'm not trying to cross VMs. Sorry, terminology, I'm using server
to
> mean container, and client to mean application; but its all in the
same
> VM.
> Its precisely that container like behavior I'm looking for - create
and
> bind the pool into JNDI at startup and the application does a JNDI
> lookup for the Datasource from which it gets the connection.
> 
> Thanks
> 
> ------------
> Creighton Malet
> SBC Services, Inc.
> (925)823-1463
> [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to