|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem connecting to remote MySQL DB from VB6The 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: 'mydatabasen***@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 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). -- Show quoteHide quoteChris 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" <iandan.***@virgin.net> wrote in message news:TbY2f.175$N57.145@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: > 'mydatabasen***@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 > > 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 Show quoteHide quote "Veign" <NOSPAMinveign@veign.com> wrote in message news:uoXsYzszFHA.1040@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" <iandan.***@virgin.net> wrote in message > news:TbY2f.175$N57.145@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: > > 'mydatabasen***@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 > > > > > > 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. -- Show quoteHide quoteChris 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" <iandan.***@virgin.net> wrote in message news:saa3f.9$fz3.3@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" <NOSPAMinveign@veign.com> wrote in message > news:uoXsYzszFHA.1040@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" <iandan.***@virgin.net> wrote in message >> news:TbY2f.175$N57.145@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: >> > 'mydatabasen***@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 >> > >> > >> >> > > 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 Show quoteHide quote "Veign" <NOSPAMinveign@veign.com> wrote in message news:%23aE4p80zFHA.2540@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" <iandan.***@virgin.net> wrote in message > news:saa3f.9$fz3.3@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" <NOSPAMinveign@veign.com> wrote in message > > news:uoXsYzszFHA.1040@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" <iandan.***@virgin.net> wrote in message > >> news:TbY2f.175$N57.145@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: > >> > 'mydatabasen***@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 > >> > > >> > > >> > >> > > > > > > Hi
Well i did connect my MYSQL server from Remote computer using IP address but i did'nt see the port number on your connection string. The default mysql port is 3306. Check if you windows Firewall not blocking this port.. BYE Show quoteHide quote "Ian Davies" <iandan.***@virgin.net> wrote in message news:o3c3f.9719$6c4.9704@newsfe5-win.ntli.net... >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" <NOSPAMinveign@veign.com> wrote in message > news:%23aE4p80zFHA.2540@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" <iandan.***@virgin.net> wrote in message >> news:saa3f.9$fz3.3@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" <NOSPAMinveign@veign.com> wrote in message >> > news:uoXsYzszFHA.1040@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" <iandan.***@virgin.net> wrote in message >> >> news:TbY2f.175$N57.145@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: >> >> > 'mydatabasen***@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 >> >> > >> >> > >> >> >> >> >> > >> > >> >> > > Hi Arif
What is the syntax to include the port, and where in the string would it be places? Ian Show quoteHide quote "Arif Dhuka" <arifdh***@hotmail.com> wrote in message news:%23NF13HT0FHA.1264@tk2msftngp13.phx.gbl... > Hi > Well i did connect my MYSQL server from Remote computer using IP address but > i did'nt see the port number on your connection string. The default mysql > port is 3306. Check if you windows Firewall not blocking this port.. > > BYE > > > "Ian Davies" <iandan.***@virgin.net> wrote in message > news:o3c3f.9719$6c4.9704@newsfe5-win.ntli.net... > >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" <NOSPAMinveign@veign.com> wrote in message > > news:%23aE4p80zFHA.2540@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" <iandan.***@virgin.net> wrote in message > >> news:saa3f.9$fz3.3@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" <NOSPAMinveign@veign.com> wrote in message > >> > news:uoXsYzszFHA.1040@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" <iandan.***@virgin.net> wrote in message > >> >> news:TbY2f.175$N57.145@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: > >> >> > 'mydatabasen***@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 > >> >> > > >> >> > > >> >> > >> >> > >> > > >> > > >> > >> > > > > > >
Is there a more elegant way to do this?
Command Button Sequence populating combobox Update Workstations with new executable How many ORs can you have in ADODB Need to know when a process is exited form_load parameters - novice Expot datas in to excel sheet Best way to have a subroutine modify more than one variable Scheduling Control |
|||||||||||||||||||||||