how can I work with Type-4 Driver?

I am confusing with the type-2 and type-4 drivers can you please explain the Driver class name, url of type-4 driver?

Type-4 driver class for oracle database



oracle is a package and jdbc and driver are sub packages.

OracleDriver is a calss.

url for type-4 driver is



jdbc is a protocol and oracle is sub protocol

thin is a logical name

localhost is a domine name

1521 is a port number

xe is a service ID

program to create student table on database by using type-4 driver

                Import java.sql.Connection;

                Import java.sql.DriverManager;

               Import java.sql.Class;

                Import java.sql.Statement;

                Class  Jdbc


                try          {


System.out.println(“driver is loaded”);

Connection con=DriverManager.getConnection                                                                                                                                                                                                                                                                       (“jdbc:oracle:thin:@localhost:1521:xe”,”system”,”manager”);   

System.out.println(“connection is created”);

Statement stmt=con.createStatement();

Int i= Stmt.executeUpdate

                              (“create table student(di number(5),name varchar2(20),marks number(5))”);

System.out.println(“table is created”);




Catch(Exception e)