Thursday, March 19, 2009

jdbc-connection-example





import java.sql.*;
class TransDemo
{
public static void main(String[] args)throws Exception
{
// Register the driver,In this case oracle thin driver

Class.forName("oracle.jdbc.driver.OracleDriver");

// getting connection object by passing URL, username,password

Connection con=DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:xe","system","chandru");

System.out.println(" Connected 2 DB.....");


}
}





0 comments:

Post a Comment