Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ConnectionPool

0 views
Skip to first unread message

Felix Nielsen

unread,
Oct 19, 2001, 5:50:31 PM10/19/01
to
Hi

Is there anyone "out there" having success implementing the Merant
"PooledConnectionDataSource" object using the "SQLServerDataSource" object?

I am using the Orion JSP server, and it works just fine when I create a
connection with "SQLServerDataSource", but when I try and use Merants Pool
object it fails.

Thanks
Felix

My code:

Hashtable env = new Hashtable();
Context ctx = new InitialContext(env);

SQLServerDataSource ds1 = new SQLServerDataSource();
ds1.setDescription("SQLServerDataSource1");
ds1.setServerName("myserver");
ds1.setPortNumber(1433);
ds1.setDatabaseName("mydatabase");
ds1.setSelectMethod("cursor");
ctx.rebind("jdbc/mssql-myserver", ds1);

PooledConnectionDataSource ds2 = new PooledConnectionDataSource();

ds2.setDescription("SQLServerDataSource2");
ds2.setDataSourceName("jdbc/mssql-myserver");
ds2.setCheckEvery(20000L);
ds2.setUnusedAfter(30000L);
ds2.setTracing(false);
ctx.rebind("jdbc/mssql-myserver-pool",ds2);

DataSource ds = (DataSource)ctx.lookup("jdbc/mssql-myserver");

//This works:
Connection con = ds.getConnection("user","password");

DataSource ds = (DataSource)ctx.lookup("jdbc/mssql-myserver-pool");

//This don't works:
Connection con = ds.getConnection("user","password");

Error:
java.lang.NullPointerException
at java.util.Hashtable.get(Unknown Source)
at com.merant.pool.PooledConnectionDataSource.getConnection(Unknown Source)


Gleb U.

unread,
Oct 22, 2001, 12:22:43 AM10/22/01
to
Hi Felix,

Are you using Merant's DataDirect driver or the new SQL Server 2000 driver
from Microsoft? The latter has a bug in the BaseDataSourceFactory class.
The factory always returns null so you would never get a connection using
the data source method. So, transitively, the pool would not work.

If all works on the data source level, it looks like you need to externally
call setJNDIName() before making an attempt to obtain pooled connections.

Gleb

"Felix Nielsen" <fe...@stejle.dk> wrote in message
news:#Yj0dgOWBHA.1168@tkmsftngp07...

> file://This works:


> Connection con = ds.getConnection("user","password");
>
> DataSource ds = (DataSource)ctx.lookup("jdbc/mssql-myserver-pool");
>

> file://This don't works:

Felix Nielsen

unread,
Oct 22, 2001, 2:23:07 PM10/22/01
to
Hi Gleb,

I am using the new SQL Driver from Microsoft, I am getting a connection
using the Datasource method and it works as a charm with JDNI. I have then
download the Pool object made my Merant and that's my problem, it just fails
:(

But maybe I am doing something wrong when I try to use the Pool object, it
should though work with 3rd party Datasources, and my hope was that because
the Microsoft Driver is actually a Merant drive, it would work like a charm.

But no LUCK :(

Thanks
Felix

"Gleb U." <g...@home.com> wrote in message
news:umV#wGrWBHA.1380@tkmsftngp03...

0 new messages