The moose likes JDBC and the fly likes Has anyone used the JAKARTA DBCP with JOCL? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Has anyone used the JAKARTA DBCP with JOCL?" Watch "Has anyone used the JAKARTA DBCP with JOCL?" New topic
Author

Has anyone used the JAKARTA DBCP with JOCL?

Sumit Gupta
Greenhorn

Joined: Jan 23, 2002
Posts: 4
If anyone has, I'd like to hear how you implemented the username and password for the DB.
the sample JOCL that they provide only the connect string. Can i append user and pass to that somehow? here is the sample jocl xml:
<object class="org.apache.commons.dbcp.PoolableConnectionFactory" xmlns="http://apache.org/xml/xmlns/jakarta/commons/jocl">
<!-- the first argument is the ConnectionFactory -->
<object class="org.apache.commons.dbcp.DriverManagerConnectionFactory">
<string value="jdbc:some:connect:string"/>
<object class="java.util.Properties" null="true"/>
</object>
<!-- the next argument is the ObjectPool -->
<object class="org.apache.commons.pool.impl.GenericObjectPool">
<object class="org.apache.commons.pool.PoolableObjectFactory" null="true"/>
<int value="10"/> <!-- max active -->
<byte value="1"/> <!-- when exhausted action, 0 = fail, 1 = block, 2 = grow -->
<long value="2000"/> <!-- max wait -->
<int value="10"/> <!-- max idle -->
<boolean value="false"/> <!-- test on borrow -->
<boolean value="false"/> <!-- test on return -->
<long value="10000"/> <!-- time between eviction runs -->
<int value="5"/> <!-- number of connections to test per eviction run -->
<long value="5000"/> <!-- min evictable idle time -->
<boolean value="true"/> <!-- test while idle -->
</object>
<!-- the next argument is the KeyedObjectPoolFactory -->
<object class="org.apache.commons.pool.StackKeyedObjectPoolFactory">
<int value="5"/> <!-- max idle -->
</object>
<string value="SELECT COUNT(*) FROM DUAL"/> <;!-- validation query -->
<boolean value="false"/> <!-- default read only -->
<boolean value="true"/> <!-- default auto commit -->
</object>
any help would be appreciated. here is a URL to the api if anyone is interested:
http://jakarta.apache.org/commons/dbcp/api/index.html
DBCP API
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401

Put your db connection url there.

Try out the commons list. sign up at jakarta.apacha.org.

Sample:

See? Use a query string: ?user=root&amp;password=my_pw
Since it's xml, you have to escape the & to &amp;
[ October 25, 2002: Message edited by: Garrett Smith ]

comp.lang.javascript FAQ: http://jibbering.com/faq/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Has anyone used the JAKARTA DBCP with JOCL?