所以基本上我试图在统一和单一开发中访问 Oracle 数据库。我将所需的 DLL System.Data 和 System.Data.OracleClient 从 C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\2.0 复制到项目的 Assets 文件夹中,
这是我的 C# 代码:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OracleClient;
public class OracleConn : MonoBehaviour
{
public string connectStr = "SomeConnectionString";
string TBName = "CZRK";
List<string> listOfID = new List<string>(); //ID
List<string> listOfName = new List<string>(); //NAME
private string content;
void Start()
{
OracleConnection conn = new OracleConnection(connectStr);
conn.Open(); //the line that causes error
}
}
然后错误 DllNotFoundException: oci 在执行 conn.Open() 时弹出
完整的错误日志:
DllNotFoundException: oci
System.Data.OracleClient.Oci.OciCalls.OCIEnvCreate (System.IntPtr& envhpp, OciEnvironmentMode mode, IntPtr ctxp, IntPtr malocfp, IntPtr ralocfp, IntPtr mfreep, Int32 xtramem_sz, IntPtr usrmempp)
System.Data.OracleClient.Oci.OciEnvironmentHandle..ctor (OciEnvironmentMode mode)
System.Data.OracleClient.Oci.OciGlue.CreateConnection (OracleConnectionInfo conInfo)
System.Data.OracleClient.OracleConnectionPoolManager.CreateConnection (OracleConnectionInfo info)
System.Data.OracleClient.OracleConnectionPool.CreateConnection ()
System.Data.OracleClient.OracleConnectionPool.GetConnection ()
System.Data.OracleClient.OracleConnection.Open ()
(wrapper remoting-invoke-with-check) System.Data.OracleClient.OracleConnection:Open ()
OracleConn.Start () (at Assets/OracleConn.cs:25)
此外,我还尝试将 DLL 文件 oci.dll 从 oracleDB_11g 复制到 assets 文件夹中,但问题仍然存在,有什么想法吗?