// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
package testprep;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class TestPrep1 {
    public static void main(String[] args) throws Exception {
        Class.forName("oracle.jdbc.OracleDriver");
        Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "arne", "xxxx");
        PreparedStatement pstmt = con.prepareStatement("INSERT INTO tt VALUES (?, ?)");
        pstmt.setInt(1, 123);
        pstmt.setString(2, "Hansen");
        pstmt.executeUpdate();
        pstmt.setInt(1, 124);
        pstmt.setString(2, "O'Toole");
        pstmt.executeUpdate();
        pstmt.close();
        con.close();
    }
}
