Reputation: 2387
I'm writing a Groovy/Grails application that will be connecting to an Oracle database that uses TNS names for resolving the actual host. The problem I'm running into is trying to figure out the connection string (called the url in the DataSource.groovy file). I've tried Googling examples, but all the examples I've found so far include the host name, something that I want to avoid since I've been told that this database uses TNS names so that the host can change and the various apps that connect to it won't need to be updated with the new host name.
If someone can provide an example or link that would help me create a connection string using the following details that would be much appreciated.
TNS name: TEST
Username: User
Password: Password
Upvotes: 0
Views: 748
Reputation: 3556
You have to have the host name and the port of the machine that has the listener at least. The actual DB host will be in the TNS file and can be changed without having to change the url string.
jdbc:oracle:thin:User/Password@//myhost:1521/TEST
Upvotes: 0