commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: jakarta-commons/dbcp/doc ManualPoolingDataSourceExample.java ManualPoolingDriverExample.java README.txt
Date Mon, 11 Aug 2003 14:37:12 GMT
dirkv       2003/08/11 07:37:12

  Modified:    dbcp/doc ManualPoolingDataSourceExample.java
                        ManualPoolingDriverExample.java README.txt
  Log:
  Bugzilla Bug 21418
    Example code
  
  Added Class.forName to the examples as suggested by David Badia
  
  Revision  Changes    Path
  1.2       +12 -3     jakarta-commons/dbcp/doc/ManualPoolingDataSourceExample.java
  
  Index: ManualPoolingDataSourceExample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/doc/ManualPoolingDataSourceExample.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ManualPoolingDataSourceExample.java	14 Apr 2001 17:16:45 -0000	1.1
  +++ ManualPoolingDataSourceExample.java	11 Aug 2003 14:37:12 -0000	1.2
  @@ -126,7 +126,16 @@
   
       public static void main(String[] args) {
           //
  -        // First, we set up the PoolingDataSource.
  +        // First we load the underlying JDBC driver.
  +        // You need this if you don't use the jdbc.drivers
  +        // system property.
  +        //
  +        System.out.println("Loading underlying JDBC driver.");
  +        Class.forName("oracle.jdbc.driver.OracleDriver");
  +        System.out.println("Done.");
  +
  +        //
  +        // Then, we set up the PoolingDataSource.
           // Normally this would be handled auto-magically by
           // an external configuration, but in this example we'll
           // do it manually.
  
  
  
  1.2       +12 -3     jakarta-commons/dbcp/doc/ManualPoolingDriverExample.java
  
  Index: ManualPoolingDriverExample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/doc/ManualPoolingDriverExample.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ManualPoolingDriverExample.java	14 Apr 2001 17:16:55 -0000	1.1
  +++ ManualPoolingDriverExample.java	11 Aug 2003 14:37:12 -0000	1.2
  @@ -117,7 +117,16 @@
   
       public static void main(String[] args) {
           //
  -        // First, we set up and register the PoolingDriver.
  +        // First we load the underlying JDBC driver.
  +        // You need this if you don't use the jdbc.drivers
  +        // system property.
  +        //
  +        System.out.println("Loading underlying JDBC driver.");
  +        Class.forName("oracle.jdbc.driver.OracleDriver");
  +        System.out.println("Done.");
  +
  +        //
  +        // Then we set up and register the PoolingDriver.
           // Normally this would be handled auto-magically by
           // an external configuration, but in this example we'll
           // do it manually.
  
  
  
  1.2       +20 -0     jakarta-commons/dbcp/doc/README.txt
  
  Index: README.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/doc/README.txt,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- README.txt	14 Apr 2001 17:16:52 -0000	1.1
  +++ README.txt	11 Aug 2003 14:37:12 -0000	1.2
  @@ -1,3 +1,23 @@
  +===================================================================================
  +
  +Before running these examples make sure you have registered the database
  +driver you want to use. If you don't you will get the following error:
  +"org.apache.commons.dbcp.DbcpException: java.sql.SQLException: No suitable driver"
  +
  +The DriverManager class will attempt to load the driver classes referenced 
  +in the "jdbc.drivers" system property. For example you might specify
  +
  +-Djdbc.drivers=foo.bah.Driver:wombat.sql.Driver:bad.taste.ourDriver
  +
  +as command line argument to the java VM.
  +
  +A program can also explicitly load JDBC drivers at any time. For
  +example, the my.sql.Driver is loaded with the following statement:
  +
  + Class.forName("my.sql.Driver");
  +
  +===================================================================================
  +
   ManualPoolingDriverExample.java
   
    Provides a simple example of how to use the DBCP package with a
  
  
  

Mime
View raw message