日期:2014-05-16 浏览次数:20401 次
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=gbk&zeroDateTimeBehavior=convertToNull";
Connnection conn = DriverManager.getConnection(url, username, password);
Statement stmt = conn.createStatement();
CallableStatement call = conn.prepareCall(sql);
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){ System.out.println(rs.getString(1)); }
rs.close(); stmt.close(); conn.close();