Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET(vb) + MySQL using ODBC .NET Provider & MyODBC 3.51

Status
Not open for further replies.

kisk

Programmer
Feb 14, 2003
21
US
I have a weird situation here. I'm programming a web application and it needs to be able to access a MySQL db.

Let me go head and say that for all tests I've done, I am using my webhost's mysql database.

The app connects to my host's mysql db just fine when the app runs on my computer, but when I upload it to my host's computers and try to run it on their servers, it won't connect (or stay connected) to the database.

Here's an example of the code I'm using:

#### Code Start ####

Imports Microsoft.Data.Odbc 'ODBC .NET Provider

Public Class clsMySQLAccess

Public Function dbConnect() As String

Const MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=mysql.4ph.com;" & _
"DATABASE={EDITED_OUT};" & _
"UID={EDITED_OUT};" & _
"PASSWORD={EDITED_OUT};" & _
"OPTION=3;"

Dim MyConnection As New OdbcConnection(MyConString)


Try
MyConnection.Open()
Return MyConnection.State.ToString
Catch ex As OdbcException
Return "OdbcException --> " & ex.ToString
Catch ex2 As Exception
Return "Exception --> " & ex2.ToString
End Try

End Function

End Class

#### End Code ####


Now like I said, when I run this code from my computer, it executes beautifully and the function returns "Open" from the connection state. I can then carry out any other queries I like just fine.

If I take the exact same code, upload it and run it off my host's computers, I don't get any exceptions, but the function always returns "Closed" as the connection state. Obviously, because of this state I can't do anything else really. I find it very strange that the code can connect when its on my computer, but the exact same code won't connect(or at least stay connected) on the host's computer.

Anyone have any ideas why I'm experiencing this? I'm thinking that maybe my app isn't finding the ODBC .NET Provider or the MyODBC driver... but I'd get an exception error initially if it couldn't find those right?

I've tried everything I can to get this to work and I'm pretty much at a dead end now. I've talked with my host and they can't seem to figure out what's up either. They even set up a DSN for me and we tried it that way but came up with the same results.

Any ideas??

Thanks,
kisk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top