View Full Version : asp.net connecting to MySQL possible?
showmanagerEU
03-10-2011, 07:46 AM
Hello,
on my other website hosted by m6.net I use the combination asp.net and mysql with the ODBC-driver and its work very well.
I want to have the same configuration here and I ordered the MySQL-Addon.
Now I have the problem to find out how I can realize the connection between asp.net and MySQL. I don't find the ODBC-Driver.
Can anybody give me a tip or is that not possible to use MySQL with asp.net here?
Thank you
Alex
Ramses
03-10-2011, 07:52 AM
You should be able to connect using the MySQL Connector, as shown in this other thread:
http://community.discountasp.net/showthread.php?t=11948
While they're talking about RIA services, you shouldn't have any problems connecting.
I'd recommend using the MySQL Connector over the ODBC, as it's better technology.
showmanagerEU
03-11-2011, 12:38 AM
Thanks Jose,
for the information.
I also want to use the MySQL Connector over the ODBC.
I found in the knowledge database an code example: Knowledge Base (http://support.discountasp.net/KB/a358/how-to-query-a-mysql-database-in-aspnet.aspx?KBSearchID=267975)
with the follow code sequenz:
Dim myConnection As New OdbcConnection("DSN=<username>_mysqlConn")
I want to define in my web.config the connectionstring but I can't use "<username>_mysqlConn" there. I try all my known usernames instead of <username>. Nothing help. I always get the message: "ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
Can anybody give me a tip how I can find out my correct connectionstring for ODBC?
Thank you very much.
Alex
showmanagerEU
03-11-2011, 11:17 AM
Hello Jose,
thank you for the information.
In the Knowledge Base I found an code example using ODBC with asp.net: Code Example (http://support.discountasp.net/KB/a358/how-to-query-a-mysql-database-in-aspnet.aspx?KBSearchID=268093)
Now my problem is, I don't know the correct setting for the connectionstring in web.config.
In the code example there is a placeholder:
Dim myConnection As New OdbcConnection("DSN=<username>_mysqlConn")
But the placeholder <username> I can not use this in web.config?
How can I find out the correct connectionString for the web.config
Can anybody give me a tip?
Thank you.
Alex
bruce
03-11-2011, 04:17 PM
are you using asp or asp.net?
showmanagerEU
03-12-2011, 01:33 AM
I use asp.net 3.5.
Alex
bruce
03-14-2011, 11:20 AM
The sample code you found is applicable only for our old MySQL offering (mySQL 3.5)
We no longer create ODBC DSN for mySQL 5.x.
With MySQL 5, you'll have to stick w/ mySQL .NET connector. I can post sample code if you need help.
Pacman
10-12-2011, 05:46 AM
ODBC Driver V6.0 to create DSN to a MySQL 5.x database:
docs.openlinksw.com/virtuoso/qsvdbsrv.html
vBulletin® ©Jelsoft Enterprises Ltd.