cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r526553 - in /cayenne/main/trunk: docs/doc/src/main/resources/RELEASE-NOTES.txt framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java
Date Sun, 08 Apr 2007 13:35:33 GMT
Author: aadamchik
Date: Sun Apr  8 06:35:32 2007
New Revision: 526553

URL: http://svn.apache.org/viewvc?view=rev&rev=526553
Log:
CAY-775 AutoAdapter fails to detect Sybase when running with jTDS driver 3.0

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?view=diff&rev=526553&r1=526552&r2=526553
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Sun Apr  8 06:35:32 2007
@@ -89,6 +89,7 @@
 CAY-754 Local jNDI hack breaks when running with Jetty6-Maven
 CAY-764 Exception when importing an EOModel with single table inheritance
 CAY-765 Programmatically overriding "use share cache" fails
+CAY-775 AutoAdapter fails to detect Sybase when running with jTDS driver
 
 API Changes
 ----------------------------------

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java?view=diff&rev=526553&r1=526552&r2=526553
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java
Sun Apr  8 06:35:32 2007
@@ -33,10 +33,20 @@
  */
 public class SybaseSniffer implements DbAdapterFactory {
 
-    public DbAdapter createAdapter(DatabaseMetaData md) throws SQLException {
-        String dbName = md.getDatabaseProductName();
-        return dbName != null && dbName.toUpperCase().indexOf("ADAPTIVE SERVER")
>= 0
-                ? new SybaseAdapter()
-                : null;
+    public DbAdapter createAdapter(DatabaseMetaData md) throws SQLException {    	
+    	// JTDS driver returns "sql server" for Sybase, so need to handle it differently
+    	String driver = md.getDriverName();
+    	if(driver != null && driver.toLowerCase().startsWith("jtds")) {
+    		String url = md.getURL();
+    		return url != null && url.toLowerCase().startsWith("jdbc:jtds:sybase:")
+    		        ? new SybaseAdapter()
+                    : null;
+    	}
+    	else {
+            String dbName = md.getDatabaseProductName();
+            return dbName != null && dbName.toUpperCase().indexOf("ADAPTIVE SERVER")
>= 0
+                    ? new SybaseAdapter()
+                    : null;
+    	}
     }
 }



Mime
View raw message