1 19 20 package org.apache.cayenne.dba.sybase; 21 22 import java.sql.DatabaseMetaData ; 23 import java.sql.SQLException ; 24 25 import org.apache.cayenne.dba.DbAdapter; 26 import org.apache.cayenne.dba.DbAdapterFactory; 27 28 34 public class SybaseSniffer implements DbAdapterFactory { 35 36 public DbAdapter createAdapter(DatabaseMetaData md) throws SQLException { 37 String driver = md.getDriverName(); 39 if(driver != null && driver.toLowerCase().startsWith("jtds")) { 40 String url = md.getURL(); 41 return url != null && url.toLowerCase().startsWith("jdbc:jtds:sybase:") 42 ? new SybaseAdapter() 43 : null; 44 } 45 else { 46 String dbName = md.getDatabaseProductName(); 47 return dbName != null && dbName.toUpperCase().indexOf("ADAPTIVE SERVER") >= 0 48 ? new SybaseAdapter() 49 : null; 50 } 51 } 52 } 53 | Popular Tags |