Can anyone please tell me whether the host string field that is used when logging in from Sqlplus has any role in jdbc?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This depends on the database specifier used in the JDBC URL. For most purposes, the host string (or more correctly known as the net service name) is not usually not required, for the entries in the tnsnames.ora file is not read when determining the Oracle instance to connect to. Most developers using JDBC, use database URL schemes that do not require this.
The information about the Oracle database service is typically read from the JDBC URL itself, which in the case of Oracle, has the following notation:
The username and password is optional; there are other means to specify the username and password. The driver utilizes the information specified in the database specifier field to determine the location of the Oracle listener, hence absolving the need to have a separate Oracle home with explicit connect descriptors to locate a database service.
The Oracle Database JDBC Developer’s Guide lists all possible database specifiers that can be used. In most scenarios, the thin-style service name syntax is used, where the net service name is not required (and the actual service name of the database would be specified). The only exception is the case where a
TNSNames aliashas been specified in the source code, and the location of thetnsnames.orafile has been specified using theoracle.net.tns_adminproperty.