Bug 836664

Summary: RHQ Oracle Plugin only connects to via SID, not Service Name
Product: [Other] RHQ Project Reporter: Richard Hensman <richard>
Component: PluginsAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: low Docs Contact:
Priority: high    
Version: 4.4CC: hrupp, mazz
Target Milestone: ---   
Target Release: RHQ 4.5.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-01 06:16:54 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
Patch to fix issue none

Description Richard Hensman 2012-06-29 16:57:25 EDT
RHQ Oracle Plugin only connects to via SID, not Service Name
Comment 1 Richard Hensman 2012-06-29 16:59:23 EDT
Created attachment 595366 [details]
Patch to fix issue

Updated the RHQ Oracle plugin so that it will connect to an Oracle database via a Service Name as well as a SID
Comment 2 Charles Crouch 2012-07-02 10:57:12 EDT
Assuming we have Richard's fedora account info lets try and get this into rhq4.5.
Comment 3 Heiko W. Rupp 2012-07-03 03:50:35 EDT
Fedora user id is richardhensman
Comment 4 Heiko W. Rupp 2012-07-03 08:08:06 EDT
I may miss something, but those two alternatives look pretty identical to me. 
Shouldn't the part after "else" be different and somehow pass the service name?

+        if ( configuration.getSimpleValue("connectionMethod", 
"SID").equals("SID")) {
+            return "jdbc:oracle:thin:@" + configuration.getSimpleValue("host", 
"localhost") + ":"
+                + configuration.getSimpleValue("port", "1521") + ":" + 
configuration.getSimpleValue("sid", "XE");
+        } else {
+            return "jdbc:oracle:thin:@" + configuration.getSimpleValue("host", 
"localhost") + ":"
+                + configuration.getSimpleValue("port", "1521") + "/" + 
configuration.getSimpleValue("sid", "XE");
Comment 5 Richard Hensman 2012-07-03 08:41:07 EDT
The different in the slash '/' in the url when using a service name, and colon ':' when using a sid
Comment 6 Heiko W. Rupp 2012-07-03 14:13:07 EDT
Right - holy cow, I think I need glasses, coffee, sleep or beer :-)

Thanks
  Heiko
Comment 7 John Mazzitelli 2012-07-03 15:08:31 EDT
(In reply to comment #4)
> I may miss something, but those two alternatives look pretty identical to
> me. Shouldn't the part after "else" be different and somehow pass the service
> name?

As Richard mentions, the "/" is new - replaces the ":"

See the following:

http://docs.oracle.com/cd/B14117_01/java.101/b10979/urls.htm#BEIDHCBA

http://www.rojotek.com/blog/2008/01/04/oracle-sid-service_name/

Note that the oracle docs say double slashes should follow the @:

   Thin-style service names are supported only by the Thin driver. The syntax is:
   @//host_name:port_number/service_name

I'll make that change before committing, just to be consistent with how Oracle says it should be.
Comment 8 John Mazzitelli 2012-07-03 16:08:46 EDT
git commit to master: fc82a357767f64e22356588cb5645f17fa626fc0

when using "Service Name" connection method, the JDBC URL to be used will be:

   jdbc:oracle:thin:@//<hostname>:<port>/<serviceName>

If "SID" is the connection method used, the JDBC URL is the same as it has always been:

   jdbc:oracle:thin:@<hostname>:<port>:<sid>

If an existing/legacy OracleServer is in inventory (and hence its plugin configuration does NOT have a connectionMethod property) then we assume a default of SID connection method and that latter JDBC URL format is still used.
Comment 9 Heiko W. Rupp 2013-09-01 06:16:54 EDT
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.