tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Kilbride" <j...@kilbride.com>
Subject Re: How to make DbConnectionBroker from javaexchange.com to work with Mysql?
Date Tue, 17 Apr 2001 04:33:06 GMT
There's very good documentation and examples at javaexchange.com, but here's
a quickie overview:

-------------------------------
import com.javaexchange.dbConnectionBroker.*;

DbConnectionBroker _broker;
String dbDriver="org.gjt.mm.mysql.Driver";
String dbServer="jdbc:mysql://localhost:3306";
String dbLogin="your_login";
String dbPassword="your_password";
int minConns=2;
int maxConns=20;
String logFile="path/to/your/log/file";
double recycleTime=5.0;

_broker = new DbConnectionBroker(dbDriver,
                                                         dbServer,
                                                         dbLogin,
                                                         dbPassword,
                                                         minConns,
                                                         maxConns,
                                                         logFile,
                                                         recycleTime);

Connection conn = _broker.getConnection();

// Normal use of connection here....

_broker.freeConnection(conn);
-------------------------------

I'm assuming you're using the mm.mysql driver and connecting to localhost.
If not, you need to change the dbDriver and dbServer strings. At
javaexchange.com, there are examples for implementing a Singleton pattern
and using inheritance to make it easier to use the connection broker in your
code. I suggest you go through the docs. You can even view them online:

http://www.javaexchange.com/

Thanks,
--jeff

----- Original Message -----
From: "Jason" <jasonyam@asiacontent.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Monday, April 16, 2001 7:51 PM
Subject: How to make DbConnectionBroker from javaexchange.com to work with
Mysql?


> Hi everyone,
>
>     anyone knows how to use DbConnectionBroker from javaexchange.com to
> connect to MYSQL instead of to Oracle?  My application is using Mysql
> and it runs fine.  Now I want to use connection pooling to improve the
> performance before deployment.  However, I cannot make
> DbConnectionBroker and Mysql work together.  Any idea?
>
> Thanx!
>
> Jason
>


Mime
View raw message