Bug 836664 - RHQ Oracle Plugin only connects to via SID, not Service Name
Summary: RHQ Oracle Plugin only connects to via SID, not Service Name
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Plugins
Version: 4.4
Hardware: All
OS: All
high
low
Target Milestone: ---
: RHQ 4.5.0
Assignee: John Mazzitelli
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-29 20:57 UTC by Richard Hensman
Modified: 2013-09-01 10:16 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-01 10:16:54 UTC
Embargoed:


Attachments (Terms of Use)
Patch to fix issue (3.05 KB, patch)
2012-06-29 20:59 UTC, Richard Hensman
no flags Details | Diff

Description Richard Hensman 2012-06-29 20:57:25 UTC
RHQ Oracle Plugin only connects to via SID, not Service Name

Comment 1 Richard Hensman 2012-06-29 20:59:23 UTC
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 14:57:12 UTC
Assuming we have Richard's fedora account info lets try and get this into rhq4.5.

Comment 3 Heiko W. Rupp 2012-07-03 07:50:35 UTC
Fedora user id is richardhensman

Comment 4 Heiko W. Rupp 2012-07-03 12:08:06 UTC
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 12:41:07 UTC
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 18:13:07 UTC
Right - holy cow, I think I need glasses, coffee, sleep or beer :-)

Thanks
  Heiko

Comment 7 John Mazzitelli 2012-07-03 19:08:31 UTC
(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 20:08:46 UTC
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 10:16:54 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.