How to add Oracle database url with SSL attributes in mule? - oracle

I want to know how to set oracle JDBC url with ssl properties in mule esb.
for mysql I came to know that we can have the url like below
jdbc:mysql://hostname:port/dataService?useSSL=true&requireSSL=true&verifyServerCertificate=true&trustCertificateKeyStoreUrl=file:\\C:\Users\ad\localhost-truststore.jks&trustCertificateKeyStorePassword=xyxyxy
For oracle can we add the properties like above (requireSSL, verifyServerCertificate, trustCertificateKeystore etc..) in url ?
The url that I have now is
jdbc:oracle:thin:${oracledb.userName}/${oracledb.password}#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=${oracledb.host})(PORT=${oracledb.port}))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=${oracledb.service})))

For Oracle JDBC driver, you can use TNSalias and add your long form of the connection URL with certificate etc., in tnsnames.ora. Later, use the property oracle.net.tns_admin=/home/myuser/cloud to specify the location of tnsnames.ora.
If you are using the latest 18.3 JDBC driver then you can pass TNS_ADMIN as part of the URL along with the TNSAlias.
jdbc:oracle:thin:#dbname_medium?TNS_ADMIN=/users/test/wallet_dbname/".
Refer to the SSL blog for more details. If you are using 18.3 JDBC driver then refer to this OTN page

Related

Tableau Other Databases (JDBC) Connection to SAS datasets

I am trying to get an Other Databases (JDBC) connection from Tableau to SAS using SAS' integrated object model (sasiom jdbc) but running into this error:
Error:
Bad Connection: Tableau could not connect to the data source.
Trying to connect an http1.x server
Generic JDBC connection error
Trying to connect an http1.x server
Configuration Details
I believe my configuration is somewhat correct so far but I think that Tableau is not identifying the correct driver class to use when making a JDBC connection to SAS.
At a high level here is what a JDBC connection to SAS looks like:
JDBC Connection String: jdbc:sasiom://companyserver.company.com:port
Driver class name: com.sas.rio.MVADriver
Driver jar files location for Tableau to access: C:\Program Files\Tableau\Drivers
In this extract below from the Tableau Desktop logs it looks like 'dialect' and 'class' being used are genericjdbc which I think I want the class to be com.sas.rio.MVADriver to use the classname for sasiom but I'm not certain
{"attributes":{":protocol-customizations":"","class":"genericjdbc","dbname":"","dialect":"genericjdbc","jdbcproperties":"","jdbcurl":"jdbc:sasiom://companyserver.company.com:8591","password":"***","schema":"","username":"username","warehouse":""},"closed-protocols-count":"0","connection-limit":"16","group-id":"3","in-construction-count":"0","protocols-count":"0","this":"0x0000018511611140"}}
Properties file attempted without success
I've tried to add a properties file to force the class to be com.sas.rio.MVADriver in the hopes that I get a connection successful or at least a different error if anything else needs to change but no luck with a properties file.
Please provide some help or direction if anyone has successfully created a custom JDBC connection in Tableau and how you got it working? What configuration steps am I missing?
Is there a way to verify that Tableau is using the correct driver class for the jdbc connection? I have not seen the correct class of com.sas.rio.MVADriver referenced at all in the Tableau logs
The answer to this question is a Type 4.0 JDBC Driver is needed to automatically register the driver class name with the JDBC driver manager. The public SAS .jar files contain a Type 2.0 JDBC Driver which requires a manual JDBC driver class specification, which Tableau does not allow to my knowledge. It appears this is not possible currently.

Oracle JDBC driver: How to use /etc/ldap.ora and only specifying SID?

I have an Oracle connection using com.oracle:ojdbc14:10.2.0.2.0 and the URL jdbc:oracle:thin:#fooe2.company.intern:1529:odse but would like to leave away the hostname and port as it may change over time. Using sqlplus I can just say "odse" and it will look the name up via /etc/ldap.ora. I know that there is a syntax where I can specify the ldap server names in the JDBC URL but I don't want that either as it may change as well.
Is it possible to have JDBC make use of the existing /etc/ldap.ora configuration and just specify the SID?

Configuring TNS Datasources in ColdFusion 8

I'm researching how to set up a Coldfusion 8 (CF) data source that uses Oracle TNS under CentOS. I checked out this Stackoverflow article. But, I'm still having some difficulty. I got a copy of our tnsnames.ora file and put it on the server at /coldfusion/install/folder/TNSNamesFolder/TNSNames.ora. I downloaded the latest Oracle JDBC drivers for 11g, put them in a folder in the class path and restarted CF. I verified that the new JAR files were picked up by viewing the settings summary. The JDBC URL I'm using is:
jdbc:oracle:thin:TNSNamesFile=/coldfusion/install/folder/TNSNamesFolder/TNSNames.ora/TNSNames.ora; TNSServerName=%TNSEntry%
But, I'm getting the following error: The Network Adapter could not establish the connection. Another issue that occurred to me is that if there's another JDBC driver for Oracle in the class path, how do I know what JAR it's in? How do I make sure that these new JDBC drivers are the only ones in use for Oracle?
JDBC URL : jdbc:macromedia:oracle:TNSNamesFile=C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\tnsnames.ora;TNSServerName=db9d1.db
Driver Class : oracle.jdbc.OracleDriver

jdbc using sqlnet.ora

I have a program that wants to make a connection to an oracle database on our network. This program is written in java and has to use jdbc. Our PC's are setup to use sqlnet.ora files to determine the order of how to resolve. All our PC's first check ldap (which the ldap file is on all these PC's pointing to the ldap server) and then secondly to use tnsnames.ora file, but this file is empty now so basically I want to use ldap, but do it via sqlnet.ora. Any ideas what the connection would look like for the url parameter?
From the JDBC Developer's Guide
The oracle.net.tns_admin system property must be set to the location of the tnsnames.ora file so that the JDBC Thin driver can locate the tnsnames.ora file. For example:
System.setProperty("oracle.net.tns_admin", "c:\\Temp");
String url = "jdbc:oracle:thin:#tns_entry";
DriverManager.getConnection(url, ...);
Because of the system property, the thin driver is able to locate the tnsnames.ora file and thus can resolve the TNS name specified in the URL. Because the thin driver is usually intended to work without an Oracle client installation, this is not enabled by default.
As far as I remember, you only need tnsnames.ora, you don't need an Oracle client when using the thin driver even when specifying a TNS name.
If your program does not allow setting system properties you have two options:
Specify it when starting your program java -Doracle.net.tns_admin=c:/foobar ...
Set an environment variable JAVA_TOOLS_OPTIONS that contains -Doracle.net.tns_admin=c:/foobar. That will then be picked up by any Java program automtically
From the Oracle JDBC FAQ
jdbc:oracle:oci:#<<TNS alias>>
where <<TNS alias>> is the LDAP entry that you would use if you were connecting via, say, SQL*Plus

How to use "basic" as connection type?

I'm able to use Oracle SQLDeveloper to make a connection to an Oracle database. I'm using "basic" as connection type and I can access database successfully. The problem is that basic authentication is the only way to access that database at the moment (there is some misconfigururation but this is another problem and can not be solved by myself).
To work around this I want to use basic authentication with JDBC. Is this possible? Can someone give me an example? I found only examples with thin or oci configuration. Both are not working for me.
Thank you very much!
From the help in SQL Developer:
Advanced connection type
Custom JDBC URL: URL for connecting directly from Java to the
database; overrides any other connection type specification. If you
are using TNS or a naming service with the OCI driver, you must
specify this information: Example:
jdbc:oracle:thin:scott/#localhost:1521:orcl
Note that in this example, the "/" is required, and the user will be
prompted to enter the password. I actually wasn't prompted for p/s see notes below
To use a custom JDBC URL, the system on which SQL Developer is running
must have an Oracle Client installation that contains the JDBC and
orai18n libraries, is present on the path, and is version 10.2 or
later.
So all you need to do is select the "Advanced" connection Type, then input the below line (changed to your settings)
jdbc:oracle:thin:USER/#HOST:PORT:SID
but it will also work (and use the Username/Password already inputted) if you omit the "User/" as such
jdbc:oracle:thin:#HOST:PORT:SID
It seems to use the password that is already in the "Password" box in the Database Connection.
If this does not work for you, post how it does not work. I tried the connections from "Basic", TNSNames, and Advanced (using the THIN client) without incident- take note of the using a custom JDBC URL, but I would have to ask why if that is the intent?
hth
There was no mistake in configuration. But there was a problem with the cluster (cluster switched to the other node). I can't understand this behaviour and I can't reproduce it anymore, but it's working again now. Thanks for your help!

Resources