问题: Oracle PKG在其他模式中执行 - 而不是在ODP.net中的连接字符串中指定的模式
环境
我们在一个数据库中有300多个模式,
突然连接到主模式并使用驻留在主模式上的PKG获取数据时,它会自动连接到其他模式并尝试执行相同的命名过程。
在.net调试会话中,我们可以验证我们正在传递下面提到的连接字符串,这完全没问题。
但是,程序执行是否发生在不同的架构中?在哪里看,怎么看?
连接字符串
数据源=;用户ID =;密码=;最小池大小= 10;连接生命周期= 120;连接超时= 120; Incr池大小= 5; Decr池大小= 2;最大池大小= 150;验证Connection = true
执行方法
public DataSet ExecuteQueryProcedure(string _ProcName, string[] _arrINPUTParamNames, string[] _arrINPUTParamValues,
string constr, ref string strMsg)
{
strMsg = "";
try
{
if (_arrINPUTParamValues.Length < _arrINPUTParamNames.Length)
{
Array.Resize(ref _arrINPUTParamValues, _arrINPUTParamNames.Length);
for (int _intParamCount = 0; _intParamCount < _arrINPUTParamValues.Length; _intParamCount++)
{
_arrINPUTParamValues[_intParamCount] = _arrINPUTParamValues[_intParamCount] == null ? "" : _arrINPUTParamValues[_intParamCount];
}
}
OracleConnection con = new OracleConnection(constr);
con.Open();
// create the command object and set attributes
OracleCommand cmd = new OracleCommand(_ProcName, con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.FetchSize = cmd.FetchSize * 8;
OracleCommandBuilder.DeriveParameters(cmd);
int _intInputParamCount = 0;
for (int _intParamCount = 0; _intParamCount < cmd.Parameters.Count; _intParamCount++)
{
if (cmd.Parameters[_intParamCount].Direction == ParameterDirection.Input)
{
_intInputParamCount++;
cmd.Parameters[_intParamCount].Value = "";
}
}
if (_intInputParamCount != _arrINPUTParamNames.Length)
{
strMsg = "Input Parameter count mismatch";
return null;
}
for (int _intParamCount = 0; _intParamCount < cmd.Parameters.Count; _intParamCount++)
{
for (int _intSetParamCount = 0; _intSetParamCount < _arrINPUTParamNames.Length; _intSetParamCount++)
{
if (_arrINPUTParamNames[_intSetParamCount].ToUpper() == cmd.Parameters[_intParamCount].ParameterName.ToUpper())
{
cmd.Parameters[_intParamCount].Value = _arrINPUTParamValues[_intSetParamCount];
break;
}
}
}
// create a data adapter to use with the data set
OracleDataAdapter da = new OracleDataAdapter(cmd);
// create the data set
DataSet ds = new DataSet();
// fill the data set
DateTime dtBeforeTime = DateTime.Now;
da.Fill(ds);
DateTime dtAfterTime = DateTime.Now;
TimeSpan ts = dtAfterTime - dtBeforeTime;
// clean up our objects release resources
ds.Dispose();
da.Dispose();
cmd.Dispose();
con.Close();
con.Dispose();
return ds;
}
catch (OracleException Ex)
{
strMsg = Ex.Source + ": " + Ex.Message;
return null;
}
}