import java.sq.*;
Connection conn = null;
Statement stmt;
ResultSet rs;
String sql = "select * from tab " ;
//con = DriverManager.getConnection("jdbc:poolman://tgpms-help");
//连接Oracle数据库
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.15.248:1521:ycdb","webcfcquery","kill859");
//连接Mysql数据库
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/meeting","root","21century");
stmt = con.createStatement();
rs = stmt.executeQuery(sql);
rs.close();
stmt.close();
con.close();
本文地址:http://com.8s8s.com/it/it14911.htm