472,958 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Problem connecting to remote MySQL DB from VB6

Hello all

The following code allows me to connect to a local MySQL database on my pc
from a VB6 project.

************************************************** **************************
**
Dim conn As ADODB.Connection
Dim cs As String
Dim MyServer As String
Dim MyDb As String
Dim MyUserID As String
Dim MyPass As String

MyServer = "servername"
MyDb = "database"
MyUserID = "MrUser"
MyPass = "password"

Set conn = New ADODB.Connection

cs = "DRIVER={MySQL ODBC 3.51 Driver};"
cs = cs & "server=" & MyServer & ";"
cs = cs & "database=" & MyDb & ";"
cs = cs & "uid=" & MyUserID & ";"
cs = cs & "password=" & MyPass & ";"

conn.ConnectionString = cs
conn.CursorLocation = adUseClient
conn.Open cs

************************************************** *************************

However when I try to use it to connect to a remote database residing on my
hosting companies server. I get the following message

Runtime error '-2147467259(80004005)':
[MySQL][ODBC 3.51 Driver]Access denied for user:
'm*************@client-80-13-38-51.brhm.adsl.virgin.net' (Using
password:YES)

The connection info re user, password, database, host etc are all correct.
And the database can be connected to from my site using SQL in PHP script. I
have the latest MyODBC installed correctly. Has anyone experienced this and
if so how can it be resolved. In the error message it seems to think Im
using a password 'YES' however I have no such password and am not using it
in my code anywhere.

Ian
Oct 11 '05 #1
4 8353
Are you sure that the host exposes the MySQL database out? Some host will
only allow access to MySQL DB's through (local) and not through an IP
address - I have had this issue with a host before...

How do you connect to the DB through PHP? Is the server listed as (local).

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Ian Davies" <ia********@virgin.net> wrote in message
news:Tb***************@newsfe1-gui.ntli.net...
Hello all

The following code allows me to connect to a local MySQL database on my pc
from a VB6 project.

************************************************** **************************
**
Dim conn As ADODB.Connection
Dim cs As String
Dim MyServer As String
Dim MyDb As String
Dim MyUserID As String
Dim MyPass As String

MyServer = "servername"
MyDb = "database"
MyUserID = "MrUser"
MyPass = "password"

Set conn = New ADODB.Connection

cs = "DRIVER={MySQL ODBC 3.51 Driver};"
cs = cs & "server=" & MyServer & ";"
cs = cs & "database=" & MyDb & ";"
cs = cs & "uid=" & MyUserID & ";"
cs = cs & "password=" & MyPass & ";"

conn.ConnectionString = cs
conn.CursorLocation = adUseClient
conn.Open cs

************************************************** *************************

However when I try to use it to connect to a remote database residing on
my
hosting companies server. I get the following message

Runtime error '-2147467259(80004005)':
[MySQL][ODBC 3.51 Driver]Access denied for user:
'm*************@client-80-13-38-51.brhm.adsl.virgin.net' (Using
password:YES)

The connection info re user, password, database, host etc are all correct.
And the database can be connected to from my site using SQL in PHP script.
I
have the latest MyODBC installed correctly. Has anyone experienced this
and
if so how can it be resolved. In the error message it seems to think Im
using a password 'YES' however I have no such password and am not using it
in my code anywhere.

Ian

Oct 12 '05 #2
Thanks for the reply

I create the PHP files on my pc and upload them to the hosts server. I
connect with php using the following in my script.
mysql_pconnect($hostname, $username, $password)

presumably this is local as the PHP files are on the hosts server?
How do you connect to the DB through PHP? Is the server listed as (local).
How can I confirm if the server listed as (local)?
How did you overcome the problem when you encountered it with your host? I
hope your not going to say I changed host :). Ive just paid for two years
hosting (I hope they offer refund)

Ian
"Veign" <NO***********@veign.com> wrote in message
news:uo**************@TK2MSFTNGP14.phx.gbl... Are you sure that the host exposes the MySQL database out? Some host will
only allow access to MySQL DB's through (local) and not through an IP
address - I have had this issue with a host before...

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Ian Davies" <ia********@virgin.net> wrote in message
news:Tb***************@newsfe1-gui.ntli.net...
Hello all

The following code allows me to connect to a local MySQL database on my pc from a VB6 project.

************************************************** ************************** **
Dim conn As ADODB.Connection
Dim cs As String
Dim MyServer As String
Dim MyDb As String
Dim MyUserID As String
Dim MyPass As String

MyServer = "servername"
MyDb = "database"
MyUserID = "MrUser"
MyPass = "password"

Set conn = New ADODB.Connection

cs = "DRIVER={MySQL ODBC 3.51 Driver};"
cs = cs & "server=" & MyServer & ";"
cs = cs & "database=" & MyDb & ";"
cs = cs & "uid=" & MyUserID & ";"
cs = cs & "password=" & MyPass & ";"

conn.ConnectionString = cs
conn.CursorLocation = adUseClient
conn.Open cs

************************************************** *************************
However when I try to use it to connect to a remote database residing on
my
hosting companies server. I get the following message

Runtime error '-2147467259(80004005)':
[MySQL][ODBC 3.51 Driver]Access denied for user:
'm*************@client-80-13-38-51.brhm.adsl.virgin.net' (Using
password:YES)

The connection info re user, password, database, host etc are all correct. And the database can be connected to from my site using SQL in PHP script. I
have the latest MyODBC installed correctly. Has anyone experienced this
and
if so how can it be resolved. In the error message it seems to think Im
using a password 'YES' however I have no such password and am not using it in my code anywhere.

Ian


Oct 12 '05 #3
Try uploading something like PhpMyAdmin and play around with the server
setting. Set it to (local) and verify it works, now try the IP address or
domain to the DB Server and see if that works.

How I overcame it was switch hosts. They would not expose the MySQL server
out and only supported access through Local from a website on the server.

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Ian Davies" <ia********@virgin.net> wrote in message
news:sa***********@newsfe7-gui.ntli.net...
Thanks for the reply

I create the PHP files on my pc and upload them to the hosts server. I
connect with php using the following in my script.
mysql_pconnect($hostname, $username, $password)

presumably this is local as the PHP files are on the hosts server?
How do you connect to the DB through PHP? Is the server listed as
(local).


How can I confirm if the server listed as (local)?
How did you overcome the problem when you encountered it with your host? I
hope your not going to say I changed host :). Ive just paid for two years
hosting (I hope they offer refund)

Ian
"Veign" <NO***********@veign.com> wrote in message
news:uo**************@TK2MSFTNGP14.phx.gbl...
Are you sure that the host exposes the MySQL database out? Some host
will
only allow access to MySQL DB's through (local) and not through an IP
address - I have had this issue with a host before...


--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Ian Davies" <ia********@virgin.net> wrote in message
news:Tb***************@newsfe1-gui.ntli.net...
> Hello all
>
> The following code allows me to connect to a local MySQL database on my pc > from a VB6 project.
>
> ************************************************** ************************** > **
> Dim conn As ADODB.Connection
> Dim cs As String
> Dim MyServer As String
> Dim MyDb As String
> Dim MyUserID As String
> Dim MyPass As String
>
> MyServer = "servername"
> MyDb = "database"
> MyUserID = "MrUser"
> MyPass = "password"
>
> Set conn = New ADODB.Connection
>
> cs = "DRIVER={MySQL ODBC 3.51 Driver};"
> cs = cs & "server=" & MyServer & ";"
> cs = cs & "database=" & MyDb & ";"
> cs = cs & "uid=" & MyUserID & ";"
> cs = cs & "password=" & MyPass & ";"
>
> conn.ConnectionString = cs
> conn.CursorLocation = adUseClient
> conn.Open cs
>
> ************************************************** ************************* >
> However when I try to use it to connect to a remote database residing
> on
> my
> hosting companies server. I get the following message
>
> Runtime error '-2147467259(80004005)':
> [MySQL][ODBC 3.51 Driver]Access denied for user:
> 'm*************@client-80-13-38-51.brhm.adsl.virgin.net' (Using
> password:YES)
>
> The connection info re user, password, database, host etc are all correct. > And the database can be connected to from my site using SQL in PHP script. > I
> have the latest MyODBC installed correctly. Has anyone experienced this
> and
> if so how can it be resolved. In the error message it seems to think Im
> using a password 'YES' however I have no such password and am not using it > in my code anywhere.
>
> Ian
>
>



Oct 12 '05 #4
I will look into your suggestions
The idea was to be able to collect records from the remote database to the
client DB using VB. I am wondering if it is a restriction put in place by my
host would it be possible to do the transfer of records from the server side
using the website and PHP scripts to the users databases. If so what
technologies would be needed to do this?
Ian

"Veign" <NO***********@veign.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Try uploading something like PhpMyAdmin and play around with the server
setting. Set it to (local) and verify it works, now try the IP address or
domain to the DB Server and see if that works.

How I overcame it was switch hosts. They would not expose the MySQL server out and only supported access through Local from a website on the server.

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Ian Davies" <ia********@virgin.net> wrote in message
news:sa***********@newsfe7-gui.ntli.net...
Thanks for the reply

I create the PHP files on my pc and upload them to the hosts server. I
connect with php using the following in my script.
mysql_pconnect($hostname, $username, $password)

presumably this is local as the PHP files are on the hosts server?
How do you connect to the DB through PHP? Is the server listed as
(local).


How can I confirm if the server listed as (local)?
How did you overcome the problem when you encountered it with your host? I
hope your not going to say I changed host :). Ive just paid for two years hosting (I hope they offer refund)

Ian
"Veign" <NO***********@veign.com> wrote in message
news:uo**************@TK2MSFTNGP14.phx.gbl...
Are you sure that the host exposes the MySQL database out? Some host
will
only allow access to MySQL DB's through (local) and not through an IP
address - I have had this issue with a host before...


--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Ian Davies" <ia********@virgin.net> wrote in message
news:Tb***************@newsfe1-gui.ntli.net...
> Hello all
>
> The following code allows me to connect to a local MySQL database on my
pc
> from a VB6 project.
>
>

************************************************** ************************** > **
> Dim conn As ADODB.Connection
> Dim cs As String
> Dim MyServer As String
> Dim MyDb As String
> Dim MyUserID As String
> Dim MyPass As String
>
> MyServer = "servername"
> MyDb = "database"
> MyUserID = "MrUser"
> MyPass = "password"
>
> Set conn = New ADODB.Connection
>
> cs = "DRIVER={MySQL ODBC 3.51 Driver};"
> cs = cs & "server=" & MyServer & ";"
> cs = cs & "database=" & MyDb & ";"
> cs = cs & "uid=" & MyUserID & ";"
> cs = cs & "password=" & MyPass & ";"
>
> conn.ConnectionString = cs
> conn.CursorLocation = adUseClient
> conn.Open cs
>
>

************************************************** *************************
>
> However when I try to use it to connect to a remote database residing
> on
> my
> hosting companies server. I get the following message
>
> Runtime error '-2147467259(80004005)':
> [MySQL][ODBC 3.51 Driver]Access denied for user:
> 'm*************@client-80-13-38-51.brhm.adsl.virgin.net' (Using
> password:YES)
>
> The connection info re user, password, database, host etc are all

correct.
> And the database can be connected to from my site using SQL in PHP

script.
> I
> have the latest MyODBC installed correctly. Has anyone experienced this > and
> if so how can it be resolved. In the error message it seems to think Im > using a password 'YES' however I have no such password and am not

using it
> in my code anywhere.
>
> Ian
>
>



Oct 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: maddunr | last post by:
Hi, I just installed PHP 4.3.9, MySQL 4.0.2 and PHPMyAdmin 2.6.0-pl3 on our intranet server (Win2k3 running IIS). I also have a similar setup on my local machine (http://localhost/phpmyadmin). ...
3
by: kamilla | last post by:
I have a mysql 3.5 server installed on a suse linux 8.1, with address 10.0.0.100. Now I want to access that db from a W2K pc, address 10.0.0.200. I am able to ping 10.0.0.100, but I cannot connect...
3
by: David | last post by:
Hi, Ive been trying to work this out for the past 2 days now and im not getting anywhere fast. The problem i have is that i am using Asynchronous sockets to create a Socket Client library....
2
by: John | last post by:
Hi I was working fine with create user wizard and the default membership provider. I have now customised the membership provider as per attached web.config. The create user wizard picks up the...
8
by: Kevin D. | last post by:
Please note, I already posted this on the MySQL official forum, but received no response. I thought I'd try again in another location. My apologies to anyone reading this twice... Despite...
0
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
1
by: ynyus75 | last post by:
Hey! I am unable to connect some of the services that I host from my laptop at home, such as SMTP and MySQL on port numbers 25 and 3306 respectively. But I am able to some services such as...
1
by: spatro | last post by:
Hi, I am trying to install DBD::mysql using the CPAN and I am facing the following error: cpan> install DBD::mysql CPAN: Storable loaded ok Going to read /root/.cpan/Metadata Warning:...
4
by: Cyprus106 | last post by:
I realize how I'm going about this is somewhat odd. I have to construct a program for windows mobile that only sends a couple queries to a remote MySQL server and hopefully gets some success/fail...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.