As described in the comment at the top of the ManualPoolingDriverExample.java file, you need to register your "native" JDBC driver (in your case, oracle) with the DriverManager via the Java command line.
// Invoke the class using two arguments: // * the connect string for your underlying JDBC driver // * the query you'd like to execute // You'll also want to ensure your underlying JDBC driver // is registered. You can use the "jdbc.drivers" // property to do this. // // For example: // java -Djdbc.drivers=oracle.jdbc.driver.OracleDriver \ // -classpath commons-collections.jar:commons-pool.jar:commons-dbcp.jar:oracle-jdbc.jar:. \ // ManualPoolingDriverExample // "jdbc:oracle:thin:scott/tiger@myhost:1521:mysid" // "SELECT * FROM DUAL" // <http://jakarta.apache.org/commons/dbcp/commons-dbcp-1.0/docs/ManualPoolingDriverExample.java> In other words, add: -Djdbc.drivers=oracle.jdbc.driver.OracleDriver to your java command line. On Wed, 22 Jan 2003, Amar Das wrote: > Hi, > I compiled ManualPoolingDriverExample.java. Before compiling, I put > commons-dbcp.jar, commons-pool.jar and commons-collections.jar under > \lib\ext directory of JDK (1.4). I also renamed class12.zip ( oracle jdbc > driver) to oracle-jdbc.jar. The code compiles fine. But when I try to run > it using the following command it fails to create a database connection. > Please help. > Thank you, > -- amar > > C:\java\classes>java ManualPoolingDriverExample > "jdbc:oracle:thin:smms/password@myserver:1521:smms" " > SELECT * FROM DUAL" > Setting up driver. > Done. > Creating connection. > Exception in thread "main" org.apache.commons.dbcp.DbcpException: > java.sql.SQLException: No suitable driver > at > >org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFa > ctory.java:101) > at > >org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:184) > at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source) > at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:146) > at java.sql.DriverManager.getConnection(DriverManager.java:517) > at java.sql.DriverManager.getConnection(DriverManager.java:199) > at ManualPoolingDriverExample.main(ManualPoolingDriverExample.java:153) > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
