[ 
https://issues.apache.org/jira/browse/SOLR-1450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12758181#action_12758181
 ] 

Steve Sun edited comment on SOLR-1450 at 9/22/09 2:28 AM:
----------------------------------------------------------

Move the connection setup code out of the try...catch block.


      was (Author: steve.sun):
    Index: 
contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java
===================================================================
--- 
contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java
      (revision 817524)
+++ 
contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java
      (working copy)
@@ -153,6 +153,15 @@
                       "the jndi name : '"+jndiName +"' is not a valid 
javax.sql.DataSource");
             }
           }
+        } catch (SQLException e) {
+          // DriverManager does not allow you to use a driver which is not 
loaded through
+          // the class loader of the class which is trying to make the 
connection.
+          // This is a workaround for cases where the user puts the driver jar 
in the
+          // solr.home/lib or solr.home/core/lib directories.
+          Driver d = (Driver) DocBuilder.loadClass(driver, 
context.getSolrCore()).newInstance();
+          c = d.connect(url, initProps);
+        }
+        if (c != null) {
           if (Boolean.parseBoolean(initProps.getProperty("readOnly"))) {
             c.setReadOnly(true);
             // Add other sane defaults
@@ -181,13 +190,6 @@
           } else {
             c.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT);
           }
-        } catch (SQLException e) {
-          // DriverManager does not allow you to use a driver which is not 
loaded through
-          // the class loader of the class which is trying to make the 
connection.
-          // This is a workaround for cases where the user puts the driver jar 
in the
-          // solr.home/lib or solr.home/core/lib directories.
-          Driver d = (Driver) DocBuilder.loadClass(driver, 
context.getSolrCore()).newInstance();
-          c = d.connect(url, initProps);
         }
         LOG.info("Time taken for getConnection(): "
                 + (System.currentTimeMillis() - start));

  
> DIH import "out of memory" problem (batchSize and autoCommit not working)
> -------------------------------------------------------------------------
>
>                 Key: SOLR-1450
>                 URL: https://issues.apache.org/jira/browse/SOLR-1450
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 1.1.0, 1.2, 1.3, 1.4, 1.5
>         Environment: Generic
>            Reporter: Steve Sun
>         Attachments: jdbc-817524.loadClass.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> When JDBC driver is placed in <solr-home>/lib (as instructed by DIHQuickStart 
> page of Solr wiki), but not in tomcat's lib directory, the JDBC connection 
> will not be configured as specified in the DIH configuration.  Attributes 
> like autoCommit, readOnly and batchSize will be ignored.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to