oracle 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. * Oracle Data Provider
  2. <ul>
  3. <li>ADO.NET Data Provider for <a href="http://www.oracle.com/">Oracle</a> databases</li>
  4. <li>Exists in namespace System.Data.OracleClient and assembly System.Data.OracleClient</li>
  5. <li>Works on Windows and Linux</li>
  6. <li>Works with Oracle 8i and 9i.</li>
  7. <li>Uses the Oracle CLI (Call Level Interface) which is a C library (API) for the Oracle Client
  8. software</li>
  9. <li>Internally, the OracleClient provider has OCI abstracted to an object-oriented programming model</li>
  10. <li>Created by Daniel Morgan and Tim Coleman</li>
  11. <li>Bugs with Mono or the data provider should be reported
  12. in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
  13. do not have Bugzilla user account, it is free
  14. and easy to
  15. create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
  16. </ul>
  17. ** Current Status
  18. <ul>
  19. <li>OracleConnection can connect and disconnect to an Oracle 8i or 9i database on
  20. Windows and Linux via OCI (Oracle Call-level Interface)</li>
  21. <li>Can have multiple connections with different transactions where each transaction is
  22. separated from the others, so a rollback or commit in one transaction
  23. does not affect the other.</li>
  24. <li>Can execute simple DML SQL statements, such as,
  25. INSERT a row into the EMP table via the OracleCommand's ExecuteNonQuery method</li>
  26. <li>Can retrieve data via ExecuteReader and OracleDataReader. Currently,
  27. supports character, numeric, some date data types. ExecuteScalar
  28. also works.</li>
  29. <li>Simple input parameters (character and numeric data) can now
  30. be used in SQL queries. Output parameters do not yet work.</li>
  31. <li>OracleException and Error handling exists now.</li>
  32. <li>Message handling needs to be added for non-critical messages
  33. received from Oracle</li>
  34. <li>Handling of various data types need to be added.</li>
  35. <li>Data Adapter exists, and a DataSet can be filled using it.</li>
  36. <li>Lots of missing functionality and bugs.</li>
  37. <li>Works with SQL# command-line and GTK# GUI versions.</li>
  38. </ul>
  39. ** Action Plan
  40. <ul>
  41. <li>Be able to retrieve results via a data reader (WORKING)</li>
  42. <li>Parameters support (IN PROGRESS)</li>
  43. <li>transactions (WORKING)</li>
  44. <li>Stored Procedures, Functions, and Packages support</li>
  45. <li>Be able to fill a DataTable in a DataSet via a data adapter (IN PROGRESS)</li>
  46. <li>Support for Oracle 8i on Linux and Windows (WORKING)</li>
  47. <li>Support for Oracle 9i on Linux and Windows (WORKING)</li>
  48. <li>Support for Oracle 10g on Linux and Windows [TODO]. Please let us
  49. know on mono-list if Mono OracleClient works with Oracle 10g or not. If not, what errors do you get</li>
  50. <li>Support Large OBjects</li>
  51. <li>Support all the data types</li>
  52. <li>Implement Connection pooling</li>
  53. <li>Security</li>
  54. </ul>
  55. ** Testing System.Data.OracleClient
  56. <ul>
  57. <li>Have a working mono and mcs</li>
  58. <li>Have access to an Oracle 8i or 9i database or download it from
  59. <a href="http://www.oracle.com/">Oracle</a>. If you are connecting
  60. remotely to an Oracle database, you need the Oracle client software.
  61. Registration to the <a href="http://technet.oracle.com/">Oracle Technology Network</a> is free. If installing on Linux,
  62. I suggest you do a lot of searching to see how others installed Oracle on Linux.</li>
  63. <li>Make sure System.Data.OracleClient.dll assembly is built.</li>
  64. <li>Take a look at TestOracleClient.cs found at mcs/class/System.Data.OracleClient/Test</li>
  65. <li>The Data Source is an Oracle TNSNAME</li>
  66. <li>Has a connection string format:
  67. <pre>
  68. "Data Source=tnsname;User ID=userid;Password=password"
  69. </pre>
  70. </li>
  71. <li>C# Example:
  72. <pre>
  73. using System;
  74. using System.Data;
  75. using System.Data.OracleClient;
  76. public class Test
  77. {
  78. public static void Main (string[] args)
  79. {
  80. string connectionString =
  81. "Data Source=testdb;" +
  82. "User ID=scott;" +
  83. "Password=tiger;";
  84. OracleConnection dbcon = null;
  85. dbcon = new OracleConnection (connectionString);
  86. dbcon.Open ();
  87. OracleCommand dbcmd = dbcon.CreateCommand ();
  88. string sql = "SELECT ename, job FROM scott.emp";
  89. dbcmd.CommandText = sql;
  90. OracleDataReader reader = dbcmd.ExecuteReader ();
  91. while (reader.Read ()) {
  92. string employeeName = (string) reader["ename"];
  93. string job = (string) reader["job"];
  94. Console.WriteLine ("Employee Name: {0} Job: {1}",
  95. employeeName, job);
  96. }
  97. // clean up
  98. reader.Close ();
  99. reader = null;
  100. dbcmd.CommandText = sql;
  101. dbcmd.ExecuteNonQuery ();
  102. dbcmd.Dispose ();
  103. dbcmd = null;
  104. dbcon.Close ();
  105. dbcon = null;
  106. }
  107. }
  108. </pre>
  109. </li>
  110. <li>Building C# Example:
  111. <ul>
  112. <li>Save the example to a file, such as, TestExample.cs</li>
  113. <li>Build on Linux:
  114. <pre>
  115. mcs TestExample.cs -r System.Data.dll \
  116. -r System.Data.OracleClient.dll
  117. </pre>
  118. </li>
  119. <li>Build on Windows:
  120. <pre>
  121. mcs TestExample.cs /r:System.Data.dll \
  122. /r:System.Data.OracleClient.dll
  123. </pre>
  124. </li>
  125. </ul>
  126. </li>
  127. <li>Running the Example:
  128. <pre>
  129. mono TestExample.exe
  130. </pre>
  131. </li>
  132. </ul>