没装sysbase,jdbc怎么直接连它的db数据库? 如题,不用ODBC桥接,可以做到吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 com.sybase.jdbc2.jdbc.SybDriverjdbc:sybase:Tds:localhost:2638 lz问题没说清楚sybase anywhere 的数据文件,可能只能通过odbc public void OpenSybase() { try { Class.forName("com.sybase.jdbc3.jdbc.SybDriver").newInstance(); String url = "jdbc:sybase:Tds:x.x.x.x:5000?charset=cp936"; Properties sysProps = System.getProperties(); sysProps.put("user", "xxxxxx"); sysProps.put("password", "xxxxxx"); conn = DriverManager.getConnection(url, sysProps); } catch (Exception ex) { ex.printStackTrace(); } } 你要下载支持jdbc连接到sybase的包 4楼的说得是对的,我没有把问题说清。因为我没有用过sybase,只知道db文件是sybase的数据库。查下来才知道它是一个Sybase sql anywhere的数据文件我在网上找了一下,应该是这样对于JDBC有两种连接方法,一种是用Sybase Jconnect,另外一个是用iAnywhere的JDBC。 JConnect不能实现此功能,因为JConnect用的是TCP/IP的TDS通讯方法。 iAnywhere的JDBC的包在%ASANY9%\java\jodbc.jar。 ----------------------------------------------------------------------------- import java.sql.*; public class TestIasJdbc { public static String DB_DIR = "c:/program files/sqlanywhere 9"; public static void main(String args[]) { try { String driver, url; Connection conn; driver="ianywhere.ml.jdbcodbc.IDriver"; url = "jdbc:odbc:driver=Adaptive Server Anywhere 9.0" + ";uid=DBA;pwd=SQL;dbf=" + DB_DIR + "/asademo.db"; Class.forName( driver ); conn = DriverManager.getConnection( url ); if ( conn != null ) { System.out.println("connected"); System.exit(0); } else { System.out.println("connection failed!"); System.exit(10); } } catch (Exception ex) { System.out.println( ex.getMessage() ); } } 还没有试过,大家有用过的吗 将十六进制字符串不能转,直接存到byte[]里面? 请问如果想退出递归,但是不退出程序,有什么好方法?谢谢 求救,关于prefuse 布局对象调用方法不懂? 哪位有连接池的源代码,大的小的都无所谓。刚才网上搜了一下,没找到。顺便散点分,呵呵 怎样不执行就解析出一句sql语法是正确的?? NullPointerException麻烦大家给看看这个程序(有原代码)编译可以通过,运行抛出异常 面向对象求教!!! 怎么用自已写的类包。我用不起! 编译过了,运行不行。 连接ORACLE问题 spring junit 测试
jdbc:sybase:Tds:localhost:2638
sybase anywhere 的数据文件,可能只能通过odbc
public void OpenSybase() {
try {
Class.forName("com.sybase.jdbc3.jdbc.SybDriver").newInstance();
String url = "jdbc:sybase:Tds:x.x.x.x:5000?charset=cp936";
Properties sysProps = System.getProperties();
sysProps.put("user", "xxxxxx");
sysProps.put("password", "xxxxxx"); conn = DriverManager.getConnection(url, sysProps);
} catch (Exception ex) {
ex.printStackTrace();
}
}
我在网上找了一下,应该是这样对于JDBC有两种连接方法,一种是用Sybase Jconnect,另外一个是用iAnywhere的JDBC。
JConnect不能实现此功能,因为JConnect用的是TCP/IP的TDS通讯方法。
iAnywhere的JDBC的包在%ASANY9%\java\jodbc.jar。
-----------------------------------------------------------------------------
import java.sql.*;
public class TestIasJdbc {
public static String DB_DIR = "c:/program files/sqlanywhere 9";
public static void main(String args[]) {
try {
String driver, url;
Connection conn;
driver="ianywhere.ml.jdbcodbc.IDriver";
url = "jdbc:odbc:driver=Adaptive Server Anywhere 9.0"
+ ";uid=DBA;pwd=SQL;dbf=" + DB_DIR
+ "/asademo.db";
Class.forName( driver );
conn = DriverManager.getConnection( url );
if ( conn != null ) {
System.out.println("connected");
System.exit(0);
} else {
System.out.println("connection failed!");
System.exit(10);
}
} catch (Exception ex) {
System.out.println( ex.getMessage() );
}
}
还没有试过,大家有用过的吗