七郎's JavaBlog

草木竹石皆可為劒。至人之用人若鏡,不將不迎,應而不藏,故能勝物而不傷。
posts - 60, comments - 14, trackbacks - 0, articles - 0

SQL SERVER,ORACLE,MYSQL数据库直连

Posted on 2008-04-22 22:16 七郎归来 阅读(224) 评论(0)  编辑  收藏

 

//SQL_Server:

String driver 
= "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String url 
= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test";
String user 
= "sa";
String password 
= "";


//Oracle:

String driver 
= "oracle.jdbc.driver.OracleDriver";
String url 
= "jdbc:oracle:thin:@localhost:1521:wanchao";
String user 
= "scott";
String password 
= "tiger";


//mysql
String driver="com.mysql.jdbc.Driver";
String url
="jdbc:mysql://localhost:3306/chinabank?useUnicode=true&characterEncoding=GBK";
String user
="root";
String passeord
="root";

Class.forName(driver);
con 
= DriverManager.getConnection(url,user,password);

只有注册用户登录后才能发表评论。


网站导航: