Can't connect on localhost, can from network

Can't connect on localhost, can from network

Postby dschwabe » Tue 26 Sep 2006 17:02

Hey everyone, I built a windows application in visual studio 2005 that connects to mysql just fine from desktop machines on the network.

Now I would like to move the application to the server's shared directory so that I don't have to install it on each user's machine individually.

So I changed the 'host' parameter in application's connection string from our server name to 'localhost', compiled, and plopped the files into the shared folder making sure to include CoreLab.MySql.dll.

The application runs until I need to use mysqldirect at which point I get "Can't connect to MySQL server on 'localhost'(10061)" Yet I have no problems executing my application from desktop machines.

I have not installed the .NET framework on the server and I'd rather not if I don't have to. I assume this is not a problem since the app runs until it's time to connect to mysql? But if that is so, why can't I connect from the server?

I'm new to MySQL, .NET, I know little about our Windows Server (2003) and I couldn't find any posts that addressed this.
dschwabe
 
Posts: 7
Joined: Tue 26 Sep 2006 16:34

Postby Alexey » Wed 27 Sep 2006 08:29

Your application is executed on the client if you run it from the shared folder. Please use the right host name in the connection string.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby dschwabe » Wed 27 Sep 2006 20:14

I'm confident the host name is correct because it works when my application is on a desktop machine. It is also apparent to me from the speed at which my connection is rejected that the host name is correct.

I've used the server machine name, 'localhost', and the IP address as the host paramenter, all to no avail :|

I appreciate the response, can you think of anything else that might be causing this error?
dschwabe
 
Posts: 7
Joined: Tue 26 Sep 2006 16:34

Postby dschwabe » Wed 27 Sep 2006 20:57

Here is the connection string I'm using:

User Id=root;Password=myPass;Host=myMachineName;Port=3306;Database=mySchema;Protocol=tcp;
dschwabe
 
Posts: 7
Joined: Tue 26 Sep 2006 16:34

Postby Alexey » Thu 28 Sep 2006 05:58

Where do you run your application from?
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby dschwabe » Thu 28 Sep 2006 17:35

I have tried putting the application in our server's designated shared folder as well as C: and D: root directories. I've ensured that these directories grant full permissions to users that access them and have no trouble actually opening the program from these directories. It is only when I attempt to connect to mysql that I get the exception.
dschwabe
 
Posts: 7
Joined: Tue 26 Sep 2006 16:34

Postby Alexey » Fri 29 Sep 2006 07:12

Dear dschwabe, i understand that you put the application in your server's designated shared folder. But what machine do you run the application from? From the server or from a desktop machine?
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby dschwabe » Fri 29 Sep 2006 16:54

I misunderstood you; I run the application from a desktop machine. That is my goal. Thanks again.
dschwabe
 
Posts: 7
Joined: Tue 26 Sep 2006 16:34

Deployment strategies

Postby john@haldi.net » Mon 02 Oct 2006 22:19

This is a shot in the dark, but I think the problem you are experiencing is that you don't have the MySQL components installed in the GAC on the machines you are trying to run it on (when it fails). You say you have tried it on desktop machines, but my bet is that the desktop machines in question are devel machines and already have the MySQL component installed on them.

If you then attempt to run the application from a machine that doesn't have the devel tools on it, it ought to fail since the components aren't in the GAC.

A better deployment strategy would be to publish the application to the server, and then have users run the installed setup program which will put the required components in the GAC. If you go this route, make sure to override the "Auto" setting for the MySQL components and instead select the "Include" option which will force the publish package to install the components into the user's desktop GAC.
john@haldi.net
 
Posts: 38
Joined: Tue 07 Mar 2006 17:13

Postby Alexey » Tue 03 Oct 2006 08:16

Thanks, John, for your suggestion, but i think the problem crops up due to the fact that the application is run from a desktop machine with "localhost" parameter in connection string. That's why it cannot connect to a database, because it looks for the database on the localhost instead of the server.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby dschwabe » Tue 03 Oct 2006 14:25

John: I'm not sure which development tools I might be missing on the server. I copied the mysqldirect dll into my application's directory. Maybe I need to install mysqldirect on the server? I'm open to try anything, I'm out of ideas.

Alexey: I created a test application that will adjust the host parameter of my connection string on the fly. I've tried every concievable parameter (machine name, ip address, localhost) and can't get it to connect when my app resides on the server.

I'm fairly certain that I set the app directory on the server to allow full access but I am a noob at server stuff and I'd feel silly if this turned out to be a server issue. I'm about to give up on this, if only temporarily.
dschwabe
 
Posts: 7
Joined: Tue 26 Sep 2006 16:34

Postby Alexey » Wed 04 Oct 2006 14:48

OK, usually we do not give advices about configuring client or server because this exceeds goals of our support. But in this case we made an exclusion and scrutinized the problem.
You should do the following (relates to Windows XP):
1. On each desktop PC choose Start --> Control Panel --> Administrative Tools.
2. Run Microsoft .NET Framework Configuration.
3. Go to Console Root --> Microsoft .NET Framework Configuration --> My Computer --> Runtime Security Policy.
4. Click on "Adjust Zone Security".
5. Set "Full Trust" level for Local Intranet.
You are done.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby dschwabe » Thu 05 Oct 2006 18:43

That was the solution, my local intranet trust was not set at full.

Thank you, and thank you for an excellent product as well :)
dschwabe
 
Posts: 7
Joined: Tue 26 Sep 2006 16:34

Postby Alexey » Fri 06 Oct 2006 09:43

You are welcome.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL