Hi,
I don't know if this method is well but I use it :

ClassDescriptor classD = broker.getClassDescriptor(DualBO.class);
JdbcConnectionDescriptor jcd = classD.getConnectionDescriptor();
//Creation of the connection
java.sql.Connection connection = null;
try {
        //Initialisation of the JDBC driver
        Class.forName(jcd.getDriver());

        //connection to the database
        String url = jcd.getProtocol() + ":" + jcd.getSubProtocol() + ":" +
jcd.getDbAlias();
        connection = java.sql.DriverManager.getConnection(url, jcd.getUserName(),
jcd.getPassWord());
} catch (ClassNotFoundException e) {
        log.error("the driver was not found : ", e);
        throw new DatabaseException(e);
} catch (java.sql.SQLException e) {
        log.error("No connection to the database : ", e);
        throw new DatabaseException(e);
}

The only class who was not used here is DualBO.class, it is the table Dual
(I think you can replace by an other table)
I have already a connection to the database via broker to (that's him which
make the link for get the connection).

Hope it can help.

-----Message d'origine-----
De : Christopher Tava [mailto:[EMAIL PROTECTED]
Envoye : mardi 27 janvier 2004 17:24
A : [EMAIL PROTECTED]
Objet : properly way to lookup a java.sql.Connection from the connection
pool


dear ojb user group,

could you kindly tell me the properly way to look a connection from the
connection pool?

i have used the following call, but i get a socked closed exception.

Connection conn =

pBroker.serviceConnectionManager().getConnection();

2004-01-27 10:45:46,609 [RMI TCP Connection(126)-162.86.116.94] ERROR
[com.server.TBean] java.sql.SQLException: Io exception: Socket closed



your assistance is much appreciated,

chris






---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!


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

Reply via email to