Tuesday, January 15, 2008

Steps required to implement a Java Database Program

STEP 1: Loading Drivers
Class.ForName("sun.jdbc.odbc.JdbcOdbcDriver")

STEP 2: Making the Connection
Connection conn = DriverManager.getConnection("jdbc:odbc:");

STEP 3: Creating JDBC Statements
Statement stmt = conn.createStatement();

STEP 4: Executing the Statement
ResultSet rs = stmt.executeQuery("select * from student");

STEP 5: Looping through the ResultSet
System.out.println(rs.getInt("ID"));

STEP 6: Closing the Connection and Statement Objects
conn.close()
stmt.close()

Thanks & Regards
Nidhika

2 comments:

oracle-freak said...

Hi Nidhika, Welcome to Bloggers World ! :)
Really good explaination in simple words..
Keep it up!

Moses Paik said...

Well, can we have some more posts which would help us though.