I'm having trouble connecting a VB app on one computer to a MySQL database on another
I've created a contact manager application in Visual Basic and I want to save the contact records to a MySQL database on another computer on the same network. Would anyone be able to provide some insight into this? I have installed MySQL Workbench along with the appropriate connectors and the .NET framework on both computers.
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
What connection driver are you using?
Is your connection driver installed?
Are you using IP address or hostname on your connection?
Have you check your connectionstring if correct?
Or maybe your connection object is setup but no recordset?
Or a firewall on the server is not permitting connection?
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
Quote:
Originally Posted by
albra
I've created a contact manager application in Visual Basic and I want to save the contact records to a MySQL database on another computer on the same network. Would anyone be able to provide some insight into this? I have installed MySQL Workbench along with the appropriate connectors and the .NET framework on both computers.
Have you previously tested the application on the local machine?
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
Yes, I've tested the application locally on a machine with MySQL and it worked perfectly: a connection was established and the contact records were saved to the database.
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
I have looked at the thread and I have applied some of the suggestions but I still can't get it to work. As I said above, the program connects with the database, as long as the database is on the same computer. However, when I try to connect to the database from a different machine in the same network, I am presented with an error saying "Unable to connect to any of the specified MySQL hosts."
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
1) What is the connection string you're using?
2) actually, before I go on with 2 & possible 3, I need to know #1 first.
-tg
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
MySQLConnection.ConnectionString =
"server=localhost;port=3306;userid=root;password=password;database=contacts"
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
Can you even access that computer where mysql is installed? Can you open its shared folders? Are they on the same workgroup? Are they on the same IP class?
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
The computers are not in a workgroup or anything similar to that at the moment, so I can't access shared folders but they are in the same IP class.
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
They should be in the same workgroup or domain and you must be able to access its Shared folders, at least that's what I also did in addition to adding per host wanting to connect to that computer which has mysql installed.
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
I have now created a workgroup between the machines. I posted my connection string earlier, you'll notice the server is "localhost" I know that this won't work for a different computer trying to connect to the database, what should I use instead?
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
The name of the computer where mysql is installed.
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
Quote:
Originally Posted by
albra
MySQLConnection.ConnectionString =
"server=localhost;port=3306;userid=root;password=password;database=contacts"
Well that's why... you're accessing localhost... which is the same computer you're running on (everuy computer is "localhost") ... you need to give it either the IP or computer name..
-tg
Re: I'm having trouble connecting a VB app on one computer to a MySQL database on ano
Thanks for the explanation, I changed it to the computer name and now it works.