[Mono-list] ODBC.NET Provider on Windows

Daniel Morgan danmorg@sc.rr.com
Sat, 12 Oct 2002 02:19:17 -0400


The mono module in cvs in directory data, there is a file config.in, you
will see something like:

<configuration>
	<dllmap dll="cygwin1.dll" target="@LIBC@" />
	<dllmap dll="libc" target="@LIBC@" />
	<dllmap dll="libxslt.dll" target="libxslt.so" />
	<dllmap dll="libmySQL.dll" target="libmysqlclient.so" />
</configuration>

Add the following line:
	<dllmap dll="odbc32.dll" target="libodbc.so" />

In you DllImport where you have "libodbc", use "odbc32.dll" instead.

On Windows, the mono runtime will use "odbc32.dll" while on on Linux the
mono runtime will use "libodbc.so" based on the config file and what you use
in your DllImport.

-----Original Message-----
From: Brian Ritchie [mailto:brianlritchie@hotmail.com]
Sent: Saturday, October 12, 2002 1:58 AM
To: danmorg@sc.rr.com; mono-list@ximian.com
Subject: RE: [Mono-list] ODBC.NET Provider on Windows


Great news!!

I'm "power-leveling" the odbc code...
- I've jacked in the transaction objects
- I'm straightening out all of the SQL data type mappings.
- DBNull works
- I've implemented the Cancel method

Do we have a #define to force conditional compilation on Linux/Windows?  I'd
like to setup the libodbc to point at odbc32 on windows.  Or is there a
better way?

I'll be checking this stuff in this weekend.

Brian


>From: "Daniel Morgan" <danmorg@sc.rr.com>
>To: "Brian Ritchie" <brianlritchie@hotmail.com>,   "Mono-List"
><mono-list@ximian.com>
>Subject: RE: [Mono-list] ODBC.NET Provider on Windows
>Date: Fri, 11 Oct 2002 22:53:16 -0400
>
>Brian,
>
>It works on Windows too!!!!
>
>I compiled and ran the OdbcTest on .NET 1.1 beta on Windows and on Mono on
>Windows.  It works on both.  I had to use a DSN and change something in my
>DSN in ODBC Sources in the Control Panel.
>However, I made the authentication set to SQL Server (not NT) and set my
>default database to pubs.
>
>			dbcon.ConnectionString =
>				"DSN=LocalServer;UID=sa;PWD=";
>
>DanielMorgan@DANPC ~/mono/mcs/class/System.Data/Test
>$ mcs OdbcTest.cs -r System.Data.dll
>Compilation succeeded
>
>DanielMorgan@DANPC ~/mono/mcs/class/System.Data/Test
>$ mono OdbcTest.exe
>ODBCInit Complete.
>WARNING: Unknown type 0
>Last Name: Cruz
>
>
>
>Last Name: Roulet
>
>
>
>Last Name: Devon
>
>
>
>Last Name: Domingues
>
>
>
>Last Name: Hernadez
>
>
>
>Last Name: Schmitt
>
>
>
>Last Name: Tonini
>
>
>
>Last Name: Roel
>
>
>
>Last Name: Lincoln
>
>
>
>Last Name: Chang
>
>
>
>Last Name: Thomas
>
>
>
>Last Name: Bennett
>
>
>
>Last Name: Nagy
>
>
>
>Last Name: Snyder
>
>
>
>Last Name: Labrune
>
>
>
>Last Name: Josephs
>
>
>
>Last Name: Jablonski
>
>
>
>Last Name: Brown
>
>
>
>Last Name: Lebihan
>
>
>
>Last Name: Larsson
>
>
>
>Last Name: Pereira
>
>
>
>Last Name: Rance
>
>
>
>Last Name: Paolino
>
>
>
>Last Name: Smith
>
>
>
>Last Name: Sommer
>
>
>
>Last Name: Karttunen
>
>
>
>Last Name: Pontes
>
>
>
>Last Name: Saveley
>
>
>
>Last Name: McKenna
>
>
>
>Last Name: Ibsen
>
>
>
>Last Name: Franken
>
>
>
>Last Name: Accorti
>
>
>
>Last Name: Koskitalo
>
>
>
>Last Name: Afonso
>
>
>
>Last Name: Parente
>
>
>
>Last Name: Cramer
>
>
>
>Last Name: Henriot
>
>
>
>Last Name: Mendel
>
>
>
>Last Name: Muller
>
>
>
>Last Name: Ottlieb
>
>
>
>Last Name: O'Rourke
>
>
>
>Last Name: Ashworth
>
>
>
>Last Name: Latimer
>
>
>
>
>Unhandled Exception: System.NotImplementedException: The requested feature
>is no
>t yet implemented
>in <0x0002b> 00 System.Data.Odbc.OdbcCommand:Dispose (bool)
>in <0x00015> 00 System.ComponentModel.Component:Dispose ()
>in <0x00174> 00 Test.OdbcTest.OdbcTest:Main (string[])
>
>
>-----Original Message-----
>From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]On
>Behalf Of Daniel Morgan
>Sent: Friday, October 11, 2002 11:18 AM
>To: Brian Ritchie; Mono-List
>Subject: RE: [Mono-list] ODBC.NET Provider on Windows
>
>
>Yes, it got me further, I still have a problem.  However, I think you said
>System.Data.Odbc does not have support for DSN-less connections yet.
>
>This is what I get now:
>
>DanielMorgan@DANPC ~/mono/mcs/class/System.Data/Test
>$ mono OdbcTest.exe
>ODBCInit Complete.
>ERROR: SQLConnect: <Error>
>ERROR: SQLAlloc(Prepare): <Error>
>ERROR: SQLPrepare: <InvalidHandle>
>ERROR: SQLExecute: <InvalidHandle>
>ERROR: SQLCancel: <InvalidHandle>
>
>Unhandled Exception: System.NotImplementedException: The requested feature
>is no
>t yet implemented
>in <0x0002b> 00 System.Data.Odbc.OdbcCommand:Dispose (bool)
>in <0x00015> 00 System.ComponentModel.Component:Dispose ()
>in <0x00174> 00 Test.OdbcTest.OdbcTest:Main (string[])
>
>
>-----Original Message-----
>From: Brian Ritchie [mailto:brianlritchie@hotmail.com]
>Sent: Friday, October 11, 2002 10:28 AM
>To: Daniel Morgan; Mono-List
>Subject: Re: [Mono-list] ODBC.NET Provider on Windows
>
>
>Here's the fix...
>
>In libodbc.cs, the OdbcReturn enum needs to be a short.
>
>internal enum OdbcReturn : short {
>Error = -1,
>
>InvalidHandle = -2,
>
>StillExecuting = 2,
>
>NeedData = 99,
>
>Success = 0,
>
>SuccessWithInfo = 1
>
>}
>
>Let me know if this works for you,
>
>Brian
>
>----- Original Message -----
>From: "Brian Ritchie" <brianlritchie@hotmail.com>
>To: "Daniel Morgan" <danmorg@sc.rr.com>; "Mono-List" <mono-list@ximian.com>
>Sent: Friday, October 11, 2002 9:17 AM
>Subject: Re: [Mono-list] ODBC.NET Provider on Windows
>
>
> > Guys,
> >
> > I'm able to duplicate the problem.  The very first call into odbc32 is
> > failing.  It is a pretty basic call...it only allocates the first
>handle.
> > So, it appears to be some sort of interop problem with the dll.  I'm
>still
> > checking into it.  Let me know if you have any thoughts.
> >
> > Brian
> >
> > ----- Original Message -----
> > From: "Daniel Morgan" <danmorg@sc.rr.com>
> > To: "Mono-List" <mono-list@ximian.com>
> > Sent: Friday, October 11, 2002 3:49 AM
> > Subject: [Mono-list] ODBC.NET Provider on Windows
> >
> >
> > > Rodrigo and Brian
> > >
> > > I have tried to get the Odbc.net provider to use Microsoft Window's
>native
> > > ODBC library which is odbc32.dll by changing the DllImport from
>"libodbc"
> > to
> > > "odbc32".  The library apparently loads,
> > > but I don't know what the errors are for.
> > >
> > > Any ideas?
> > >
> > > This is the results I got:
> > >
> > > DanielMorgan@DANPC ~/mono/mcs/class/System.Data/Test
> > > $ mono OdbcTest.exe
> > > ERROR: SQLAllocHandle: <528285696>
> > > ERROR: SQLSetEnvAttr: <528285696>
> > > ODBCInit Complete.
> > > ERROR: SQLAllocHandle(hdbc): <528285696>
> > > ERROR: SQLConnect: <65535>
> > > ERROR: SQLAlloc(Prepare): <528351231>
> > > ERROR: SQLPrepare: <528351230>
> > > ERROR: SQLExecute: <528351230>
> > > ERROR: SQLCancel: <528351230>
> > >
> > > Unhandled Exception: System.NotImplementedException: The requested
>feature
> > > is no
> > > t yet implemented
> > > in <0x0002b> 00 System.Data.Odbc.OdbcCommand:Dispose (bool)
> > > in <0x00015> 00 System.ComponentModel.Component:Dispose ()
> > > in <0x00174> 00 Test.OdbcTest.OdbcTest:Main (string[])
> > >
> > > I have a ODBC.net test named OdbcTest.cs that works on Windows XP
> > > using .NET 1.1 Beta, but not Mono:
> > >
> > > using System;
> > > using System.Data;
> > > using System.Data.Odbc;
> > >
> > > namespace Test.OdbcTest
> > > {
> > > class OdbcTest
> > > {
> > > [STAThread]
> > > static void Main(string[] args)
> > > {
> > > OdbcConnection dbcon = new OdbcConnection();
> > > // connection string to a Microsoft SQL Server 2000 database
> > > dbcon.ConnectionString =
> > > "DRIVER={SQL Server};" +
> > > "SERVER=(local);" +
> > > "Trusted_connection=true;" +
> > > "DATABASE=pubs;";
> > >
> > > dbcon.Open();
> > >
> > > OdbcCommand dbcmd = new OdbcCommand();
> > > dbcmd.Connection = dbcon;
> > > dbcmd.CommandType = CommandType.Text;
> > > dbcmd.CommandText = "SELECT lname FROM employee";
> > >
> > > OdbcDataReader reader;
> > > reader = (OdbcDataReader) dbcmd.ExecuteReader();
> > >
> > > while(reader.Read()) {
> > > Console.WriteLine("Last Name: " + reader[0].ToString());
> > > }
> > > reader.Close();
> > > dbcmd.Dispose();
> > > dbcon.Close();
> > > }
> > > }
> > > }
> > >
> > >
> > >
> > > _______________________________________________
> > > Mono-list maillist  -  Mono-list@ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-list
> > >
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
>
>
>_______________________________________________
>Mono-list maillist  -  Mono-list@ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>_______________________________________________
>Mono-list maillist  -  Mono-list@ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com