jdbc
step 1: Get the Connection object.
step 2: Get the Statement object.
step 3: Bind the parameters to SQL query.
step 4: Execute the SQL query.
step 5: Process the result.
step 6: Close the connections and take care of exceptions.
example code: /*using Oracle express edition and username: sys and pwd: rt*/
import java.sql.*;
public class JdbcDemo {
try {
Class.forName(“oracle.jdbc.driver.OracleDriver”);
Connection c;
c=DriverManager.getConnection(“jdbc:oracle:thin@localhost:1521:XE”,”sys”,”rt”);
Statement s=c.CreateStatement();
s.executeUpdate(“insert into emp values(100,’abc’);
ResultSet rs=s.executeQuery(“select * from emp”);
System.out.println(rs);
c.close();
}catch(Exception e){
System.out.println(e);
}
}
}
Yep.... I couldn't have said it better myself......