Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Properties prop = new Properties();
prop.setProperty("user","你的登陆用户名");
prop.setProperty("password","你的登陆密码");
con=DriverManager.getConnection("jdbc:odbc:Salary",prop);
Properties prop = new Properties();
prop.setProperty("user","你的登陆用户名");
prop.setProperty("password","你的登陆密码");
con=DriverManager.getConnection("jdbc:odbc:Salary",prop);
例如,我们指定为:
String constr = "jdbc:mysql://192.168.0.166:3306/test";
//这里的mysql是一种子协议,192.168.0.166是数据库所在主机的IP,3306是端口,test是数据库名
ODBC 的数据源 :jdbc:odbc:dateSource
MySql: jdbc:mysql://server[:port]/dateName;
Oracle : jdbc:oracle:thin:@server:port:instance_name;