26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
52 lines
1.5 KiB
C#
Executable File
52 lines
1.5 KiB
C#
Executable File
using System;
|
|
using NLog;
|
|
using Oracle.ManagedDataAccess.Client;
|
|
|
|
namespace DataModel.Process
|
|
{
|
|
/// <summary>
|
|
/// JDE interface
|
|
/// </summary>
|
|
public partial class JDE
|
|
{
|
|
/// <summary>
|
|
/// Query repository name
|
|
/// </summary>
|
|
private const string RepositoryName = "JDE";
|
|
|
|
/// <summary>
|
|
/// Query repository instance
|
|
/// </summary>
|
|
private static readonly QueryRepository queries = new QueryRepository(RepositoryName, Config.JDEQueryRepo);
|
|
|
|
/// <summary>
|
|
/// Shared logger instance
|
|
/// </summary>
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
/// <summary>
|
|
/// Gets an open connection to the JDE DB
|
|
/// </summary>
|
|
/// <returns>Opened connection to the JDE DB</returns>
|
|
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;
|
|
}
|
|
}
|
|
}
|