[Mono-list] Using ODBC on Solaris for Oracle

Colin J. Paterson colin.paterson at memex.com
Tue Oct 16 11:42:13 EDT 2007


I am currently trying to write an application that will use Mono on Solaris
10 as a server side tool to talk to a remote Oracle database. I have Mono
1.2.4 and have installed the instant client from Oracle and the EasySoft
ODBC driver and verified that these work. I can run sql in sqlplus and
everything connects fine and returns what I would expect. I can also run
isql from EasySoft and this works fine. However when I run the following
code



_odbcConnection = new OdbcConnection("DSN=ORACLE");
_odbcConnection.Open();

OdbcCommand command = new OdbcCommand("SELECT * FROM EMPLOYEES",
_odbcConnection);
OdbcDataReader reader = command.ExecuteReader();

Console.WriteLine("Reader Executed");



It throws a System.Exception at the ExecuteReader() line and gives back the
following message and call stack

Exception ArgRange_Array
Parameter name: count
  at System.Text.Latin1Encoding.GetString (System.Byte[] bytes, Int32 index,
Int32 count) [0x00000]
  at System.Data.Odbc.OdbcDataReader.GetColumnAttributeStr (Int32 column,
FieldIdentifier fieldId) [0x00000]
  at System.Data.Odbc.OdbcDataReader.GetSchemaTable () [0x00000]
  at System.Data.Odbc.OdbcDataReader..ctor (System.Data.Odbc.OdbcCommand
command, CommandBehavior behavior) [0x00000]
  at System.Data.Odbc.OdbcDataReader..ctor (System.Data.Odbc.OdbcCommand
command, CommandBehavior behavior, Int32 recordAffected) [0x00000]
  at (wrapper remoting-invoke-with-check)
System.Data.Odbc.OdbcDataReader:.ctor
(System.Data.Odbc.OdbcCommand,System.Data.CommandBehavior,int)
  at System.Data.Odbc.OdbcCommand.ExecuteReader (CommandBehavior behavior)
[0x00000]
  at System.Data.Odbc.OdbcCommand.ExecuteReader () [0x00000]
  at (wrapper remoting-invoke-with-check)
System.Data.Odbc.OdbcCommand:ExecuteReader ()
  at Memex.BatchImporter.DatabaseTester.Execute () [0x00000]


Any help would be much appreciated on this, I can't see much wrong with what
I am doing???

Thanks in advance.

Colin



More information about the Mono-list mailing list