0
我有一個使用System.Data.OracleClient訪問oracle數據庫的C#程序。從.net訪問oracle數據庫時獲取解決方案c#
該代碼使用OracleCommand,Dataset對象。
命令結構如下
con = new OracleConnection(conStr);
con.Open();
OracleDataAdapter adp = new OracleDataAdapter("select * from sample", con);
DataSet ds = new DataSet();
adp.Fill(ds);
DataTable dt = ds.Tables[0];
con.Close();
和初始化值作爲
public static String conStr = "SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=******)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=******)));uid=#####;pwd=#######;";
private OracleConnection con;
private String query;
private OracleCommand cmd;
private OracleDataReader rd;
和
我得到誤差作爲
堆棧跟蹤:
at System.Data.OracleClient.OciHandle..ctor(OciHandle parentHandle, HTYPE handleType, MODE ocimode, HANDLEFLAG handleflags)
at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)
at System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)
at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OracleClient.OracleConnection.Open()
at oracleTest.Program.showdata() in D:\oracle\oracletst[via-oracleclient]\oracletst\Program.cs:line 43
at oracleTest.Program.Main(String[] args) in D:\oracle\oracletst[via-oracleclient]\oracletst\Program.cs:line 22
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
目標站點:
{Void .ctor(System.Data.OracleClient.OciHandle, HTYPE, MODE, HANDLEFLAG)}
消息:
OCIEnvCreate failed with return code -1 but error message text was not available.
我不知道啊,我被困在
我使用Oracle 10g和DOTNET 2010
。等待您的寶貴回覆和評論......
仍然會出現相同的問題 – GowthamanSS