sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1371512 - in /sqoop/branches/sqoop2: core/src/main/java/org/apache/sqoop/repository/ repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/
Date Thu, 09 Aug 2012 22:10:35 GMT
Author: blee
Date: Thu Aug  9 22:10:35 2012
New Revision: 1371512

URL: http://svn.apache.org/viewvc?rev=1371512&view=rev
Log:
SQOOP-567 Support connection validation in JDBC repository

Modified:
    sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java
    sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java
    sqoop/branches/sqoop2/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java

Modified: sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java
URL: http://svn.apache.org/viewvc/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java?rev=1371512&r1=1371511&r2=1371512&view=diff
==============================================================================
--- sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java
(original)
+++ sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryHandler.java
Thu Aug  9 22:10:35 2012
@@ -95,4 +95,13 @@ public interface JdbcRepositoryHandler {
    * Should clean up all resources and commit all uncommitted data.
    */
   public void shutdown();
+
+  /**
+   * Specify query that Sqoop framework can use to validate connection to
+   * repository. This query should return at least one row.
+   *
+   * @return Query or NULL in case that this repository do not support or do not
+   *   want to validate live connections.
+   */
+  public String validationQuery();
 }

Modified: sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java
URL: http://svn.apache.org/viewvc/sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java?rev=1371512&r1=1371511&r2=1371512&view=diff
==============================================================================
--- sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java
(original)
+++ sqoop/branches/sqoop2/core/src/main/java/org/apache/sqoop/repository/JdbcRepositoryProvider.java
Thu Aug  9 22:10:35 2012
@@ -146,7 +146,7 @@ public class JdbcRepositoryProvider impl
 
     // creating the factor automatically wires the connection pool
     new PoolableConnectionFactory(connFactory, connectionPool, statementPool,
-        /* FIXME validation query */null, false, false,
+        handler.validationQuery(), false, false,
         repoContext.getTransactionIsolation().getCode());
 
     dataSource = new PoolingDataSource(connectionPool);

Modified: sqoop/branches/sqoop2/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
URL: http://svn.apache.org/viewvc/sqoop/branches/sqoop2/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java?rev=1371512&r1=1371511&r2=1371512&view=diff
==============================================================================
--- sqoop/branches/sqoop2/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
(original)
+++ sqoop/branches/sqoop2/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
Thu Aug  9 22:10:35 2012
@@ -255,6 +255,7 @@ public class DerbyRepositoryHandler impl
 
     return true;
   }
+
   /**
    * {@inheritDoc}
    */
@@ -434,6 +435,14 @@ public class DerbyRepositoryHandler impl
   }
 
   /**
+   * {@inheritDoc}
+   */
+  @Override
+  public String validationQuery() {
+    return "values(1)"; // Yes, this is valid derby SQL
+  }
+
+  /**
    * Register forms in derby database.
    *
    * Use given prepared statements to create entire form structure in database.



Mime
View raw message