private static OracleConnection OracleConnection = null;
private static object _OracleLock = new object();
/// <summary>
/// 连接数据源
/// </summary>
/// <returns></returns>
public OracleConnection GetOracleConnection(string connString)
{
if (OracleConnection == null || OracleConnection.State == ConnectionState.Open)
{
lock (_OracleLock)
{
if (OracleConnection == null || OracleConnection.State == ConnectionState.Open)
{ OracleConnection = new OracleConnection(connString);
System.IO.StreamWriter LogWriterbefew = System.IO.File.AppendText(@"D:\asxt\InceptService\Logfile.txt");
LogWriterbefew.Write("开始进入异常");
LogWriterbefew.Close();
try
{
OracleConnection.Open();
}
catch (Exception ex)
{
System.IO.StreamWriter LogWriterbefewe = System.IO.File.AppendText(@"D:\asxt\InceptService\Logfile.txt");
LogWriterbefewe.Write("进入异常");
LogWriterbefewe.Close(); System.IO.StreamWriter LogWritera = System.IO.File.AppendText(@"D:\asxt\InceptService\Logfile.txt");
LogWritera.Write(ex.ToString());
LogWritera.Close();
}
System.IO.StreamWriter LogWriterbfefew = System.IO.File.AppendText(@"D:\asxt\InceptService\Logfile.txt");
LogWriterbfefew.Write("异常二");
LogWriterbfefew.Close();
}
else
return OracleConnection;
}
}
return OracleConnection;
}以上是我连接oralce数据库的,服务意外停止,因为是在服务器上没有装测试环境,在日志里只输出了开始进入异常,就没有其它任何返应了,而且服务就停止了,有人遇到过这样的问题吗?
private static object _OracleLock = new object();
/// <summary>
/// 连接数据源
/// </summary>
/// <returns></returns>
public OracleConnection GetOracleConnection(string connString)
{
if (OracleConnection == null || OracleConnection.State == ConnectionState.Open)
{
lock (_OracleLock)
{
if (OracleConnection == null || OracleConnection.State == ConnectionState.Open)
{ OracleConnection = new OracleConnection(connString);
System.IO.StreamWriter LogWriterbefew = System.IO.File.AppendText(@"D:\asxt\InceptService\Logfile.txt");
LogWriterbefew.Write("开始进入异常");
LogWriterbefew.Close();
try
{
OracleConnection.Open();
}
catch (Exception ex)
{
System.IO.StreamWriter LogWriterbefewe = System.IO.File.AppendText(@"D:\asxt\InceptService\Logfile.txt");
LogWriterbefewe.Write("进入异常");
LogWriterbefewe.Close(); System.IO.StreamWriter LogWritera = System.IO.File.AppendText(@"D:\asxt\InceptService\Logfile.txt");
LogWritera.Write(ex.ToString());
LogWritera.Close();
}
System.IO.StreamWriter LogWriterbfefew = System.IO.File.AppendText(@"D:\asxt\InceptService\Logfile.txt");
LogWriterbfefew.Write("异常二");
LogWriterbfefew.Close();
}
else
return OracleConnection;
}
}
return OracleConnection;
}以上是我连接oralce数据库的,服务意外停止,因为是在服务器上没有装测试环境,在日志里只输出了开始进入异常,就没有其它任何返应了,而且服务就停止了,有人遇到过这样的问题吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货