ojdbc Oracle Driver Connection URL String

Q

What is the correct format ojdbc Oracle Driver Connection URL string? I am getting exceptions when calling the DriverManager.getConnection(url) method.

✍: FYIcenter.com

A

When you are calling the DriverManager.getConnection(url) method to establish a connection to a Oracle database through the ojdbc Oracle Driver, you have to provide the connection URL string as the input in a correct format:

jdbc:oracle:thin:<user/password>@<server>:<port>:SID
jdbc:oracle:thin:<user/password>@//<server>[:<port>]/SID

Here is the explanation of different parts in the connection URL string:

  • <user/password> - The value must be the user name and password of the account given on the Oracle database server.
  • <server> - The value must be the server name, with domain name if needed, where the database service is running. You can also use IP address of the server too.
  • <port> - The value should be the port number where the database server is listening to connection requests. This part is optional. If not specified, the ojdbc driver will use the default port: 1521.
  • <SID> - The value must be the System ID of the Oracle server database instance.

 

Examples for ojdbc.jar - JDBC Driver for Oracle

⇒⇒FAQ for ojdbc.jar - JDBC Driver for Oracle

2018-03-13, 566👍, 0💬