By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,796 Members | 1,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,796 IT Pros & Developers. It's quick & easy.

Problem connecting to remote MySQL DB from VB6

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.