- package com.oimacademy.connection;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import com.oimacademy.properties.OIMProfileReader;
- public class DataSource {
- private static Connection connectionObject = null;
- private static OIMProfileReader properties=null;
- static String JDBC_DRIVER = null;
- static String DB_URL = null;
- static String USER = null;
- static String PASS = null;
- private static Connection makeConnection() {
- try {
- properties = new OIMProfileReader();
- JDBC_DRIVER=properties.getString("operationsDB.directDBdriver");
- DB_URL=properties.getString("operationsDB.jdbcUrl");
- USER=properties.getString("operationsDB.user");
- PASS=properties.getString("operationsDB.password");
- Class.forName(JDBC_DRIVER);
- System.out.println("Connecting to database...");
- System.out.println("DB User Name -> "+DB_URL);
- System.out.println("DB URL -> "+USER);
- connectionObject = DriverManager.getConnection(DB_URL, USER, PASS);
- } catch (SQLException se) {
- se.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return connectionObject;
- }
- public static synchronized Connection getConnection() {
- if (connectionObject == null) {
- connectionObject = makeConnection();
- }
- return connectionObject;
- }
- public static void closeConnection() {
- System.out.println("Closing to database connection ...");
- try {
- properties=null;
- JDBC_DRIVER=null;
- DB_URL=null;
- USER=null;
- PASS=null;
- if (connectionObject != null)
- connectionObject.close();
- } catch (SQLException se) {
- se.printStackTrace();
- }
- }
- public static void main(String args[]){
- getConnection();
- closeConnection();
- }
- }
Oracle Identity Manager(OIM) is the Provisioning Solution from oracle. This page contains an index with references to all OIM related posts in the oracle identity manager Academy blog. The posts included herein are intended to provide oracle identity management customers and developers with technical information about best practices for implementing OIM based solutions.
OIM DB Connection/ Data Source connection
Subscribe to:
Post Comments (Atom)
-
Connection Related API's : OIM DB Connection/ Data Source connection OIMClient API / OIMConnection API OIM Platform API to getSer...
-
Error : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframewor...
-
In this post, we set the middle name as “MiddleName” if user does not provide middle name during user create operation. Below are high...
No comments:
Post a Comment