Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Visual Studio Server Explorer support custom database providers?

I had used Server Explorer and related tools for graphical database development with Microsoft SQL Server in some of my learning projects - and it was a great experience. However, in my work I deal with Oracle DB and SQLite and my hobby projects use MySQL (because they are hosted on Linux).

Is there a way to leverage the database-related tools in Visual Studio with other database providers?

like image 972
skolima Avatar asked Aug 28 '08 09:08

skolima


1 Answers

Here is instructions on how to connect to your MySQL database from Visual Studio:

To make the connection in server explorer you need to do the following:

  • first of all you need to install the MyODBC connector 3.51 (or latest) on the development machine (NB. you can find this at http://www.mysql.com/products/connector/odbc/ )

  • Create a datasource in Control Panel/Administrative Tools with a connection to your database. This data source is going to be used purely for Server Manager and you dont need to worry about creating the same data source on your clients PC when you have made your VS.NET application (Unless you want to) - I dont want to cover this in this answer, too long. For the purpose of this explanation I will pretend that you created a MyODBC data source called 'AADSN' to database 'noddy' on mysqlserver 'SERVER01' and have a root password of 'fred'. The server can be either the Computer Name (found in Control Panel/System/Computer Name), or alternatively it can be the IP Address. NB. Make sure that you test this connection before continuing with this explanation.

  • open your VS.NET project

  • go to server explorer

  • right-click on 'Data Connections'

  • select 'Add Connection'

  • In DataLink Properties, go to the provider tab and select "Microsoft OLE DB Provider For ODBC drivers"

  • Click Next

  • If you previously created an ODBC data source then you could just select that. The disadvantage of this is that when you install your project application on the client machine, the same data source needs to be there. I prefer to use a connection string. This should look something like:

DSN=AADSN;DESC=MySQL ODBC 3.51 Driver DSN;DATABASE=noddy;SERVER=SERVER01;UID=root;PASSWORD=fred;PORT=3306;SOCKET=;OPTION=11;STMT=;

If you omit the password from the connection string then you must make sure that the datasource you created (AADSN) contains a password. I am not going to describe what these mean, you can look in the documentation for myodbc for that, just ensure that you get a "Connection Succeeded" message when you test the datasource.

like image 177
Espo Avatar answered Oct 18 '22 19:10

Espo