IConnectionInfo.getJdbcUrl() and IConnectionInfo.getDriverName() Methods Return NULL for ODI 12c Hive Data Servers
(Doc ID 2529574.1)
Last updated on APRIL 15, 2021
Applies to:
Oracle Data Integrator - Version 12.2.1.3.181204 and laterInformation in this document applies to any platform.
Symptoms
Using Oracle Data Integrator (ODI) 12c SDK and a Groovy script to get the Data Server information for Hive technologies returns Null values.
Example of SDK Groovy script used:
import com.sunopsis.dwg.DwgObject;
import groovy.sql.Sql;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.sql.Connection;
import java.sql.SQLException;
import oracle.odi.core.config.MasterRepositoryDbInfo;
import oracle.odi.core.config.WorkRepositoryDbInfo;
import oracle.odi.core.OdiInstance;
import oracle.odi.core.config.OdiInstanceConfig;
import oracle.odi.core.config.PoolingAttributes;
import oracle.odi.core.persistence.transaction.support.DefaultTransactionDefinition;
import oracle.odi.domain.runtime.scenario.finder.IOdiScenarioFinder;
import oracle.odi.domain.runtime.scenario.OdiScenario;
import oracle.odi.domain.topology.finder.IOdiDataServerFinder;
import oracle.odi.domain.topology.OdiDataServer;
import oracle.odi.domain.topology.OdiHadoopDataServer;
import oracle.odi.domain.adapter.topology.IConnectionInfo;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.Configuration;
import static java.util.Calendar.DATE;
import static java.util.Calendar.MONTH;
import static java.util.Calendar.YEAR;
File file = new File("/tmp/groovy_out.txt")
file.write "First line\n"
file.append System.getProperty('java.class.path')
String Url1 = ConnInfo.getJdbcUrl();
String Driver1 = ConnInfo.getDriverName();
// Repository info
def Url = "jdbc:oracle:thin:@<HOSTNAME>:<PORT>/<SERVICE_NAME>"
def Driver = "o<JDBC DRIVER CLASS>"
def Master_User = "<MASTER DATABASE SCHEMA>"
def Master_Pass = "<MASTER DATABASE PASSWORD>"
def WorkRep = "<WORK REPOSITORY NAME>"
def Odi_User = "<ODI USER WITH SUPERVISOR ROLE>"
def Odi_Pass = "<ODI USER PASSWORD>"
// Connect to repository
def masterInfo = new MasterRepositoryDbInfo(Url, Driver, Master_User, Master_Pass.toCharArray(), new PoolingAttributes())
def workInfo = new WorkRepositoryDbInfo(WorkRep, new PoolingAttributes())
def odiInstance = OdiInstance.createInstance(new OdiInstanceConfig(masterInfo, workInfo))
def auth = odiInstance.getSecurityManager().createAuthentication(Odi_User, Odi_Pass.toCharArray())
odiInstance.getSecurityManager().setCurrentThreadAuthentication(auth)
// Get DataServer
IOdiDataServerFinder DataServerFinder = (IOdiDataServerFinder) odiInstance.getTransactionalEntityManager().getFinder(OdiDataServer.class);
OdiDataServer DataServer = DataServerFinder.findByName("<NAME OF THE HIVE DATA SERVER>");
IConnectionInfo ConnInfo = DataServer.getConnectionInfo();
// Get DataServer Data
String Url1 = ConnInfo.getJdbcUrl();
String Prov = ConnInfo.getProviderUrl();
String Driver1 = ConnInfo.getDriverName();
String User = DataServer.getUsername();
String Pass = DwgObject.snpsDecode(DataServer.getPassword().toString(), odiInstance).toString();
file.append "\nConnection info: "+ ConnInfo
file.append "\nJDBC: "+ ConnInfo.isJdbcConnection();
file.append "\n Technology: "+DataServer.getTechnology();
file.append "\nJNDI: "+ ConnInfo.isJndiConnection();
file.append "\nProperties: " + ConnInfo.getConnectionProperties();
file.append "\nUrl: "+ Url1
file.append "\nProv: "+ Prov
file.append "\nDriver: "+Driver1
file.append "\nUser: " + User
file.append "\nPassword: " + Pass
//Sql sql_dtping = Sql.newInstance(Url1, User, Pass, Driver1);
Upon execution of the script, an output file named "groovy_out.txt" will be generated under "/tmp" directory, and will show NULL values for Url, Prov and Driver fields.
Changes
Cause
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Symptoms |
Changes |
Cause |
Solution |
References |