473,786 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Connectio n
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.Connectio n

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

conn.Connection String = cs
conn.CursorLoca tion = 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(8000 4005)':
[MySQL][ODBC 3.51 Driver]Access denied for user:
'm************* @client-80-13-38-51.brhm.adsl.vi rgin.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 8419
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********@vir gin.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.Connectio n
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.Connectio n

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

conn.Connection String = cs
conn.CursorLoca tion = 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(8000 4005)':
[MySQL][ODBC 3.51 Driver]Access denied for user:
'm************* @client-80-13-38-51.brhm.adsl.vi rgin.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******** ******@TK2MSFTN GP14.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********@vir gin.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.Connectio n
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.Connectio n

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

conn.Connection String = cs
conn.CursorLoca tion = 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(8000 4005)':
[MySQL][ODBC 3.51 Driver]Access denied for user:
'm************* @client-80-13-38-51.brhm.adsl.vi rgin.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********@vir gin.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******** ******@TK2MSFTN GP14.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********@vir gin.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.Connectio n
> 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.Connectio n
>
> cs = "DRIVER={My SQL ODBC 3.51 Driver};"
> cs = cs & "server=" & MyServer & ";"
> cs = cs & "database=" & MyDb & ";"
> cs = cs & "uid=" & MyUserID & ";"
> cs = cs & "password=" & MyPass & ";"
>
> conn.Connection String = cs
> conn.CursorLoca tion = 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(8000 4005)':
> [MySQL][ODBC 3.51 Driver]Access denied for user:
> 'm************* @client-80-13-38-51.brhm.adsl.vi rgin.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******** ********@TK2MSF TNGP09.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********@vir gin.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******** ******@TK2MSFTN GP14.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********@vir gin.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.Connectio n
> 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.Connectio n
>
> cs = "DRIVER={My SQL ODBC 3.51 Driver};"
> cs = cs & "server=" & MyServer & ";"
> cs = cs & "database=" & MyDb & ";"
> cs = cs & "uid=" & MyUserID & ";"
> cs = cs & "password=" & MyPass & ";"
>
> conn.Connection String = cs
> conn.CursorLoca tion = 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(8000 4005)':
> [MySQL][ODBC 3.51 Driver]Access denied for user:
> 'm************* @client-80-13-38-51.brhm.adsl.vi rgin.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
2062
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). Everything seems normal when I work on the server machine (also known as web-nt with IP xxx.xxx.xx.xx), but when I try connecting to the MySQL database on the server from my local machine (http://web-nt/phpmyadmin), two things happen:
3
6173
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 to the db, and get error 2013. I have tried with MySQL Administrator 1.0 and also with ODBC. The db on linux has grant all on *.* to ''@'10.0.0.%' and also tried .... to root@10.0.0.200 and others seen on posted messages. I can access that db...
3
5135
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. When i try to connect to a server that doesnt exist it raises a "Connection forcibly rejected by the resmote host" SocketException.
2
3560
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 custom membership provider fine and removes the security question/answer fields as designated in the custom provider. The problem is that when I try to create a new user in the create user wizard by entering the info and pressing the 'create...
8
55682
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 everything I've tried, I cannot get MySQL to start as a Windows service. However, I AM able to get it started via the mysqld-nt --console command. Here is my (funky) setup:
0
3922
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 development client. Bur Its gives me following error message. I searched lots of things on net and tried on remote server but i didnt got suceess. Can any one tell me how to set TCP\IP connection protocol on server for particular instance. Becuase I think
1
2389
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 Telnet, Remote Desk Connection, SSH. Here are my details ISP: Time Warner Connection Type: Cable Router: Lynksys Port Farwarding: enabled port farwarding to HTTP, Telnet, HTTPS, Remote Desktop Connection, SSH, MySQL etc to my laptop. Connection...
1
4351
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: Found only 0 objects in /root/.cpan/Metadata CPAN: LWP::UserAgent loaded ok
4
1862
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 returns. (I've got VS2008 pro and the winmobile SDKs) The 2 problems I have: 1) I'm very well versed in C++, and I know a little C#. I managed to compile some simple winmobile programs, but I'd be more comfortable grabbing a couple of walkthroughs...
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10360
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.