commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garey Mills <gmi...@berkeley.edu>
Subject Re: Problem with commons-dbcp jocl file
Date Thu, 15 Mar 2007 22:19:21 GMT
Hello - I solved the problem I originally posted by adding the entity 
'&amp;' to the jdbc URL.
Now I am back to square one. DriverManager is reporting 'no suitable 
driver'. I have this in my code


            Class.forName("org.apache.commons.dbcp.PoolingDriver");
            Connection c = 
DriverManager.getConnection("jdbc:apache:commons:dbcp:/dbconn");
            Statement s = c.createStatement();

and this 'dbconn.jocl' file in my WEB-INF/classes directory


<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:mysql://localhost:3366/simpledb?user=simplemgr&amp;assword=blovi8"/>
      <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.impl.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 suggestions?

Garey Mills






Garey Mills wrote:
> Hello - Following the instructions the javadocs for
>
>
>    Package org.apache.commons.dbcp
>
>
> I created the following jocl file and put it in my WEB-INF/classes 
> directory
>
>
> <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:mysql://localhost:<my port>/<mydb>?user=<my

> user>&password=<my password"/>
>      <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>
>
> Where <my port>, <my db>, <my user> and <my password> have the
correct 
> values.
>
> When I try to get a connection, I get the following error:
>
> [Fatal Error] :4:82: The reference to entity "password" must end with 
> the ';' delimiter.
> SQL Exception caught: org.apache.commons.dbcp.SQLNestedException: 
> Could not parse configuration file
>
>
> Has anyone seen this before? Any suggestions?
>
> All help appreciated;
>
> Garey Mills
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message