How to connect to Oracle using Service Name instead of SID?

0 votes

I have a Java application that uses JDBC (via JPA) that was connecting to a development database using hostname, port and Oracle SID. But is there other way to connect to Oracle using Service Name?

Jun 27, 2018 in Java by Daisy
• 8,050 points
1,625 views

1 answer to this question.

0 votes

Thin-style service names are supported only by the JDBC Thin driver. The syntax is:

@//host_name:port_number/service_name
jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL=TCP)(HOST=blah.example.com)(PORT=1521)))(CONNECT_DATA=(SID=BLAHSID)(GLOBAL_NAME=BLAHSID.WORLD)(SERVER=DEDICATED)))
answered Jun 27, 2018 by sharth
• 3,320 points

Related Questions In Java

0 votes
1 answer

How to get the name of the currently executing method?

Thread.currentThread().getStackTrace() will usually contain the method you’re ...READ MORE

answered Jul 5, 2018 in Java by Daisy
• 8,050 points
20 views
0 votes
1 answer

How to print factorial of a number using While loop?

While also works like for just you ...READ MORE

answered Nov 22, 2018 in Java by Namitha
39 views
0 votes
3 answers

How to read input from Console using Scanner Class?

A simple example: import java.util.Scanner; public class Expl { ...READ MORE

answered Jul 31, 2018 in Java by samarth295
• 2,190 points
299 views
0 votes
2 answers

How can I invoke a method when the method name is in the form of a given string?

You could probably use method invocation from reflection: Class<?> ...READ MORE

answered Aug 19 in Java by Sirajul
• 25,220 points
55 views
0 votes
1 answer

What is the difference between oracle JDK and open JDK

Both OpenJDK and Oracle JDK are created ...READ MORE

answered Jul 10, 2018 in Java by Akrati
• 3,150 points
249 views
0 votes
2 answers

How to prepare for Oracle Certified Associate Java Programmer Exam?

Join an Online Course  As I would like ...READ MORE

answered Sep 9 in Career Counselling by Sirajul
• 25,220 points
16 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,380 points

edited Nov 6, 2018 by Omkar 8,040 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,090 points
1,965 views
0 votes
1 answer

How to get the IP address of the machine using Java?

One approach is to use NetworkInterface.getNetworkInterfaces() to get all ...READ MORE

answered Jun 25, 2018 in Java by sharth
• 3,320 points
37 views
0 votes
1 answer

How to convert a string representation of a hex dump to a byte array using Java?

public static byte[] hexStringToByteArray(String s) { ...READ MORE

answered Sep 26, 2018 in Java by sharth
• 3,320 points
151 views