Opening a database connection:
The database connection should be established after registering the drivers. The getConnection is used to open a database connection. The following code illustrates this: Connection con; con = DriverManager.getConnection(url,"scott","tiger");// returns the connection object where url specifies the database server port, ip address,domain name etc. For ex: jdbc:oracle:thin:@126.96.36.199:1221:MyCompany the ip address is an imaginary one and not intended to specify any specific system. The “scott” and “tiger” are the user name and passwords respectively.