2012年8月15日
摘要: 1 import java.sql.*; 2 public class TestTransaction { 3 4 5 public static void main(String[] args) { 6 7 Connection conn = null; 8 Statement stmt = null; 9 10 try {11 Class.forName("oracle.jdbc.driver.OracleDriver");12 conn = Dr... 阅读全文
posted @ 2012-08-15 16:08 elleniou 阅读(1852) 评论(0) 推荐(0) 编辑
摘要: 1 import java.sql.*; 2 public class TestBatch { 3 4 5 public static void main(String[] args) throws Exception { 6 Class.forName("oracle.jdbc.driver.OracleDriver"); 7 Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.1:1521:SXT", "scott", "t 阅读全文
posted @ 2012-08-15 14:14 elleniou 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 用于调用数据库的存储过程 1 import java.sql.CallableStatement; 2 import java.sql.Connection; 3 import java.sql.DriverManager; 4 import java.sql.PreparedStatement; 5 import java.sql.Types; 6 7 8 9 10 public class TestCallable {11 12 /**13 * @param args14 */15 public static void main(String[] ... 阅读全文
posted @ 2012-08-15 14:06 elleniou 阅读(521) 评论(0) 推荐(0) 编辑
摘要: 1 //一般使用方法 2 //优点在于简化sql语句的使用 3 4 5 int deptno = 0; 6 String dname = args[1]; 7 String loc = args[2]; 8 9 10 11 Connection conn = null;12 13 PreparedStatement stmt = null;14 15 Class.forName("oracle.jdbc.driver.OracleDriver");16 17 conn = DriverManager.getConnection("jdbc:oracle:thin: 阅读全文
posted @ 2012-08-15 13:49 elleniou 阅读(211) 评论(0) 推荐(0) 编辑