Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Plutis · Mar 06, 2014 at 12:27 AM · database

How to connect to Oracle?

Hello, for two days I'm trying to connect to Oracle from Unity, but no luck... Maybe anybody can say how to do that? Or maybe give code part of connecting?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image getyour411 · Mar 06, 2014 at 12:40 AM 0
Share

What client connection protocol are you trying - ODBC, .NET/ODAC, etc

avatar image Plutis · Mar 06, 2014 at 07:25 AM 0
Share

Tried ODBC and ODAC, both give errors, while in normal .net application, they both works...

ODBC:

 OdbcConnection cn=new OdbcConnection("Driver={$$anonymous$$icrosoft ODBC for Oracle}; UID=user; PWD=PASS; Server=XE;");
 OdbcCommand cmd =new OdbcCommand("select * from sku",cn);
 cn.Open ();
 Debug.Log("Connected");
 OdbcDataReader rData = cmd.ExecuteReader();
 while (rData.Read()){
     Debug.Log("row" +rData[0] + " " + rData[1] );
 }
 Debug.Log(rData.FieldCount);
 rData.Close();
 cn.Close();

First line throw:

InvalidProgramException: Invalid IL code in :.cctor (): method body is empty.

Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Warehouse$$anonymous$$anager.Start () (at Assets/Scripts/Warehouse$$anonymous$$anager.cs:37)

And this one put Unity in not responding

ODAC:

 string connectionString = "Data Source=XE; User ID=user; Password=PASS;";
 OracleConnection dbcon = new OracleConnection (connectionString);
 Debug.Log("Connected");
 dbcon.Open ();
 OracleCommand dbcmd = dbcon.CreateCommand ();
 string sql = "SELECT * from sku";
 dbcmd.CommandText = sql;
 OracleDataReader reader = dbcmd.ExecuteReader ();
 while (reader.Read ()) {
     Debug.Log ((string) reader["skucode"]);
 }
 reader.Close ();
 reader = null;
 dbcmd.CommandText = sql;
 dbcmd.ExecuteNonQuery ();
 dbcmd.Dispose ();
 dbcmd = null;
 dbcon.Close ();
 dbcon = null;


Second line throw:

InvalidCastException: Cannot cast from source type to destination type. Oracle.DataAccess.Client.CThreadPool..cctor () Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Oracle.DataAccess.Client.CThreadPool Oracle.DataAccess.Client.OracleInit.Initialize () Oracle.DataAccess.Client.OracleConnection..cctor () Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Oracle.DataAccess.Client.OracleConnection Warehouse$$anonymous$$anager.Start () (at Assets/Scripts/Warehouse$$anonymous$$anager.cs:61)

avatar image jeffblumenthal · Feb 23, 2017 at 04:40 PM 0
Share

Hi @Plutis, did you ever get this working?

Tks.

avatar image Plutis jeffblumenthal · Feb 23, 2017 at 08:00 PM 0
Share

No. I just moved to XNA and done what I want. But I think there must be somewhere tutorial for that, because 2 years passed, so somebody really had to make it.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Who can tell me how to connect to an Oracle Database?very grateful! 2 Answers

How do I connect to an Oracle Database? 6 Answers

SQLite Transaction Update Problem on Android 0 Answers

Where to store data about location 0 Answers

Wrap text textmesh 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges