I'm making fairly simply use of the BasicDataSource, something like ...

BasicDataSource ds1 = new BasicDataSource();
ds1.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
ds1.setUrl("jdbc:sqlserver://host\\INST01;databaseName=db1");   

and everything works just fine.

Until, that is, I try to access another database on the same server.
If I have another datasource ...

BasicDataSource ds2 = new BasicDataSource();
ds2.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
ds2.setUrl("jdbc:sqlserver://host\\INST01;databaseName=db2");   

Then both ds1.getConnection() and ds2.getConnection() will return a
connection to the same database db1 - unless I call
ds2.getConnection() first, and they both return a connection to db2.

Have I missed something in the usage of a BasicDataSource? Or is
something more untoward going on here?

Thanks,

Greg

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to