cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r526551 - in /cayenne/main/branches/STABLE-2.0/cayenne: cayenne-java/src/cayenne/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt
Date Sun, 08 Apr 2007 13:31:26 GMT
Author: aadamchik
Date: Sun Apr  8 06:31:25 2007
New Revision: 526551

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

Modified:
    cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java
    cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt

Modified: cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java?view=diff&rev=526551&r1=526550&r2=526551
==============================================================================
--- cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java
(original)
+++ cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/dba/sybase/SybaseSniffer.java
Sun Apr  8 06:31:25 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;
+    	}
     }
 }

Modified: cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt?view=diff&rev=526551&r1=526550&r2=526551
==============================================================================
--- cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt
(original)
+++ cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt
Sun Apr  8 06:31:25 2007
@@ -23,6 +23,7 @@
 CAY-764 Exception when importing an EOModel with single table inheritance
 CAY-765 Programmatically overriding "use share cache" fails
 CAY-774 cayenne-modeler pom.xml has incorrect dependancy
+CAY-775 AutoAdapter fails to detect Sybase when running with jTDS driver
 
 ----------------------------------
 Release: 2.0.2



Mime
View raw message