[Mono-list] Moving from SQL Server to MySQL

Gabriel & Emily Bin GabeEmilyBin@hotmail.com
Thu, 16 Jan 2003 16:52:02 -0700


Hey, this is my first post to the Mono list!  I'm totally stoked about this
project.  As a recent convert from windows to Linux, I'm totally stoked
about moving our in-house apps over to run on Linux boxes.  All our apps are
being re-written in C# or VB.NET.  Currently all systems are running
windows, from the clients to the server.  Switching the apps over to Linux
shouldn't (if the promise of Mono pans out - I'm crossing my fingers) be
that big of a deal.

We are starting a new web app and are trying to migrate databases from SQL
Server to MySQL. I'm still a little unclear about how that might be done.  I
've come up with the following solution and was wondering if anyone with
experience in this area might help me before we write tons of code based on
a hope alone.

This is what I've com up with:
(based on what I read at
http://lists.ximian.com/archives/public/mono-list/2003-January/004903.html)

I could use a function whenever I needed a connection object.  The key is
using System.Data.IDbConnection as an interface between the different types
of connection objects (SQL and MySQL).


***** Start
Imports System.Data
Imports System.Data.SqlClient
Public Module DataLayer
    Public Function BizConnection() As System.Data.SqlClient.SqlConnection
        Dim dbcon As IDbConnection = New SqlConnection()
        Return dbcon
    End Function
End Module
***** End


Then I could work with the SqlConnection just as I would at any other time.


***** Start
Dim scon As SqlConnection = DataLayer.BizConnection()
***** End


When we change the database we could then change the module.


***** Start
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Mono.Data.MySql
Public Module DataLayer
    Shared Function BizConnection() As SqlConnection
        Dim dbcon As IDbConnection = New MySqlConnection()
        BizConnection = dbcon
    End Function
End Module
***** End

Would this work?  I'd test it but we can't wait around to set up a MySQL
server and get Mono running etc.

Any feed back would be great.

Gabriel