Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 3rd, 2005, 03:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connecting to MySQL from .NET on Linux and Windows

I am currently trying to connect and retrieve data from a MySQL database running on my Linux box. Actually I have already succeeded in doing that, however the technologies used does not seem to be the same.

On Windows I used some namespace called MySql.Data.MySqlClient, but on Linux I used ByteFX.Data.MySqlClient. Both of these work on their respective systems, but I would like my project to be independant of where it is compiled, so this is not good enough.

Naturally I have looked at the MySQL site and found the MyODBC driver, which I can get to work on Windows, but not on Linux. The namespace I have included in the project is System.Data.Odbc.

Is this correct? How can I make it work on both machines?

Thanks, Jacob.
__________________
Danish audio books for download at http://www.lytenbog.dk (Danske lydbøger til download).
 
Old February 5th, 2005, 06:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Alright, I finally figured it out and others might have an interest in this aswell, so here it goes...

I am now using the ODBC driver found at the MySQL site. When using this driver one has to include the namespace System.Data.Odbc, which I originally tried on both systems, however I didn't work to start with. The reason for this was the /etc/mono/config file on Linux. In this file I found the following line...
Code:
<dllmap dll="odbc32.dll" target="libodbc.so" />
...which was wrong. When I removed the extesion from the filename it finally worked! Change the filename and you are able to make the ODBC driver work on both systems.

During my research I came across an article which might be interesting for some if you are looking into these things. A link to the article is here...

http://dev.mysql.com/tech-resources/articles/dotnet/

Furthermore I have experienced some differences with the ODBC driver on the two platforms mentioned. Working with the ODBC connection on Linux is much more sensible; e.g. one has to be very exact to specify which datatype you will be retrieving (GetInt16 for SMALLINT, etc.), and also closing connections etc. are more sensible.

Off for now, hope it helps others :)

Jacob.





Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql + JDBC + Linux silver_cuts Java Databases 2 March 23rd, 2006 09:28 AM
Authentication between Windows and Linux... jacob .NET Web Services 0 July 19th, 2005 05:04 PM
Error Connecting to MySQL with ASP.Net arovner Classic ASP Databases 0 April 27th, 2005 01:49 PM
Connecting to MySQL with VB .NET CFerthorney Pro VB.NET 2002/2003 1 October 23rd, 2003 04:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.