vb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • santhanalakshmi
    New Member
    • May 2009
    • 147

    vb

    Hi,

    I cant able to find out my problem itself.......gr eat confusion.when i connecting my local mysql database(xp) on to my local machine(xp),its working fine ,no problem at all.

    I have installed "Mysql ODBC 3.51 Driver".

    While,i am trying the same thing.But there is an difference.Here ,
    I am connecting mysql database (from remote machine xp) to my local machine(xp) where i am running my visual basic program.

    My Code:

    Private Sub gen_Click()
    Dim cn1 As New ADODB.Connectio n
    Dim generate As New ADODB.Command
    Dim rs1 As New ADODB.Recordset


    Set cn1 = New ADODB.Connectio n
    cn1.ConnectionS tring = "driver={My SQL ODBC 3.51 Driver};server= 10.93.199.253;d atabase=org;dat a source=org1;Per sist Security Info=True;Optio n=3"
    cn1.Open

    With generate
    .ActiveConnecti on = cn1
    .CommandType = adCmdText
    .CommandText = "select uid from user"
    End With

    Set rs1 = generate.Execut e
    Open "C:\org.txt " For Output As #2
    While Not rs1.EOF
    Print #2, rs1.Fields(0);
    rs1.MoveNext
    Wend
    Close #2

    End Sub



    when,i running my program.The following error comes out

    Run-time error '-2147467259(8000 4005)':
    [Microsoft][ODBC Driver Manager]Data Source name not found and no default driver specified.


    I cant able to find out my problem........ ..please help me


    In remote machine,
    (1)I turned ON the firewall
    (2)Given Grant permission
    (3)ODBC connection
    Under System DSN:
    i) DSN name=org1
    ii)Server: Localhost
    iii)user:root and no password
    iv)Database name=org


    These are the steps which i followed in the remote machine,where i am going to access mysql database "org"



    Please solve my error.......... ........


    Thanks in advance........


    Regards,
    santhanalakshmi
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    are you able to connect to the database directly in the remote server from your system ?

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      Once you have Mentioned ServerName and Database Name, I guess, no need to mention DSN Name..
      Try this :

      cn1.ConnectionS tring = "driver={My SQL ODBC 3.51 Driver};server= 10.93.199.253;d atabase=org;"

      Regards
      Veena

      Comment

      Working...