Saturday, June 18, 2011

Oracle DB Test Client

public class Test{
public static void main(String[] args) {
try {
Connection con=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:database_name",
"username",
"password");
Statement s=con.createStatement();
s.execute("
INSERT INTO EMP VALUES
('1', 'William')
");
s.close();
con.close();
} catch(Exception e){e.printStackTrace();}
}
}