views:

3172

answers:

5

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?

A: 

The Server Explorer should support any database system that provides an ODBC driver. In the case of Oracle there is a built in driver with Visual Studio.

In the Add Connection Dialog click the change button on the data source you should then get a list of the providers you have drivers for.

John Hunter
+6  A: 

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.

Espo
+2  A: 

I found this during my research on Sqlite. I haven't had the chance to use it though. Let us know if this works for you.

http://sqlite.phxsoftware.com/

System.Data.SQLite System.Data.SQLite is the original SQLite database engine and a complete ADO.NET 2.0 provider all rolled into a single mixed mode assembly.

...

Visual Studio 2005/2008 Design-Time Support

You can add a SQLite connection to the Server Explorer, create queries with the query designer, drag-and-drop tables onto a Typed DataSet and more!

SQLite's designer works on full editions of Visual Studio 2005/2008, including VS2005 Express Editions.

NEW You can create/edit views, tables, indexes, foreign keys, constraints and triggers interactively within the Visual Studio Server Explorer!

hitec
A: 

@Espo: your answer is excelent, and it works great in VS Professional. Does this work with the Express version as well? I have installed the MySQL ODBC driver on a machine with VS 2005 Pro and VS 2008 Express and only the VS Pro is showing the ODBC data source as an available choice.

@hitec: this would suggest that my case is a bug in MySQL ODBC installer.

skolima
A: 

Oracle has a set of tools that integrates with Visual Studio. It's packaged with their data access libraries.

http://www.oracle.com/technology/software/tech/windows/odpnet/index.html

Brad Bruce