文件名称:踩踩踩JDBC六大步骤
文件大小:4KB
文件格式:TXT
更新时间:2013-11-02 09:44:13
jdbc
1、JDBC编程六大步: 1)注册driver 1.class.forName(driver) 2.new oracle.jdbc.driver.OracleDriver(); 3.java -Djdbc.drivers=oracle.jdbc.driver.OracleDriver jdbc.drivers=System.gerProperties(); 2)获得Connection 1.conn = DriverManager.getConnection(url.userName,passwd); 2.driver.conn(url,properties); 3)获得Statement 简单的Statement: conn.createStatement(); PrepareStatement: conn.prepareStatement(String sql); CallableStatement: conn.prepareCall(String sql); 4)执行sql语句 stmt.execute(sql); stmt.executeUpdate(sql); stmt.executeQuery(sql); pstmt.execute*(); 5)获得并处理结果集