jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r632341 - in /jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle: BundleDbPersistenceManager.java util/ConnectionFactory.java util/ConnectionRecoveryManager.java
Date Fri, 29 Feb 2008 15:14:58 GMT
Author: jukka
Date: Fri Feb 29 07:14:55 2008
New Revision: 632341

URL: http://svn.apache.org/viewvc?rev=632341&view=rev
Log:
1.3: Merged revision 599370 (JCR-948)

Added:
    jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionFactory.java
      - copied unchanged from r599370, jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionFactory.java
Modified:
    jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
    jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java

Modified: jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java?rev=632341&r1=632340&r2=632341&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
Fri Feb 29 07:14:55 2008
@@ -194,7 +194,12 @@
     }
 
     /**
-     * Sets the JDBC connection url.
+     * Sets the JDBC connection URL.
+     * The connection can be created using a JNDI Data Source as well. 
+     * To do that, the driver class name must reference a javax.naming.Context class 
+     * (for example javax.naming.InitialContext), and the URL must be the JNDI URL 
+     * (for example java:comp/env/jdbc/Test).
+     * 
      * @param url the url to set.
      */
     public void setUrl(String url) {
@@ -244,6 +249,7 @@
     /**
      * Sets the class name of the JDBC driver. The driver class will be loaded
      * during {@link #init(PMContext) init} in order to assure the existence.
+     * If no driver is specified, the default driver for the database is used.
      *
      * @param driver the class name of the driver
      */

Modified: jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java?rev=632341&r1=632340&r2=632341&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java
Fri Feb 29 07:14:55 2008
@@ -19,7 +19,6 @@
 import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
-import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -315,16 +314,7 @@
      */
     private void setupConnection() throws SQLException, RepositoryException {
         try {
-            Class driverClass = Class.forName(driver);
-            // Workaround for Apache Derby:
-            // The JDBC specification recommends the Class.ForName method without the .newInstance()
method call, 
-            // but adding the newInstance() guarantees that Derby will be booted on any Java
Virtual Machine.
-            driverClass.newInstance();
-        } catch (Throwable e) {
-            throw new RepositoryException("Could not load or initialize the database driver
class " + driver, e);
-        }
-        try {
-            connection = DriverManager.getConnection(url, user, password);
+            connection = ConnectionFactory.getConnection(driver, url, user, password);
         } catch (SQLException e) {
             log.warn("Could not connect; driver: " + driver + " url: " + url + " user: "
+ user + " error: " + e.toString(), e);
             throw e;



Mime
View raw message