How To Access Remote MySQL Database in VB6

  • (2 Pages)
  • +
  • 1
  • 2

29 Replies - 10457 Views - Last Post: 01 February 2012 - 03:11 AM Rate Topic: -----

#1 Kenta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 02-December 11

How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 04:34 AM

Dear everyone,

I am trying to access the database from my PC where my WAMPSERVER
was installed and display the content of that database in my Laptop.

I am using cross-over cable to connect the PC and Laptop.

During execution, An error occured...

[MySQL][ODBC 5.1 Driver] Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061)



but I can access the phpmyAdmin of my server where I can edit the content of my database.

Can you give me some steps to follow on how or what to configure so that the vb6 app of my Laptop can query from server's database?

I am no expert with this so I am badly needing your help... :(

~Best Regards

Is This A Good Question/Topic? 0
  • +

Replies To: How To Access Remote MySQL Database in VB6

#2 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5380
  • View blog
  • Posts: 27,350
  • Joined: 10-May 07

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 04:38 AM

Did you forward port 3306 for the external interface? Is port 3306 open on the firewall of the hosting machine?
Was This Post Helpful? 0
  • +
  • -

#3 Kenta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 02-December 11

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 04:42 AM

I already turned off the firewall of my server PC and I think the default port was 3306 already,.. Should I configure it manually???
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5380
  • View blog
  • Posts: 27,350
  • Joined: 10-May 07

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 04:44 AM

If by remotely you mean outside of the building, then you need to forward port 3306 from the outside interface. For this you will need to refer to your routers documentation. There is also a good chance that if you have residential grade ISP service, the port is blocked by your ISP.
Was This Post Helpful? 0
  • +
  • -

#5 Kenta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 02-December 11

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 05:00 AM

What I meant for accessing database "remotely" was I am trying to access my database from my server PC by connecting PC and Laptop directly with cross-over cable. I am not using hub or switch to connect the two. It is not a big network, just a PC to Laptop connection...
Was This Post Helpful? 0
  • +
  • -

#6 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,793
  • Joined: 26-March 09

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 05:08 AM

What is the full connection string you've used and the code to open the connection?

In the past I've used the string below without issue.

DRIVER={MySQL ODBC 5.1 Driver};Persist Security Info=true;SERVER=servername;DATABASE=dbname;UID=root;PWD=password;OPTION=16427

Was This Post Helpful? 0
  • +
  • -

#7 Kenta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 02-December 11

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 05:19 AM

I inserted your code and my connection string was now

DRIVER={MySQL ODBC 5.1 Driver};SERVER= {Ip add of server};Persist Security Info=true;DATABASE= dbName;USER= root;PASSWORD="";OPTION = 16427



still,
[MySQL][ODBC 5.1 Driver] Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061)


Was This Post Helpful? 0
  • +
  • -

#8 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,793
  • Joined: 26-March 09

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 06:03 AM

Then please show us the code you're using to try and connect.

Also for completeness, which version of MySQL are you running?

Also, take a look at this link, where somebody says they solved a similar problem.

This post has been edited by maj3091: 31 January 2012 - 06:09 AM

Was This Post Helpful? 0
  • +
  • -

#9 Kenta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 02-December 11

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 06:15 AM


Public Function connectdb() As String
Dim strServerName As String
Dim strDatabaseName As String
Dim strPort As String
Dim strUserName As String
Dim strPassword As String

strServerName = "xxx.254.236.245"
strDatabaseName = "ptsdb"
strUserName = "root"
strPassword = ""


connectdb = "DRIVER={MySQL ODBC 5.1 Driver};" & _
            "SERVER=" & strServerName & ";Persist Security Info=true;DATABASE=" & strDatabaseName & _
            "USER=" & strUserName & ";PASSWORD=" & strPassword & ";OPTION = 16427"

End Function

Private Sub Form_Activate() 

Call connectdb
      
Set recordSetSearch = New ADODB.Recordset

    recordSetSearch.LockType = adLockOptimistic
    recordSetSearch.CursorType = adOpenDynamic
    recordSetSearch.CursorLocation = adUseClient
    
    recordSetSearch.Open "Select * from tbllogs", connectdb
        
    Set DataGrid1.DataSource = recordSetSearch

End Sub



Was This Post Helpful? 0
  • +
  • -

#10 Kenta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 02-December 11

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 06:26 AM

And Also I am using MySQL5.5.8...
Was This Post Helpful? 0
  • +
  • -

#11 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,793
  • Joined: 26-March 09

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 06:36 AM

did the link help at all?
Was This Post Helpful? 0
  • +
  • -

#12 Kenta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 02-December 11

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 06:46 AM

I am currently working on it,.. thanks for the link...

And I think my.cnf = my.ini...

I will post for an update after following the steps from the link you gave to me.. :)
Was This Post Helpful? 0
  • +
  • -

#13 Kenta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 02-December 11

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 07:13 AM

Still I can't connect after following the steps from the link...

if I change bind-address from 127.0.0.1 to 0.0.0.0, the error was

[MySQL][ODBC 5.1 Driver]Can't get hostname for your address



Is there something wrong with my code??? :cry2:
Was This Post Helpful? 0
  • +
  • -

#14 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,793
  • Joined: 26-March 09

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 07:40 AM

Hmmm...strange one.

Here's a couple of links with examples that should work.

Link 1
Link 2

They seem to open the connection independently using an ADODBConnection.

Might be worth a try.

This post has been edited by maj3091: 31 January 2012 - 07:43 AM

Was This Post Helpful? 0
  • +
  • -

#15 Kenta  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 02-December 11

Re: How To Access Remote MySQL Database in VB6

Posted 31 January 2012 - 07:53 AM

I'll will try those links right away... Hope it will solve my problem... I really appreciate your help.. thanks a lot...
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2