Simple JDBC tutorial

Simple JDBC tutorial .

  1.  load jdbc driver
     Class.forName("oracle.jdbc.OracleDriver");
  2. create a connection to database 
    1. Connection conn = java.sql.DriverManager.getConnection(url, username, password);
    2. url is jdbc:oracle:thin:@localhost:1521:orcl
  3. create statement
    1. Statement  stmt = this.conn.createStatement();
  4. execute query
    1. stmt.executeUpdate(query);
  5. iterate over ResultSet

Comments

Popular posts from this blog

Implementing Custom ResultType in Struts2

Strings in Java