We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

indianocean on 11/13/06


Tagged

jdbc


Versions (?)


Prepared Statement


Published in: Java 


  1. DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
  2. Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@<SERVER>:1521:<SID>", "<user>", "<pwd>");
  3.  
  4. PreparedStatement pStatement = conn.prepareStatement("insert into tmp (VARC, UNGS) values (?, ?)");
  5.  
  6. pStatement.setString(1, "test");
  7. pStatement.setInt(2, 1);
  8. pStatement.execute();
  9. pStatement.close();

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: mabo on November 14, 2006

std PreparedStatement var name is ps

You need to login to post a comment.