using System;
using NLog;
using Oracle.ManagedDataAccess.Client;
namespace DataModel.Process
{
///
/// JDE interface
///
public partial class JDE
{
///
/// Query repository name
///
private const string RepositoryName = "JDE";
///
/// Query repository instance
///
private static readonly QueryRepository queries = new QueryRepository(RepositoryName, Config.JDEQueryRepo);
///
/// Shared logger instance
///
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
///
/// Gets an open connection to the JDE DB
///
/// Opened connection to the JDE DB
public static OracleConnection GetConnection()
{
OracleConnection connection;
try
{
//Create the connection to the database and open it
connection = new OracleConnection(Config.JDECS);
connection.Open();
}
catch (Exception error)
{
//Log error and forward
logger.Error("GetConnection: failed to open connection to JDE: {0}.", error.Message);
throw new Exception("JDE: failed to open connection to JDE database.", error);
}
return connection;
}
}
}