In order to establish a connection with DB server, first we need to know, which class is used to establish the connection. DriverManager is the class which contains the method named getConnection(). The following figure shows the syntax for this method.
Fig: method in DriverManager class that connects DBServer |
In the above diagram, observe the third syntax, it contains three parameters and it returns a Connection class object. Connection is an interface, but the class which implements this Connection interface is called as Connection class, the object of which this method returns. To store this object we should create a reference variable as follows.
- Connection con=DriverManager.getConnection("url ", " usr_name" , "psswrd" );
hi sir.
ReplyDeletethis java student i have a doubt for this established connection then i got a error message ie
G:\work>javac Createtable.java
Createtable.java:4: package oracle.jdbc.driver does not exist
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver
^
1 error
hi sir, this afrooz today i got error messages ie
ReplyDeleteG:\work>javac Createtable.java
Createtable.java:4: package oracle.jdbc.driver does not exist
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver
^
1 error
know how resolve the problems