I am having a problem connecting to my Database. On my previous hosts server I had this line in my Web Config file and I was able to connect without any problems. add key= "cnnKiss" value= "Driver={MySQL ODBC 3.51 Driver};Server=myServerAddress;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;" The above key is not working on this server ..... Do I need to change the MySql ODBC driver to a different version or is it something else. Any help would be greatly appreciated. I did see your example connection but to use that I would have to totally rewrite a large number of pages which I don't want to do except as a last resort as it s many hours of work to be redone.
This is the old ODBC driver for MySQL and we do not have this ODBC driver. This is the version we have on our servers. http://support.Winhost.com/KB/a848/mysql-odbc-driver.aspx I'm afraid you will have to update your code to look for the correct ODBC driver version.
Thanks for that , so if I change the driver version to 5.1.7 in the config file this should solve the problem?? Has anybody out there successfully done this?? Thanks
If you are going to use a config file and I'm assuming web.config you should use the MySQL .Net/connector. Try looking at this kb article as an example. http://support.Winhost.com/KB/a833/how-to-connect-to-mysql-with-aspnet.aspx
Okay, I've given up trying to connect via the ODBC connector. Web research tends to suggest that while you have the driver installed the database is not setup to support it. I've rewritten some pages to use the connector strings you show in your example. Works perfectly if I'm connecting to your database from my machine but once I upload it I get a "Unable to connect to any of the specified MySQL hosts." error msg. Is the Database server accessed with the same server reference from within the site as from outside it?? in my case "my01.Winhost.com"
Really appreciate the help .....www.kisssigns.com.au is the URL for the page go to "Order a SIgn >Order on line" that's the only one using the database at the moment.
I can't seem to replicate the error. Can you give me more detailed instructions? Is there a test account I can use?
No there isn't a test account but you do need to enter something in the name and phone number fields because it sends me an email to let me know who placed(or attempted) to place an order. It also emails me the error msg if there is a problem..... just got two emails with the following msg:"There has been a F**k Up...Unable to connect to any of the specified MySQL hosts." Hope that helps.
Troubleshooting a full blown application can be fairly difficult if not impossible. That is because there are so many other features attached to it. Try setting up a simple application first and test from there. Then you build it up as you pass each stages of the test. This way you know where it is failing. Try reading this kb article and start from there. First create a simple ASP.net app to connect to the database and see where your connection string maybe wrong. http://support.Winhost.com/KB/a833/how-to-connect-to-mysql-with-aspnet.aspx
Okay, I'll try doing a very simple connection and see what happens but I don't think that will help unless it lets you check it more easily. The reason I say this is that my program when its running on my machine connects and writes to the Mysql database on your server without a problem so the connection string is okay at that point. The problem is when I upload the program to your server that's when it can no longer find the database.
Thinking that both your local computer and server are completely the same can be very misleading and often times hinder the process in solving the problem. I can only guess/assume is that your connection string maybe using some other MySQL driver to connect to our server and it is installed on your computer but not on our web server. That can make it work on your computer but not on our server. Honestly we will not know unless you run some tests and creating a small script can help verify that more quickly.
Hi Ray try this test program.....kisssigns.com.au still the same problem I can connect to the Winhost server from my machine without a hitch. The moment I upload the program to your server it can't connect to the database. But at least you get an error stack message now, perhaps this will help you see what the problem is. Tried to log on to the database server using MySqlWorkbench but that won't allow me to examine the security settings just the normal table data.
Increase the trust level on your application to either High or Full. Try looking at this kb article. http://support.Winhost.com/KB/a657/changing-the-default-aspnet-trust-level.aspx
Can't believe it....... finally it works Thanks for the help but I must say the Mysql database set up on your servers leaves a lot to be desired. In shear frustration I was looking to move to another hosting service over the weekend ..... tried setting up on another providers Mysql 5.1 database...... took all of twenty minutes copied my files up, changed the server in the config file and it was working using my original 3.xx ODBC connection. If they can make it so simple why can't you guys ????? Anyway that aside, Ray thanks for all your help and assistance without it I would have been moving on.
Sorry, but we have to make sure we install the correct drivers to the server. We just can't install any 3rd party drivers else we'll get some site working and others won't. In general the MySQL drivers is the latest and the standard that most .Net developers use. And for the second problem it was a trust level issue so its really not a MySQL issue but more of a ASP.Net issue.
Okay, heaps of people have read this string so just to recap all that has transpired in this saga of getting connected to my database, this is what I had to do and I hope it maybe of assistance to you or at least give you a pointer of where to look. Using the Mysql odbc driver doesn't want to work ..... I forgot about connecting that way. * - I update my MySql server on my machine to the latest version. * - Found and copied the "MySql.Data.dll" into my projects Bin Folder(downloaded mysql-connector-net-5.1-noinstall.zip from the web... it;s in the bin folder. * - Right clicked on the file in the Bin Folder and selected to added a reference * - Added "Imports MySql.Data.MySqlClient" to my vb code page * - Added "Imports MySql.Data.MySqlClient.MySqlConnection" to my vb code page * - Changed the connection string in the config file to "server=MySQL Server;database=MYSQL_database;user=DB Login;port=3306;password=DB password;" * - Added the line in the "system.web" section of the config file "<trust level="Full" /> * - Changed the connection code on the pages connection sub in line with the code that is found at the link http://support.Winhost.com/KB/a833/h...th-aspnet.aspx[/url] except I used a connection string in my config file rather than having it on the page, so if I change hosts all I have to do is edit the config file rather than recompile my project. Hope this helps somebody who is having problems.
Connecting to MySQL with simple ASP NOT ASP.NET Really?! This shouldn't be so friggen complicated! We were hosting on GoDaddy for crying out loud, which could arguably be called the WORST hosting service in the world. Then to move here and have to write complex ASP.NET code rather than simply changing the DB parameters (server, name, user, pass) is friggen ridiculous!! We have a small ASP NOT ASP.NET app. Default.asp includes db_conn_open.asp that states: Code: <% dim rs,conn const ConnStr = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=database.domain.com; PORT=3306; DATABASE=dbname; USER=dbuser; PASSWORD='password'; OPTION=0;" 'const ConnStr = "Provider=SQLNCLI;Server=WS1\SQLEXPRESS;Database=dbname;Uid=username; Pwd=password" set conn=server.CreateObject("ADODB.connection") set rs=server.CreateObject("ADODB.recordset") conn.Open connStr %> Going to the URL generates the following error: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified /reps/includes/db_conn_open.asp, line 7 In PHP MySQL, it's as easy as changing the database access credentials. Using that logic, and in accordance with the KB article here, I changed to the new ODBC driver as follows: Code: <% dim rs,conn const ConnStr = "DRIVER={MySQL ODBC 5.01.08.00 Driver}; SERVER=database.domain.com; PORT=3306; DATABASE=dbname; USER=dbuser; PASSWORD='password'; OPTION=0;" 'const ConnStr = "Provider=SQLNCLI;Server=WS1\SQLEXPRESS;Database=dbname;Uid=username; Pwd=password" set conn=server.CreateObject("ADODB.connection") set rs=server.CreateObject("ADODB.recordset") conn.Open connStr %> Nope, that doesn't work. I see this article suggesting writing a bunch of new code to access the database, but I don't write ASP code, and don't really want to pay someone to do something that should really be simple. Right? So, changing our db_conn_open.asp to the Winhost recommended code here: Code: <%@ import namespace="System.Data" %> <%@ import namespace="MySql.data.MySqlclient" %> <%@ import namespace="MySql.data.MySqlclient.MySqlConnection" %> <Script runat="server"> Sub page_load() Dim dbconn As MySqlConnection Dim dbCMD As MySqlCommand Dim dtr As MySqldatareader dbconn = New MySqlConnection("server=MySQL Server;database=MYSQL_database;user=DB Login;port=3306;password=DB password;") dbconn.open() dbCMD = New Mysqlcommand("select * from table_name", dbconn) dtr = dbCMD.executereader() While dtr.read() Response.Write("<li>") Response.Write(dtr(0) & "---" & dtr(1)) End While dtr.close() dbconn.close() End Sub </Script> results in the following error: Active Server Pages error 'ASP 0140' Page Command Out Of Order /reps/includes/db_conn_open.asp, line 1 The @ command must be the first command within the Active Server Page. Do you think we could get a little help from support to simply connect my hosted domain to my hosted database? Please?