I can link oracle 12c Database with unity3d,but cannot query any data,why?
I can link oracle 12c Database with unity3d,but cannot query any data.The same codes in other vs2015 program whitout unity3d are normal execution.I use the System.Data.OracleClient.dll.Any help would be very appreciated, thanks.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Data;
using System.Data.OracleClient;
using UnityEngine.UI;
public class LinkOracle : MonoBehaviour {
public static OracleConnection conn;
static string connectStr = "User ID=system;Password=Zhutong66;Data Source=MONITOR_ORCL;";
String Query="select Assessment_Status from Record_Info_TB where Start_Date>=(sysdate-1/3600/24) and regexp_like(Assessment_Status,'^*.DANGEROUS$')";
void Start () {
conn = new OracleConnection(connectStr);
string LinkStatus = conn.State.ToString();
Console.WriteLine(LinkStatus);
conn.Open();
string LinkStatus = conn.State.ToString();
Debug.Log(LinkStatus);
this.InvokeRepeating("Estimate",2.0f,0.5f);}
private void Estimate(){
OracleCommand ocd = new OracleCommand ();
ocd.Connection = conn;
ocd.CommandText = Query;
ocd.CommandType = System.Data.CommandType.Text;
//OracleDataReader odr = new OracleDataReader ();
OracleDataReader odr = ocd.ExecuteReader();
while(odr.Read()){
Debug.Log("many data");
}
}
}
Answer by AfroDieter · Sep 25, 2018 at 10:27 AM
I recommend using ManagedDriver. I finally figured out how. Just check my answer here: https://answers.unity.com/questions/142275/how-do-i-connect-to-an-oracle-database.html?childToView=1556476#answer-1556476
Answer by jeffblumenthal · Jan 11, 2017 at 02:56 PM
Hi,
Could we please get more details?
So to confirm, you are able to connect to the Oracle 12c DB, yes? Did you setup an ODBC data source? If so, how.
Thank you.
Ok, worked through this more.
I am having problems hitting an 11g instance using 5.5.0f3. $$anonymous$$y suspicion is the current set of drivers go up to 10g. Therefore I went 3rd party. I got https://www.devart.com/dotconnect/ working quickly. Note, I DO NOT work for them.
HTH