0

System.Data.OracleClient を使用して 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 を使用しています。

貴重なご意見・ご感想をお待ちしております......

4

1 に答える 1

0

これを確認してください: http://oraclepoint.com/oralife/2010/08/19/oracle-odbc-connection-issue-of-system-exception-ocienvcreate-failed-with-return-code-1-on-windows-with -asp/

于 2012-09-18T05:49:04.687 に答える