File:MysqlConn.java
code:
import java.sql.*;
public class MysqlConn {
static{
try {
Class .forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.print("Sucess loading JDBC_ODBC Bridge Drive...");
}
catch (Exception e){
System.out.print("Erro loading JDBC-ODBC Bridge Driver...\n");
e.printStackTrace();
}
}
public static void main(String[] args) {
try{
Connection con1=DriverManager.getConnection("jdbc:odbc:choa_samples","root","12345");
}
catch(SQLException e){
e.printStackTrace();
}
}
}
code:
import java.sql.*;
public class MysqlConn {
static{
try {
Class .forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.print("Sucess loading JDBC_ODBC Bridge Drive...");
}
catch (Exception e){
System.out.print("Erro loading JDBC-ODBC Bridge Driver...\n");
e.printStackTrace();
}
}
public static void main(String[] args) {
try{
Connection con1=DriverManager.getConnection("jdbc:odbc:choa_samples","root","12345");
}
catch(SQLException e){
e.printStackTrace();
}
}
}
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/402/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2006-12-14 10:58
评论列表