manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1540867 - in /manifoldcf/trunk: ./ connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/ connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/ connectors/jdbc/connector...
Date Mon, 11 Nov 2013 22:17:05 GMT
Author: kwright
Date: Mon Nov 11 22:17:04 2013
New Revision: 1540867

URL: http://svn.apache.org/r1540867
Log:
Fix for CONNECTORS-808.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java
    manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java
    manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnection.java
    manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnectionFactory.java
    manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConstants.java
    manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_en_US.properties
    manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_ja_JP.properties
    manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_en_US.properties
    manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_ja_JP.properties

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Mon Nov 11 22:17:04 2013
@@ -3,9 +3,13 @@ $Id$
 
 ======================= 1.5-dev =====================
 
+CONNECTORS-808: Add raw jdbc string so smart users can override the
+default behavior and supply gobbledegook Oracle connect strings.
+(Marcello Lorenzi, Karl Wright)
+
 CONNECTORS-807: Handle the case when there are no documents being
 deleted.
-(Adian Conlon, Karl Wright)
+(Adrian Conlon, Karl Wright)
 
 CONNECTORS-804: Web connector documentation is out of date.
 (Shigeki Kobayashi, Karl Wright)

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java
(original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java
Mon Nov 11 22:17:04 2013
@@ -65,6 +65,7 @@ public class JDBCAuthority extends BaseA
   protected String accessMethod = null;
   protected String host = null;
   protected String databaseName = null;
+  protected String rawDriverString = null;
   protected String userName = null;
   protected String password = null;
 
@@ -101,6 +102,7 @@ public class JDBCAuthority extends BaseA
     accessMethod = configParams.getParameter(JDBCConstants.methodParameter);
     host = configParams.getParameter(JDBCConstants.hostParameter);
     databaseName = configParams.getParameter(JDBCConstants.databaseNameParameter);
+    rawDriverString = configParams.getParameter(JDBCConstants.driverStringParameter);
     userName = configParams.getParameter(JDBCConstants.databaseUserName);
     password = configParams.getObfuscatedParameter(JDBCConstants.databasePassword);
 
@@ -138,6 +140,7 @@ public class JDBCAuthority extends BaseA
     jdbcProvider = null;
     accessMethod = null;
     databaseName = null;
+    rawDriverString = null;
     userName = null;
     password = null;
 
@@ -153,19 +156,19 @@ public class JDBCAuthority extends BaseA
       if (jdbcProvider == null || jdbcProvider.length() == 0) {
         throw new ManifoldCFException("Missing parameter '" + JDBCConstants.providerParameter
+ "'");
       }
-      if (host == null || host.length() == 0) {
-        throw new ManifoldCFException("Missing parameter '" + JDBCConstants.hostParameter
+ "'");
-      }
+      if ((host == null || host.length() == 0) && (rawDriverString == null || rawDriverString.length()
== 0))
+        throw new ManifoldCFException("Missing parameter '"+JDBCConstants.hostParameter+"'
or '"+JDBCConstants.driverStringParameter+"'");
 
-      connection = new JDBCConnection(jdbcProvider,(accessMethod==null || accessMethod.equals("name")),host,databaseName,userName,password);
+      connection = new JDBCConnection(jdbcProvider,(accessMethod==null || accessMethod.equals("name")),host,databaseName,rawDriverString,userName,password);
     }
   }
 
   private String createCacheConnectionString() {
     StringBuilder sb = new StringBuilder();
     sb.append(jdbcProvider).append("|")
-      .append(host).append("|")
-      .append(databaseName).append("|")
+      .append((host==null)?"":host).append("|")
+      .append((databaseName==null)?"":databaseName).append("|")
+      .append((rawDriverString==null)?"":rawDriverString).append("|")
       .append(userName);
     return sb.toString();
   }
@@ -346,36 +349,37 @@ public class JDBCAuthority extends BaseA
     tabsArray.add(Messages.getString(locale, "JDBCAuthority.Queries"));
 
     out.print(
-      "<script type=\"text/javascript\">\n"
-      + "<!--\n"
-      + "function checkConfigForSave()\n"
-      + "{\n"
-      + "  if (editconnection.databasehost.value == \"\")\n"
-      + "  {\n"
-      + "    alert(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.PleaseFillInADatabaseServerName")
+ "\");\n"
-      + "    SelectTab(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.Server")
+ "\");\n"
-      + "    editconnection.databasehost.focus();\n"
-      + "    return false;\n"
-      + "  }\n"
-      + "  if (editconnection.databasename.value == \"\")\n"
-      + "  {\n"
-      + "    alert(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.PleaseFillInTheNameOfTheDatabase")
+ "\");\n"
-      + "    SelectTab(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.Server")
+ "\");\n"
-      + "    editconnection.databasename.focus();\n"
-      + "    return false;\n"
-      + "  }\n"
-      + "  if (editconnection.username.value == \"\")\n"
-      + "  {\n"
-      + "    alert(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.PleaseSupplyTheDatabaseUsernameForThisConnection")
+ "\");\n"
-      + "    SelectTab(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.Credentials")
+ "\");\n"
-      + "    editconnection.username.focus();\n"
-      + "    return false;\n"
-      + "  }\n"
-      + "  return true;\n"
-      + "}\n"
-      + "\n"
-      + "//-->\n"
-      + "</script>\n");
+"<script type=\"text/javascript\">\n"+
+"<!--\n"+
+"function checkConfigForSave()\n"+
+"{\n"+
+"  if (editconnection.databasehost.value == \"\" && editconnection.rawjdbcstring.value
== \"\")\n"+
+"  {\n"+
+"    alert(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.PleaseFillInADatabaseServerName")
+ "\");\n"+
+"    SelectTab(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.Server") + "\");\n"+
+"    editconnection.databasehost.focus();\n"+
+"    return false;\n"+
+"  }\n"+
+"  if (editconnection.databasename.value == \"\" && editconnection.rawjdbcstring.value
== \"\")\n"+
+"  {\n"+
+"    alert(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.PleaseFillInTheNameOfTheDatabase")
+ "\");\n"+
+"    SelectTab(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.Server") + "\");\n"+
+"    editconnection.databasename.focus();\n"+
+"    return false;\n"+
+"  }\n"+
+"  if (editconnection.username.value == \"\")\n"+
+"  {\n"+
+"    alert(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.PleaseSupplyTheDatabaseUsernameForThisConnection")
+ "\");\n"+
+"    SelectTab(\"" + Messages.getBodyJavascriptString(locale, "JDBCAuthority.Credentials")
+ "\");\n"+
+"    editconnection.username.focus();\n"+
+"    return false;\n"+
+"  }\n"+
+"  return true;\n"+
+"}\n"+
+"\n"+
+"//-->\n"+
+"</script>\n"
+    );
   }
 
   /**
@@ -410,6 +414,9 @@ public class JDBCAuthority extends BaseA
     if (lDatabaseName == null) {
       lDatabaseName = "database";
     }
+    String rawJDBCString = parameters.getParameter(JDBCConstants.driverStringParameter);
+    if (rawJDBCString == null)
+      rawJDBCString = "";
     String databaseUser = parameters.getParameter(JDBCConstants.databaseUserName);
     if (databaseUser == null) {
       databaseUser = "";
@@ -465,19 +472,25 @@ public class JDBCAuthority extends BaseA
     // "Server" tab
     if (tabName.equals(Messages.getString(locale, "JDBCAuthority.Server"))) {
       out.print(
-        "<table class=\"displaytable\">\n"
-        + "  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
-        + "  <tr>\n"
-        + "    <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"JDBCAuthority.DatabaseHostAndPort") + "</nobr></td><td class=\"value\"><input
type=\"text\" size=\"64\" name=\"databasehost\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(lHost)
+ "\"/></td>\n"
-        + "  </tr>\n"
-        + "  <tr>\n"
-        + "    <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"JDBCAuthority.DatabaseServiceNameOrInstanceDatabase") + "</nobr></td><td class=\"value\"><input
type=\"text\" size=\"32\" name=\"databasename\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(lDatabaseName)
+ "\"/></td>\n"
-        + "  </tr>\n"
-        + "</table>\n");
+"<table class=\"displaytable\">\n"+
+"  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
+"  <tr>\n"+
+"    <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "JDBCAuthority.DatabaseHostAndPort")
+ "</nobr></td><td class=\"value\"><input type=\"text\" size=\"64\" name=\"databasehost\"
value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(lHost) + "\"/></td>\n"+
+"  </tr>\n"+
+"  <tr>\n"+
+"    <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "JDBCAuthority.DatabaseServiceNameOrInstanceDatabase")
+ "</nobr></td><td class=\"value\"><input type=\"text\" size=\"32\" name=\"databasename\"
value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(lDatabaseName) + "\"/></td>\n"+
+"  </tr>\n"+
+"  <tr>\n"+
+"    <td class=\"description\"><nobr>" + Messages.getBodyString(locale,"JDBCAuthority.RawDatabaseConnectString")
+ "</nobr></td><td class=\"value\"><input type=\"text\" size=\"80\" name=\"rawjdbcstring\"
value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(rawJDBCString)+"\"/></td>\n"+
+"  </tr>\n"+
+"</table>\n"
+      );
     } else {
       out.print(
-        "<input type=\"hidden\" name=\"databasehost\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(lHost)
+ "\"/>\n"
-        + "<input type=\"hidden\" name=\"databasename\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(lDatabaseName)
+ "\"/>\n");
+"<input type=\"hidden\" name=\"databasehost\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(lHost)
+ "\"/>\n"+
+"<input type=\"hidden\" name=\"databasename\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(lDatabaseName)
+ "\"/>\n"+
+"<input type=\"hidden\" name=\"rawjdbcstring\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(rawJDBCString)+"\"/>\n"
+      );
     }
 
     // "Credentials" tab
@@ -558,6 +571,10 @@ public class JDBCAuthority extends BaseA
       parameters.setParameter(JDBCConstants.databaseNameParameter, lDatabaseName);
     }
 
+    String rawJDBCString = variableContext.getParameter("rawjdbcstring");
+    if (rawJDBCString != null)
+      parameters.setParameter(JDBCConstants.driverStringParameter,rawJDBCString);
+
     String lUserName = variableContext.getParameter("username");
     if (lUserName != null) {
       parameters.setParameter(JDBCConstants.databaseUserName, lUserName);

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java
(original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnector.java
Mon Nov 11 22:17:04 2013
@@ -84,6 +84,7 @@ public class JDBCConnector extends org.a
   protected String accessMethod = null;
   protected String host = null;
   protected String databaseName = null;
+  protected String rawDriverString = null;
   protected String userName = null;
   protected String password = null;
 
@@ -101,10 +102,10 @@ public class JDBCConnector extends org.a
     {
       if (jdbcProvider == null || jdbcProvider.length() == 0)
         throw new ManifoldCFException("Missing parameter '"+JDBCConstants.providerParameter+"'");
-      if (host == null || host.length() == 0)
-        throw new ManifoldCFException("Missing parameter '"+JDBCConstants.hostParameter+"'");
+      if ((host == null || host.length() == 0) && (rawDriverString == null || rawDriverString.length()
== 0))
+        throw new ManifoldCFException("Missing parameter '"+JDBCConstants.hostParameter+"'
or '"+JDBCConstants.driverStringParameter+"'");
 
-      connection = new JDBCConnection(jdbcProvider,(accessMethod==null || accessMethod.equals("name")),host,databaseName,userName,password);
+      connection = new JDBCConnection(jdbcProvider,(accessMethod==null || accessMethod.equals("name")),host,databaseName,rawDriverString,userName,password);
     }
   }
 
@@ -139,6 +140,7 @@ public class JDBCConnector extends org.a
     accessMethod = configParams.getParameter(JDBCConstants.methodParameter);
     host = configParams.getParameter(JDBCConstants.hostParameter);
     databaseName = configParams.getParameter(JDBCConstants.databaseNameParameter);
+    rawDriverString = configParams.getParameter(JDBCConstants.driverStringParameter);
     userName= configParams.getParameter(JDBCConstants.databaseUserName);
     password = configParams.getObfuscatedParameter(JDBCConstants.databasePassword);
   }
@@ -175,6 +177,7 @@ public class JDBCConnector extends org.a
     jdbcProvider = null;
     accessMethod = null;
     databaseName = null;
+    rawDriverString = null;
     userName = null;
     password = null;
 
@@ -193,7 +196,7 @@ public class JDBCConnector extends org.a
   @Override
   public String[] getBinNames(String documentIdentifier)
   {
-    return new String[]{host};
+    return new String[]{(rawDriverString==null||rawDriverString.length()==0)?host:rawDriverString};
   }
 
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.
 Documents
@@ -761,14 +764,14 @@ public class JDBCConnector extends org.a
 "<!--\n"+
 "function checkConfigForSave()\n"+
 "{\n"+
-"  if (editconnection.databasehost.value == \"\")\n"+
+"  if (editconnection.databasehost.value == \"\" && editconnection.rawjdbcstring.value
== \"\")\n"+
 "  {\n"+
 "    alert(\"" + Messages.getBodyJavascriptString(locale,"JDBCConnector.PleaseFillInADatabaseServerName")
+ "\");\n"+
 "    SelectTab(\"" + Messages.getBodyJavascriptString(locale,"JDBCConnector.Server") + "\");\n"+
 "    editconnection.databasehost.focus();\n"+
 "    return false;\n"+
 "  }\n"+
-"  if (editconnection.databasename.value == \"\")\n"+
+"  if (editconnection.databasename.value == \"\" && editconnection.rawjdbcstring.value
== \"\")\n"+
 "  {\n"+
 "    alert(\"" + Messages.getBodyJavascriptString(locale,"JDBCConnector.PleaseFillInTheNameOfTheDatabase")
+ "\");\n"+
 "    SelectTab(\"" + Messages.getBodyJavascriptString(locale,"JDBCConnector.Server") + "\");\n"+
@@ -816,6 +819,9 @@ public class JDBCConnector extends org.a
     String databaseName = parameters.getParameter(JDBCConstants.databaseNameParameter);
     if (databaseName == null)
       databaseName = "database";
+    String rawJDBCString = parameters.getParameter(JDBCConstants.driverStringParameter);
+    if (rawJDBCString == null)
+      rawJDBCString = "";
     String databaseUser = parameters.getParameter(JDBCConstants.databaseUserName);
     if (databaseUser == null)
       databaseUser = "";
@@ -874,6 +880,9 @@ public class JDBCConnector extends org.a
 "  <tr>\n"+
 "    <td class=\"description\"><nobr>" + Messages.getBodyString(locale,"JDBCConnector.DatabaseServiceNameOrInstanceDatabase")
+ "</nobr></td><td class=\"value\"><input type=\"text\" size=\"32\" name=\"databasename\"
value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(databaseName)+"\"/></td>\n"+
 "  </tr>\n"+
+"  <tr>\n"+
+"    <td class=\"description\"><nobr>" + Messages.getBodyString(locale,"JDBCConnector.RawDatabaseConnectString")
+ "</nobr></td><td class=\"value\"><input type=\"text\" size=\"80\" name=\"rawjdbcstring\"
value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(rawJDBCString)+"\"/></td>\n"+
+"  </tr>\n"+
 "</table>\n"
       );
     }
@@ -881,7 +890,8 @@ public class JDBCConnector extends org.a
     {
       out.print(
 "<input type=\"hidden\" name=\"databasehost\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(host)+"\"/>\n"+
-"<input type=\"hidden\" name=\"databasename\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(databaseName)+"\"/>\n"
+"<input type=\"hidden\" name=\"databasename\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(databaseName)+"\"/>\n"+
+"<input type=\"hidden\" name=\"rawjdbcstring\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(rawJDBCString)+"\"/>\n"
       );
     }
 
@@ -939,6 +949,10 @@ public class JDBCConnector extends org.a
     if (databaseName != null)
       parameters.setParameter(JDBCConstants.databaseNameParameter,databaseName);
 
+    String rawJDBCString = variableContext.getParameter("rawjdbcstring");
+    if (rawJDBCString != null)
+      parameters.setParameter(JDBCConstants.driverStringParameter,rawJDBCString);
+
     String userName = variableContext.getParameter("username");
     if (userName != null)
       parameters.setParameter(JDBCConstants.databaseUserName,userName);

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnection.java?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnection.java
(original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnection.java
Mon Nov 11 22:17:04 2013
@@ -38,19 +38,19 @@ public class JDBCConnection
 
   protected String jdbcProvider = null;
   protected boolean useName;
-  protected String host = null;
-  protected String databaseName = null;
+  protected String driverString = null;
   protected String userName = null;
   protected String password = null;
 
   /** Constructor.
   */
-  public JDBCConnection(String jdbcProvider, boolean useName, String host, String databaseName,
String userName, String password)
+  public JDBCConnection(String jdbcProvider, boolean useName, String host, String databaseName,
String rawDriverString,
+    String userName, String password)
+    throws ManifoldCFException
   {
     this.jdbcProvider = jdbcProvider;
     this.useName = useName;
-    this.host = host;
-    this.databaseName = databaseName;
+    this.driverString = JDBCConnectionFactory.getJDBCDriverString(jdbcProvider, host, databaseName,
rawDriverString);
     this.userName = userName;
     this.password = password;
   }
@@ -213,7 +213,7 @@ public class JDBCConnection
     {
       try
       {
-        WrappedConnection tempConnection = JDBCConnectionFactory.getConnection(jdbcProvider,host,databaseName,userName,password);
+        WrappedConnection tempConnection = JDBCConnectionFactory.getConnection(jdbcProvider,driverString,userName,password);
         JDBCConnectionFactory.releaseConnection(tempConnection);
       }
       catch (Throwable e)
@@ -367,7 +367,7 @@ public class JDBCConnection
     {
       try
       {
-        WrappedConnection tempConnection = JDBCConnectionFactory.getConnection(jdbcProvider,host,databaseName,userName,password);
+        WrappedConnection tempConnection = JDBCConnectionFactory.getConnection(jdbcProvider,driverString,userName,password);
         try
         {
           execute(tempConnection.getConnection(),query,params,false,0,useName);
@@ -1050,7 +1050,7 @@ public class JDBCConnection
     {
       try
       {
-        connection = JDBCConnectionFactory.getConnection(jdbcProvider,host,databaseName,userName,password);
+        connection = JDBCConnectionFactory.getConnection(jdbcProvider,driverString,userName,password);
         // lightest statement type
         stmt = connection.getConnection().createStatement();
         stmt.execute(query);
@@ -1350,7 +1350,7 @@ public class JDBCConnection
     {
       try
       {
-        connection = JDBCConnectionFactory.getConnection(jdbcProvider,host,databaseName,userName,password);
+        connection = JDBCConnectionFactory.getConnection(jdbcProvider,driverString,userName,password);
         ps = connection.getConnection().prepareStatement(query);
         loadPS(ps, params);
         rs = ps.executeQuery();

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnectionFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnectionFactory.java?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnectionFactory.java
(original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConnectionFactory.java
Mon Nov 11 22:17:04 2013
@@ -36,13 +36,13 @@ public class JDBCConnectionFactory
 {
   public static final String _rcsid = "@(#)$Id$";
 
-  private static Map driverMap;
+  private static Map<String,String> driverMap;
 
   private static ConnectionPoolManager _pool = null;
 
   static
   {
-    driverMap = new HashMap();
+    driverMap = new HashMap<String,String>();
     driverMap.put("oracle:thin:@","oracle.jdbc.OracleDriver");
     driverMap.put("postgresql:","org.postgresql.Driver");
     driverMap.put("jtds:sqlserver:","net.sourceforge.jtds.jdbc.Driver");
@@ -63,17 +63,17 @@ public class JDBCConnectionFactory
   {
   }
 
-
-  public static WrappedConnection getConnection(String providerName, String host, String
database, String userName, String password)
-    throws ManifoldCFException, ServiceInterruption
+  /** Convert various connection parameters to a JDBC connection string, used in conjunction
with the
+  * provider name.
+  */
+  public static String getJDBCDriverString(String providerName, String host, String database,
String rawDriverString)
   {
+    if (rawDriverString != null && rawDriverString.length() > 0)
+      return rawDriverString;
+
     if (database.length() == 0)
       database = "_root_";
 
-    String driverClassName = (String)driverMap.get(providerName);
-    if (driverClassName == null)
-      throw new ManifoldCFException("Unrecognized jdbc provider: '"+providerName+"'");
-
     String instanceName = null;
     // Special for MSSQL: Allow database spec to contain an instance name too, in form:
     // <instance>/<database>
@@ -87,7 +87,17 @@ public class JDBCConnectionFactory
       }
     }
 
-    String dburl = "jdbc:" + providerName + "//" + host + "/" + database + ((instanceName==null)?"":";instance="+instanceName);
+    return host + "/" + database + ((instanceName==null)?"":";instance="+instanceName);
+  }
+  
+  public static WrappedConnection getConnection(String providerName, String jdbcDriverString,
String userName, String password)
+    throws ManifoldCFException, ServiceInterruption
+  {
+    String driverClassName = driverMap.get(providerName);
+    if (driverClassName == null)
+      throw new ManifoldCFException("Unrecognized jdbc provider: '"+providerName+"'");
+
+    String dburl = "jdbc:" + providerName + "//" + jdbcDriverString;
     if (Logging.connectors != null && Logging.connectors.isDebugEnabled())
       Logging.connectors.debug("JDBC: The connect string is '"+dburl+"'");
     try
@@ -99,13 +109,7 @@ public class JDBCConnectionFactory
         // the database and host at a minimum.
 
         // Provider is part of the pool key, so that the pools can distinguish between different
databases
-        String poolKey = providerName + "/";
-
-        // Distinguish between instance names and databases too
-        if (instanceName == null)
-          poolKey += host + "/" + database;
-        else
-          poolKey += host + "/" + instanceName + "/" + database;
+        String poolKey = providerName + "/" + jdbcDriverString;
 
         // Better include the credentials on the pool key, or we won't be able to change
those and have it build new connections
         // The password value is SHA-1 hashed, because the pool driver reports the password
in many exceptions and we don't want it

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConstants.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConstants.java?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConstants.java
(original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/jdbc/JDBCConstants.java
Mon Nov 11 22:17:04 2013
@@ -32,6 +32,8 @@ public class JDBCConstants
   public static String hostParameter = "Host";
   /** The database name config parameter */
   public static String databaseNameParameter = "Database name";
+  /** The raw configuration string */
+  public static String driverStringParameter = "Raw driver string";
   /** The user name config parameter */
   public static String databaseUserName = "User name";
   /** The password config parameter */

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_en_US.properties?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_en_US.properties
(original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_en_US.properties
Mon Nov 11 22:17:04 2013
@@ -22,6 +22,7 @@ JDBCAuthority.Credentials=Credentials
 JDBCAuthority.DatabaseType2=Database type:
 JDBCAuthority.DatabaseHostAndPort=Database host and port:
 JDBCAuthority.DatabaseServiceNameOrInstanceDatabase=Database service name or instance/database:
+JDBCAuthority.RawDatabaseConnectString=Raw database connect string:
 JDBCAuthority.UserName=User name:
 JDBCAuthority.Password=Password:
 JDBCAuthority.Parameters=Parameters:

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_ja_JP.properties?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_ja_JP.properties
(original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jdbc/common_ja_JP.properties
Mon Nov 11 22:17:04 2013
@@ -22,6 +22,7 @@ JDBCAuthority.Credentials=証明æ
 JDBCAuthority.DatabaseType2=データベースタイプ:
 JDBCAuthority.DatabaseHostAndPort=データベースホスト/ポート:
 JDBCAuthority.DatabaseServiceNameOrInstanceDatabase=データベースサービス名又はインスタンス/データベース:
+JDBCAuthority.RawDatabaseConnectString=Raw database connect string:
 JDBCAuthority.UserName=ユーザ名:
 JDBCAuthority.Password=パスワード:
 JDBCAuthority.Parameters=引数:

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_en_US.properties?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_en_US.properties
(original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_en_US.properties
Mon Nov 11 22:17:04 2013
@@ -22,6 +22,7 @@ JDBCConnector.Credentials=Credentials
 JDBCConnector.DatabaseType2=Database type:
 JDBCConnector.DatabaseHostAndPort=Database host and port:
 JDBCConnector.DatabaseServiceNameOrInstanceDatabase=Database service name or instance/database:
+JDBCConnector.RawDatabaseConnectString=Raw database connect string:
 JDBCConnector.UserName=User name:
 JDBCConnector.Password=Password:
 JDBCConnector.Parameters=Parameters:

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_ja_JP.properties?rev=1540867&r1=1540866&r2=1540867&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_ja_JP.properties
(original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jdbc/common_ja_JP.properties
Mon Nov 11 22:17:04 2013
@@ -22,6 +22,7 @@ JDBCConnector.Credentials=証明æ
 JDBCConnector.DatabaseType2=データベースタイプ:
 JDBCConnector.DatabaseHostAndPort=データベースホスト/ポート:
 JDBCConnector.DatabaseServiceNameOrInstanceDatabase=データベースサービス名又はインスタンス/データベース:
+JDBCConnector.RawDatabaseConnectString=Raw database connect string:
 JDBCConnector.UserName=ユーザ名:
 JDBCConnector.Password=パスワード:
 JDBCConnector.Parameters=引数:



Mime
View raw message