STEPS TO CONNECT TO DATABASE USING JDBC (T ype 4 driver) In this post I will show you how to connect to a database using JDBC. STEP 1) Load the Database driver In this step of the jdbc connection process, we load the driver class by calling Class.forName() with the Driver class name as an argument. Once loaded, the Driver class creates an instance of itself and registers it with the DriverManager. A client can connect to Database Server through JDBC Driver. The return type of the Class.forName (String ClassName) method is “Class”. Class is a class in java.lang package try{ Class.forName(”oracle.jdbc.Driver.OracleDriver”); // This is type 4 driver } catch(Exception x) { System.out.println( “Unable to load the driver class!” ); } STEP 2) Establish...
Posts
Showing posts with the label STEPS TO CONNECT TO DATABASE USING JDBC
- Get link
- X
- Other Apps
STEPS TO CONNECT TO DATABASE USING JDBC (T ype 4 driver) Software Required: 1)Oracle 11g Express Edition: For downloading and installing refer--> LINK 2) Eclipse IDE: I have used Juno,you can use any other version.For download link and information refer---> LINK 3) Oracle Driver (ojdbc6.jar file): download from here---> LINK NOTE: For JDBC we need a table in the database to work with.When you install 11g, HR schema is automatically created.We will use the LOCATIONS table for this tutorial. HR schema is locked by default. To unlock it you can login as system (When you started installing oracle ,it asked for global database name and database password that password is used for the sys, system, sysman, dbsnmp account .) 1. Try to login as "system" - pass SQL> conn system/password; 2. Unlock "hr" ...
JDBC TUTORIAL
- Get link
- X
- Other Apps
What is JDBC? A JDBC driver is a software component enabling a Java application to interact with a database.It is a specification that tells vendor how to write a driver program to interface java program with their database. The JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database. JDBC helps you to write Java applications that manage these three programming activities: 1. Connect to a data source, like a database 2. Send queries and update statements to the database 3. Retrieve and process the results received from the database in answer to your query What are we going to cover in this tutorial?? * JDBC Architecture * Types Of JDBC Drivers * Ste...