db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r279626 - in /db/ddlutils/trunk/src: java/org/apache/ddlutils/ java/org/apache/ddlutils/platform/ test/org/apache/ddlutils/ test/org/apache/ddlutils/platform/
Date Thu, 08 Sep 2005 21:14:21 GMT
Author: tomdz
Date: Thu Sep  8 14:14:09 2005
New Revision: 279626

URL: http://svn.apache.org/viewcvs?rev=279626&view=rev
Log:
Reworked determination of platform type from jdbc driver & connection url
Added tests for this determination
Added jdbc driver & subprotocols for DataDirect JDBC drivers

Added:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestPlatformUtils.java
Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformUtils.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/CloudscapePlatform.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Db2Platform.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Oracle8Platform.java
    db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformUtils.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformUtils.java?rev=279626&r1=279625&r2=279626&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformUtils.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformUtils.java Thu Sep  8 14:14:09
2005
@@ -20,10 +20,13 @@
 import java.sql.DatabaseMetaData;
 import java.sql.SQLException;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
 
 import javax.sql.DataSource;
 
 import org.apache.ddlutils.platform.AxionPlatform;
+import org.apache.ddlutils.platform.CloudscapePlatform;
 import org.apache.ddlutils.platform.Db2Platform;
 import org.apache.ddlutils.platform.DerbyPlatform;
 import org.apache.ddlutils.platform.FirebirdPlatform;
@@ -39,12 +42,23 @@
 import org.apache.ddlutils.platform.SybasePlatform;
 
 /**
- * Utility functions for dealing with the database platforms.
+ * Utility functions for dealing with database platforms.
+ * 
+ * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
+ * @version $Revision: 279421 $
  */
 public class PlatformUtils
 {
     // Extended drivers that support more than one database
 
+    /** The DataDirect Connect DB2 jdbc driver */
+    public static final String JDBC_DRIVER_DATADIRECT_DB2        = "com.ddtek.jdbc.db2.DB2Driver";
+    /** The DataDirect Connect SQLServer jdbc driver */
+    public static final String JDBC_DRIVER_DATADIRECT_SQLSERVER  = "com.ddtek.jdbc.sqlserver.SQLServerDriver";
+    /** The DataDirect Connect Oracle jdbc driver */
+    public static final String JDBC_DRIVER_DATADIRECT_ORACLE     = "com.ddtek.jdbc.oracle.OracleDriver";
+    /** The DataDirect Connect Sybase jdbc driver */
+    public static final String JDBC_DRIVER_DATADIRECT_SYBASE     = "com.ddtek.jdbc.sybase.SybaseDriver";
     /** The i-net DB2 jdbc driver */
     public static final String JDBC_DRIVER_INET_DB2              = "com.inet.drda.DRDADriver";
     /** The i-net Oracle jdbc driver */
@@ -60,36 +74,54 @@
     /** The jTDS jdbc driver for SQLServer and Sybase */
     public static final String JDBC_DRIVER_JTDS                  = "net.sourceforge.jtds.jdbc.Driver";
 
+    /** The subprotocol used by the DataDirect DB2 driver */
+    public static final String JDBC_SUBPROTOCOL_DATADIRECT_DB2            = "datadirect:db2";
+    /** The subprotocol used by the DataDirect SQLServer driver */
+    public static final String JDBC_SUBPROTOCOL_DATADIRECT_SQLSERVER      = "datadirect:sqlserver";
+    /** The subprotocol used by the DataDirect Oracle driver */
+    public static final String JDBC_SUBPROTOCOL_DATADIRECT_ORACLE         = "datadirect:oracle";
+    /** The subprotocol used by the DataDirect Sybase driver */
+    public static final String JDBC_SUBPROTOCOL_DATADIRECT_SYBASE         = "datadirect:sybase";
     /** The subprotocol used by the i-net DB2 driver */
-    public static final String JDBC_SUBPROTOCOL_INET_DB2                = "inetdb2";
+    public static final String JDBC_SUBPROTOCOL_INET_DB2                  = "inetdb2";
     /** The subprotocol used by the i-net Oracle driver */
-    public static final String JDBC_SUBPROTOCOL_INET_ORACLE             = "inetora";
+    public static final String JDBC_SUBPROTOCOL_INET_ORACLE               = "inetora";
     /** A subprotocol used by the i-net SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER          = "inetdae";
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER            = "inetdae";
     /** A subprotocol used by the i-net SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER6         = "inetdae6";
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER6           = "inetdae6";
     /** A subprotocol used by the i-net SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7         = "inetdae7";
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7           = "inetdae7";
     /** A subprotocol used by the i-net SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7A        = "inetdae7a";
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7A          = "inetdae7a";
     /** A subprotocol used by the pooled i-net SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED   = "inetpool:inetdae";
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED_1   = "inetpool:inetdae";
     /** A subprotocol used by the pooled i-net SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED  = "inetpool:inetdae6";
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED_1  = "inetpool:inetdae6";
     /** A subprotocol used by the pooled i-net SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED  = "inetpool:inetdae7";
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED_1  = "inetpool:inetdae7";
     /** A subprotocol used by the pooled i-net SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED = "inetpool:inetdae7a";
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED_1 = "inetpool:inetdae7a";
+    /** A subprotocol used by the pooled i-net SQLServer driver */
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED_2   = "inetpool:jdbc:inetdae";
+    /** A subprotocol used by the pooled i-net SQLServer driver */
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED_2  = "inetpool:jdbc:inetdae6";
+    /** A subprotocol used by the pooled i-net SQLServer driver */
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED_2  = "inetpool:jdbc:inetdae7";
+    /** A subprotocol used by the pooled i-net SQLServer driver */
+    public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED_2 = "inetpool:jdbc:inetdae7a";
     /** The subprotocol used by the i-net Sybase driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SYBASE             = "inetsyb";
+    public static final String JDBC_SUBPROTOCOL_INET_SYBASE               = "inetsyb";
     /** The subprotocol used by the pooled i-net Sybase driver */
-    public static final String JDBC_SUBPROTOCOL_INET_SYBASE_POOLED      = "inetpool:inetsyb";
+    public static final String JDBC_SUBPROTOCOL_INET_SYBASE_POOLED_1      = "inetpool:inetsyb";
+    /** The subprotocol used by the pooled i-net Sybase driver */
+    public static final String JDBC_SUBPROTOCOL_INET_SYBASE_POOLED_2      = "inetpool:jdbc:inetsyb";
     /** The subprotocol used by the JNetDirect SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_JSQLCONNECT_SQLSERVER   = "JSQLConnect";
+    public static final String JDBC_SUBPROTOCOL_JSQLCONNECT_SQLSERVER     = "JSQLConnect";
     /** The subprotocol used by the jTDS SQLServer driver */
-    public static final String JDBC_SUBPROTOCOL_JTDS_SQLSERVER          = "jtds:sqlserver";
+    public static final String JDBC_SUBPROTOCOL_JTDS_SQLSERVER            = "jtds:sqlserver";
     /** The subprotocol used by the jTDS Sybase driver */
-    public static final String JDBC_SUBPROTOCOL_JTDS_SYBASE             = "jtds:sybase";
+    public static final String JDBC_SUBPROTOCOL_JTDS_SYBASE               = "jtds:sybase";
 
     /** Maps the sub-protocl part of a jdbc connection url to a OJB platform name */
     private HashMap jdbcSubProtocolToPlatform = new HashMap();
@@ -103,36 +135,55 @@
     {
         // Note that currently Sapdb and MaxDB have equal subprotocols and
         // drivers so we have no means to distinguish them
-        jdbcSubProtocolToPlatform.put(AxionPlatform.JDBC_SUBPROTOCOL,                   
     AxionPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(Db2Platform.JDBC_SUBPROTOCOL,                     
     Db2Platform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_DB2,          
     Db2Platform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(DerbyPlatform.JDBC_SUBPROTOCOL,                   
     DerbyPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(FirebirdPlatform.JDBC_SUBPROTOCOL,                
     FirebirdPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(HsqlDbPlatform.JDBC_SUBPROTOCOL,                  
     HsqlDbPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(InterbasePlatform.JDBC_SUBPROTOCOL,               
     InterbasePlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(SapDbPlatform.JDBC_SUBPROTOCOL,                   
     MaxDbPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(MckoiPlatform.JDBC_SUBPROTOCOL,                   
     MckoiPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(MSSqlPlatform.JDBC_SUBPROTOCOL,                   
     MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER,    
     MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER6,   
     MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7,   
     MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7A,  
     MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED,
  MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED,
 MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED,
 MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED,
MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_JTDS_SQLSERVER,    
     MSSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(MySqlPlatform.JDBC_SUBPROTOCOL,                   
     MySqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(Oracle8Platform.JDBC_SUBPROTOCOL,                 
     Oracle8Platform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_ORACLE,       
     Oracle8Platform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PostgreSqlPlatform.JDBC_SUBPROTOCOL,              
     PostgreSqlPlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(SybasePlatform.JDBC_SUBPROTOCOL,                  
     SybasePlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SYBASE,       
     SybasePlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SYBASE_POOLED,
     SybasePlatform.DATABASENAME);
-        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_JTDS_SYBASE,       
     SybasePlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(AxionPlatform.JDBC_SUBPROTOCOL,                   
       AxionPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(CloudscapePlatform.JDBC_SUBPROTOCOL_1,            
       CloudscapePlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(CloudscapePlatform.JDBC_SUBPROTOCOL_2,            
       CloudscapePlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(Db2Platform.JDBC_SUBPROTOCOL,                     
       Db2Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(Db2Platform.JDBC_SUBPROTOCOL_OS390_1,             
       Db2Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(Db2Platform.JDBC_SUBPROTOCOL_OS390_2,             
       Db2Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_DATADIRECT_DB2,    
       Db2Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_DB2,          
       Db2Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(DerbyPlatform.JDBC_SUBPROTOCOL,                   
       DerbyPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(FirebirdPlatform.JDBC_SUBPROTOCOL,                
       FirebirdPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(HsqlDbPlatform.JDBC_SUBPROTOCOL,                  
       HsqlDbPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(InterbasePlatform.JDBC_SUBPROTOCOL,               
       InterbasePlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(SapDbPlatform.JDBC_SUBPROTOCOL,                   
       MaxDbPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(MckoiPlatform.JDBC_SUBPROTOCOL,                   
       MckoiPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(MSSqlPlatform.JDBC_SUBPROTOCOL,                   
       MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_DATADIRECT_SQLSERVER,
     MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER,    
       MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER6,   
       MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7,   
       MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7A,  
       MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED_1,
  MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED_1,
 MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED_1,
 MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED_1,
MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED_2,
  MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED_2,
 MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED_2,
 MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED_2,
MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_JSQLCONNECT_SQLSERVER,
    MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_JTDS_SQLSERVER,    
       MSSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(MySqlPlatform.JDBC_SUBPROTOCOL,                   
       MySqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(Oracle8Platform.JDBC_SUBPROTOCOL_THIN,            
       Oracle8Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(Oracle8Platform.JDBC_SUBPROTOCOL_OCI8,            
       Oracle8Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(Oracle8Platform.JDBC_SUBPROTOCOL_THIN_OLD,        
       Oracle8Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_DATADIRECT_ORACLE, 
       Oracle8Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_ORACLE,       
       Oracle8Platform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PostgreSqlPlatform.JDBC_SUBPROTOCOL,              
       PostgreSqlPlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(SybasePlatform.JDBC_SUBPROTOCOL,                  
       SybasePlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_DATADIRECT_SYBASE, 
       SybasePlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SYBASE,       
       SybasePlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SYBASE_POOLED_1,
     SybasePlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SYBASE_POOLED_2,
     SybasePlatform.DATABASENAME);
+        jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_JTDS_SYBASE,       
       SybasePlatform.DATABASENAME);
 
         jdbcDriverToPlatform.put(AxionPlatform.JDBC_DRIVER,                       AxionPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(Db2Platform.JDBC_DRIVER,                         Db2Platform.DATABASENAME);
+        jdbcDriverToPlatform.put(Db2Platform.JDBC_DRIVER_OLD1,                    Db2Platform.DATABASENAME);
+        jdbcDriverToPlatform.put(Db2Platform.JDBC_DRIVER_OLD2,                    Db2Platform.DATABASENAME);
+        jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_DATADIRECT_DB2,        Db2Platform.DATABASENAME);
         jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_INET_DB2,              Db2Platform.DATABASENAME);
         jdbcDriverToPlatform.put(DerbyPlatform.JDBC_DRIVER_EMBEDDED,              DerbyPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(DerbyPlatform.JDBC_DRIVER,                       DerbyPlatform.DATABASENAME);
@@ -142,15 +193,19 @@
         jdbcDriverToPlatform.put(SapDbPlatform.JDBC_DRIVER,                       MaxDbPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(MckoiPlatform.JDBC_DRIVER,                       MckoiPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(MSSqlPlatform.JDBC_DRIVER,                       MSSqlPlatform.DATABASENAME);
+        jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_DATADIRECT_SQLSERVER,  MSSqlPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_INET_SQLSERVER,        MSSqlPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_JSQLCONNECT_SQLSERVER, MSSqlPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(MySqlPlatform.JDBC_DRIVER,                       MySqlPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(MySqlPlatform.JDBC_DRIVER_OLD,                   MySqlPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(Oracle8Platform.JDBC_DRIVER,                     Oracle8Platform.DATABASENAME);
+        jdbcDriverToPlatform.put(Oracle8Platform.JDBC_DRIVER_OLD,                 Oracle8Platform.DATABASENAME);
+        jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_DATADIRECT_ORACLE,     Oracle8Platform.DATABASENAME);
         jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_INET_ORACLE,           Oracle8Platform.DATABASENAME);
         jdbcDriverToPlatform.put(PostgreSqlPlatform.JDBC_DRIVER,                  PostgreSqlPlatform.DATABASENAME);
         jdbcDriverToPlatform.put(SybasePlatform.JDBC_DRIVER,                      SybasePlatform.DATABASENAME);
         jdbcDriverToPlatform.put(SybasePlatform.JDBC_DRIVER_OLD,                  SybasePlatform.DATABASENAME);
+        jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_DATADIRECT_SYBASE,     SybasePlatform.DATABASENAME);
         jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_INET_SYBASE,           SybasePlatform.DATABASENAME);
     }
 
@@ -210,41 +265,16 @@
         {
             return null;
         }
-
-        int pos     = jdbcConnectionUrl.indexOf(':');
-        int lastPos = pos;
-
-        // we're skipping over the 'jdbc'
-        lastPos = pos;
-        pos     = jdbcConnectionUrl.indexOf(':', lastPos + 1);
-
-        String subProtocol = jdbcConnectionUrl.substring(lastPos + 1, pos);
-
-        // there are a few jdbc drivers that have a subprotocol containing one or more ':'
-        if ("inetpool".equals(subProtocol))
+        for (Iterator it = jdbcSubProtocolToPlatform.entrySet().iterator(); it.hasNext();)
         {
-            // Possible forms are:
-            //   inetpool:<subprotocol>
-            //   inetpool:jdbc:<subprotocol>   (where we'll remove the 'jdbc' part)
-            
-            int tmpPos = jdbcConnectionUrl.indexOf(':', pos + 1);
+            Map.Entry entry          = (Map.Entry)it.next();
+            String    curSubProtocol = "jdbc:" + (String)entry.getKey() + ":";
 
-            if ("inetpool:jdbc".equals(jdbcConnectionUrl.substring(lastPos + 1, tmpPos)))
+            if (jdbcConnectionUrl.startsWith(curSubProtocol))
             {
-                pos    = tmpPos;
-                tmpPos = jdbcConnectionUrl.indexOf(':', pos + 1);
+                return (String)entry.getValue();
             }
-            subProtocol += ":" + jdbcConnectionUrl.substring(pos + 1, tmpPos);
         }
-        else if ("jtds".equals(subProtocol) ||
-                 "microsoft".equals(subProtocol) ||
-                 "sybase".equals(subProtocol))
-        {
-            pos         = jdbcConnectionUrl.indexOf(':', pos + 1);
-            subProtocol = ":" + jdbcConnectionUrl.substring(lastPos + 1, pos);
-        }
-
-        return (String)jdbcSubProtocolToPlatform.get(subProtocol);
+        return null;
     }
-
 }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/CloudscapePlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/CloudscapePlatform.java?rev=279626&r1=279625&r2=279626&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/CloudscapePlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/CloudscapePlatform.java Thu Sep
 8 14:14:09 2005
@@ -31,6 +31,10 @@
 {
     /** Database name of this platform */
     public static final String DATABASENAME = "Cloudscape";
+    /** A subprotocol used by the DB2 network driver */
+    public static final String JDBC_SUBPROTOCOL_1 = "db2j:net";
+    /** A subprotocol used by the DB2 network driver */
+    public static final String JDBC_SUBPROTOCOL_2 = "cloudscape:net";
 
     /**
      * Creates a new platform instance.

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Db2Platform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Db2Platform.java?rev=279626&r1=279625&r2=279626&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Db2Platform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Db2Platform.java Thu Sep  8 14:14:09
2005
@@ -32,9 +32,17 @@
     /** Database name of this platform */
     public static final String DATABASENAME     = "DB2";
     /** The standard DB2 jdbc driver */
-    public static final String JDBC_DRIVER      = "COM.ibm.db2.jdbc.app.DB2Driver";
+    public static final String JDBC_DRIVER      = "com.ibm.db2.jcc.DB2Driver";
+    /** Older name for the jdbc driver */
+    public static final String JDBC_DRIVER_OLD1 = "COM.ibm.db2.jdbc.app.DB2Driver";
+    /** Older name for the jdbc driver */
+    public static final String JDBC_DRIVER_OLD2 = "COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver";
     /** The subprotocol used by the standard DB2 driver */
     public static final String JDBC_SUBPROTOCOL = "db2";
+    /** An alternative subprotocol used by the standard DB2 driver on OS/390 */
+    public static final String JDBC_SUBPROTOCOL_OS390_1 = "db2os390";
+    /** An alternative subprotocol used by the standard DB2 driver on OS/390 */
+    public static final String JDBC_SUBPROTOCOL_OS390_2 = "db2os390sqlj";
 
     /**
      * Creates a new platform instance.

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Oracle8Platform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Oracle8Platform.java?rev=279626&r1=279625&r2=279626&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Oracle8Platform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/Oracle8Platform.java Thu Sep 
8 14:14:09 2005
@@ -31,11 +31,17 @@
 public class Oracle8Platform extends PlatformImplBase
 {
     /** Database name of this platform */
-    public static final String DATABASENAME     = "Oracle";
+    public static final String DATABASENAME              = "Oracle";
     /** The standard Oracle jdbc driver */
-    public static final String JDBC_DRIVER      = "oracle.jdbc.driver.OracleDriver";
-    /** The subprotocol used by the standard Oracle driver */
-    public static final String JDBC_SUBPROTOCOL = "oracle";
+    public static final String JDBC_DRIVER               = "oracle.jdbc.driver.OracleDriver";
+    /** The old Oracle jdbc driver */
+    public static final String JDBC_DRIVER_OLD           = "oracle.jdbc.dnlddriver.OracleDriver";
+    /** The thin subprotocol used by the standard Oracle driver */
+    public static final String JDBC_SUBPROTOCOL_THIN     = "oracle:thin";
+    /** The thin subprotocol used by the standard Oracle driver */
+    public static final String JDBC_SUBPROTOCOL_OCI8     = "oracle:oci8";
+    /** The thin subprotocol used by the standard Oracle driver */
+    public static final String JDBC_SUBPROTOCOL_THIN_OLD = "oracle:dnldthin";
 
     /**
      * Creates a new platform instance.

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java?rev=279626&r1=279625&r2=279626&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/RunAllTests.java Thu Sep  8 14:14:09 2005
@@ -1,21 +1,22 @@
 package org.apache.ddlutils;
 
-import org.apache.ddlutils.builder.TestAxionPlatform;
-import org.apache.ddlutils.builder.TestCloudscapePlatform;
-import org.apache.ddlutils.builder.TestDB2Platform;
-import org.apache.ddlutils.builder.TestDerbyPlatform;
-import org.apache.ddlutils.builder.TestFirebirdPlatform;
-import org.apache.ddlutils.builder.TestHsqlDbPlatform;
-import org.apache.ddlutils.builder.TestInterbasePlatform;
-import org.apache.ddlutils.builder.TestMSSqlPlatform;
-import org.apache.ddlutils.builder.TestMaxDbPlatform;
-import org.apache.ddlutils.builder.TestMcKoiPlatform;
-import org.apache.ddlutils.builder.TestMySqlPlatform;
-import org.apache.ddlutils.builder.TestOracle8Platform;
-import org.apache.ddlutils.builder.TestOracle9Platform;
-import org.apache.ddlutils.builder.TestPostgresqlPlatform;
-import org.apache.ddlutils.builder.TestSapDbPlatform;
-import org.apache.ddlutils.builder.TestSybasePlatform;
+import org.apache.ddlutils.platform.TestAxionPlatform;
+import org.apache.ddlutils.platform.TestCloudscapePlatform;
+import org.apache.ddlutils.platform.TestDB2Platform;
+import org.apache.ddlutils.platform.TestDerbyPlatform;
+import org.apache.ddlutils.platform.TestFirebirdPlatform;
+import org.apache.ddlutils.platform.TestHsqlDbPlatform;
+import org.apache.ddlutils.platform.TestInterbasePlatform;
+import org.apache.ddlutils.platform.TestMSSqlPlatform;
+import org.apache.ddlutils.platform.TestMaxDbPlatform;
+import org.apache.ddlutils.platform.TestMcKoiPlatform;
+import org.apache.ddlutils.platform.TestMySqlPlatform;
+import org.apache.ddlutils.platform.TestOracle8Platform;
+import org.apache.ddlutils.platform.TestOracle9Platform;
+import org.apache.ddlutils.platform.TestPlatformUtils;
+import org.apache.ddlutils.platform.TestPostgresqlPlatform;
+import org.apache.ddlutils.platform.TestSapDbPlatform;
+import org.apache.ddlutils.platform.TestSybasePlatform;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -55,6 +56,7 @@
     {
         TestSuite suite = new TestSuite("Ddlutils tests");
 
+        suite.addTestSuite(TestPlatformUtils.class);
         suite.addTestSuite(TestAxionPlatform.class);
         suite.addTestSuite(TestCloudscapePlatform.class);
         suite.addTestSuite(TestDB2Platform.class);

Added: db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestPlatformUtils.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestPlatformUtils.java?rev=279626&view=auto
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestPlatformUtils.java (added)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/TestPlatformUtils.java Thu Sep
 8 14:14:09 2005
@@ -0,0 +1,319 @@
+package org.apache.ddlutils.platform;
+
+import org.apache.ddlutils.PlatformUtils;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the {@link org.apache.ddlutils.PlatformUtils#determineDatabaseType(String, String)}
method.
+ * 
+ * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
+ * @version $Revision: 279421 $
+ */
+public class TestPlatformUtils extends TestCase
+{
+    /** The tested platform utils object */
+    private PlatformUtils _platformUtils;
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        _platformUtils = new PlatformUtils();
+    }
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        _platformUtils = null;
+    }
+
+    // TODO: test urls for each database
+
+    public void testAxionDriver()
+    {
+        assertEquals(AxionPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("org.axiondb.jdbc.AxionDriver",
null));
+    }
+
+    public void testAxionUrl()
+    {
+        assertEquals(AxionPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:axiondb:testdb"));
+        assertEquals(AxionPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:axiondb:testdb:/tmp/testdbdir"));
+    }
+
+    public void testDb2Driver()
+    {
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.ibm.db2.jcc.DB2Driver", null));
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver",
null));
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("COM.ibm.db2.jdbc.app.DB2Driver",
null));
+        // DataDirect Connect
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.ddtek.jdbc.db2.DB2Driver",
null));
+        // i-net
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.inet.drda.DRDADriver", null));
+    }
+
+    public void testDb2Url()
+    {
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:db2://sysmvs1.stl.ibm.com:5021/san_jose"));
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:db2os390://sysmvs1.stl.ibm.com:5021/san_jose"));
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:db2os390sqlj://sysmvs1.stl.ibm.com:5021/san_jose"));
+        // DataDirect Connect
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:datadirect:db2://server1:50000;DatabaseName=jdbc;User=test;Password=secret"));
+        // i-net
+        assertEquals(Db2Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetdb2://server1:50000"));
+    }
+
+    public void testCloudscapeUrl()
+    {
+        assertEquals(CloudscapePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:db2j:net:database"));
+        assertEquals(CloudscapePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:cloudscape:net:database"));
+    }
+
+    public void testDerbyDriver()
+    {
+        assertEquals(DerbyPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("org.apache.derby.jdbc.ClientDriver",
null));
+        assertEquals(DerbyPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("org.apache.derby.jdbc.EmbeddedDriver",
null));
+    }
+
+    public void testDerbyUrl()
+    {
+        assertEquals(DerbyPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:derby:sample"));
+    }
+
+    public void testFirebirdDriver()
+    {
+        assertEquals(FirebirdPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("org.firebirdsql.jdbc.FBDriver",
null));
+    }
+
+    public void testFirebirdUrl()
+    {
+        assertEquals(FirebirdPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:firebirdsql://localhost:8080/path/to/db.fdb"));
+        assertEquals(FirebirdPlatform.DATABASENAME,
+                    _platformUtils.determineDatabaseType(null, "jdbc:firebirdsql:native:localhost/8080:/path/to/db.fdb"));
+        assertEquals(FirebirdPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:firebirdsql:local://localhost:8080:/path/to/db.fdb"));
+        assertEquals(FirebirdPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:firebirdsql:embedded:localhost/8080:/path/to/db.fdb"));
+    }
+
+    public void testHsqldbDriver()
+    {
+        assertEquals(HsqlDbPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("org.hsqldb.jdbcDriver", null));
+    }
+
+    public void testHsqldbUrl()
+    {
+        assertEquals(HsqlDbPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:hsqldb:/opt/db/testdb"));
+    }
+
+    public void testInterbaseDriver()
+    {
+        assertEquals(InterbasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("interbase.interclient.Driver",
null));
+    }
+
+    public void testInterbaseUrl()
+    {
+        assertEquals(InterbasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:interbase://localhost/e:/testbed/database/employee.gdb"));
+    }
+
+    public void testMckoiDriver()
+    {
+        assertEquals(MckoiPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.mckoi.JDBCDriver", null));
+    }
+
+    public void testMckoiUrl()
+    {
+        assertEquals(MckoiPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:mckoi:local://./db.conf"));
+        assertEquals(MckoiPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:mckoi://db.myhost.org/"));
+    }
+
+    public void testMsSqlDriver()
+    {
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.microsoft.jdbc.sqlserver.SQLServerDriver",
null));
+        // DataDirect Connect
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.ddtek.jdbc.sqlserver.SQLServerDriver",
null));
+        // JNetDirect JSQLConnect
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.jnetdirect.jsql.JSQLDriver",
null));
+        // i-net
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.inet.tds.TdsDriver", null));
+    }
+
+    public void testMsSqlUrl()
+    {
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:microsoft:sqlserver://localhost:1433"));
+        // DataDirect Connect
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:datadirect:sqlserver://server1:1433;User=test;Password=secret"));
+        // JNetDirect JSQLConnect
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:JSQLConnect://localhost/database=master/user=sa/sqlVersion=6"));
+        // i-net
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetdae:210.1.164.19:1433"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetdae6:[2002:d201:a413::d201:a413]:1433"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetdae7:localHost:1433"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetdae7a://MyServer/pipe/sql/query"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:inetdae:210.1.164.19:1433"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:inetdae6:[2002:d201:a413::d201:a413]:1433"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:inetdae7:localHost:1433"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:inetdae7a://MyServer/pipe/sql/query"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:jdbc:inetdae:210.1.164.19:1433"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:jdbc:inetdae6:[2002:d201:a413::d201:a413]:1433"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:jdbc:inetdae7:localHost:1433"));
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:jdbc:inetdae7a://MyServer/pipe/sql/query"));
+        // jTDS
+        assertEquals(MSSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:jtds:sqlserver://localhost:8080/test"));
+    }
+
+    public void testMySqlDriver()
+    {
+        assertEquals(MySqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.mysql.jdbc.Driver", null));
+        assertEquals(MySqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("org.gjt.mm.mysql.Driver", null));
+    }
+
+    public void testMySqlUrl()
+    {
+        assertEquals(MySqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:mysql://localhost:1234/test"));
+    }
+
+    public void testOracleDriver()
+    {
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("oracle.jdbc.driver.OracleDriver",
null));
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("oracle.jdbc.dnlddriver.OracleDriver",
null));
+        // DataDirect Connect
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.ddtek.jdbc.oracle.OracleDriver",
null));
+        // i-net
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.inet.ora.OraDriver", null));
+    }
+
+    public void testOracleUrl()
+    {
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:oracle:thin:@myhost:1521:orcl"));
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:oracle:oci8:@(description=(address=(host=myhost)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))"));
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:oracle:dnldthin:@myhost:1521:orcl"));
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:oracle:dnldthin:@myhost:1521:orcl"));
+        // DataDirect Connect
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:datadirect:oracle://server3:1521;ServiceName=ORCL;User=test;Password=secret"));
+        // i-net
+        assertEquals(Oracle8Platform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetora:www.inetsoftware.de:1521:orcl?traceLevel=2"));
+    }
+
+    public void testPostgreSqlDriver()
+    {
+        assertEquals(PostgreSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("org.postgresql.Driver", null));
+    }
+
+    public void testPostgreSqlUrl()
+    {
+        assertEquals(PostgreSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:postgresql://localhost:1234/test"));
+        assertEquals(PostgreSqlPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:postgresql://[::1]:5740/accounting"));
+    }
+
+    public void testMaxDbDriver()
+    {
+        assertEquals(MaxDbPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.sap.dbtech.jdbc.DriverSapDB",
null));
+    }
+
+    public void testMaxDbUrl()
+    {
+        assertEquals(MaxDbPlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:sapdb://servermachine:9876/TST"));
+    }
+
+    public void testSybaseDriver()
+    {
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.sybase.jdbc.SybDriver", null));
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.sybase.jdbc2.jdbc.SybDriver",
null));
+        // DataDirect Connect
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.ddtek.jdbc.sybase.SybaseDriver",
null));
+        // i-net
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType("com.inet.syb.SybDriver", null));
+    }
+
+    public void testSybaseUrl()
+    {
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:sybase:Tds:xyz:3767orjdbc:sybase:Tds:130.214.90.27:3767"));
+        // DataDirect Connect
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:datadirect:sybase://server2:5000;User=test;Password=secret"));
+        // i-net
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetsyb:www.inetsoftware.de:3333"));
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:inetsyb:www.inetsoftware.de:3333"));
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:inetpool:jdbc:inetsyb:www.inetsoftware.de:3333"));
+        // jTDS
+        assertEquals(SybasePlatform.DATABASENAME,
+                     _platformUtils.determineDatabaseType(null, "jdbc:jtds:sybase://localhost:8080/test"));
+    }
+}



Mime
View raw message