This blog explains how to connect to the Oracle10g database in Java. (u can use netbeans as well then no need of classpath) Connect To Oracle10g database In Java There are 5 steps to create a connection with an Oracle10g database in Java. First register the driver class Create the connection Create a statement Execute queries Close the connection 1. First, register the driver class The class.forName() method of the class registers the driver class. Syntax public static void forName(String classname) throws ClassNotFoundException Example Class.forName("oracle.jdbc. driver.OracleDriver"); 2. Create the connection object The getConnection() method of the DriverManager class establishes the connection with the Oracle database. Syntax public static Connection getConnection(String url) throws Exception public static Connection getConnetion(String name, String url, String password) Example Connection connection=DriverManager. getConnectio...
Comments
Post a Comment