ADO Connection problem in C++ Builder
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13

Thread: ADO Connection problem in C++ Builder

  1. #1
    Join Date
    Jul 2013
    Posts
    8

    ADO Connection problem in C++ Builder

    Hi my friends.I try to connect my application in C++ builder 6 from my home pc by ADOConnection string, to a database in MSSQL Server installed on my work pc that has a static IP(Public IP). I already open a UDP 1433 port on both routers (home & work)and i have apply an exception in both firewalls for SQL server and C++ application respectively...but i can't connect to database. Does anybody know the complete procedure step by step for the connection please ?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,471

    Re: ADO Connection problem in C++ Builder

    How does your ADOConnection string look like?
    What error/exception do you get?
    Victor Nijegorodov

  3. #3
    Join Date
    Jul 2013
    Posts
    8

    Re: ADO Connection problem in C++ Builder

    One of the connection strings that i try

    Provider=SQLOLEDB.1;Persist Security Info=False;User ID=xxxxx;Data Source=192.168.1.15;Network Address=xx.xx.xx.xxx;Network Library=DBMSSOCN

    I return the routers port to TCP/IP 1433 (so the Network Library=DBMSSOCN)
    Network address = SQL Server Public IP
    Data source =SQL Server Local IP

    I'm sure something is wrong but i don't know what...

  4. #4
    Join Date
    Apr 1999
    Posts
    27,434

    Re: ADO Connection problem in C++ Builder

    Quote Originally Posted by GeoAstrix View Post
    One of the connection strings that i try

    Provider=SQLOLEDB.1;Persist Security Info=False;User ID=xxxxx;Data Source=192.168.1.15;Network Address=xx.xx.xx.xxx;Network Library=DBMSSOCN

    I return the routers port to TCP/IP 1433 (so the Network Library=DBMSSOCN)
    Network address = SQL Server Public IP
    Data source =SQL Server Local IP

    I'm sure something is wrong but i don't know what...
    Your functions don't return error or status codes? Do you check them in your program?

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Jul 2013
    Posts
    8

    Re: ADO Connection problem in C++ Builder

    Can't find SQL Server or access denied

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,471

    Re: ADO Connection problem in C++ Builder

    Quote Originally Posted by GeoAstrix View Post
    Can't find SQL Server or access denied
    Is TCP/IP enabled? (look at the SQL Server Configuration manager!)
    Victor Nijegorodov

  7. #7
    Join Date
    Jul 2013
    Posts
    8

    Re: ADO Connection problem in C++ Builder

    Yes Victor .TCP/IP (port 1433) and Named Pipes Protocols are enabled

  8. #8
    Join Date
    Apr 1999
    Posts
    27,434

    Re: ADO Connection problem in C++ Builder

    Quote Originally Posted by GeoAstrix View Post
    Yes Victor .TCP/IP (port 1433) and Named Pipes Protocols are enabled
    How do we know it's not something simple, such as a bad or stray character in your connect string? How about showing us how you are setting this string. In C++, there are many ways to screw up string handling.

    Second, do you have an existing application that you did not write that attempts to do what you're trying to do? If so, does it work correctly?

    Regards,

    Paul McKenzie

  9. #9
    Join Date
    Jul 2013
    Posts
    8

    Re: ADO Connection problem in C++ Builder

    My application running without problems in my work LAN.The problem appears in attempt to connect from other pc (out of LAN).Probably the declaration of public ip is incorrect or the restrictions from both router and firewall not allow the connection .

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,471

    Re: ADO Connection problem in C++ Builder

    did you ask the network/LAN admin?
    Victor Nijegorodov

  11. #11
    Join Date
    Jul 2013
    Posts
    8

    Re: ADO Connection problem in C++ Builder

    Unfortunately.....i am the admin .I am agricultural scientist and hydroponic greenhouse owner.Also i am "Information and Telecommunication" student so i am trying to serve my network without experience.

  12. #12
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,471

    Re: ADO Connection problem in C++ Builder

    Quote Originally Posted by GeoAstrix View Post
    Unfortunately.....i am the admin
    Then try to turn off the firewall.
    Besides, SQLOLEDB is obsolete (for SQL Server 2000). You should use SQLNCLI11 for the recent versions.
    Victor Nijegorodov

  13. #13
    Join Date
    Jul 2013
    Posts
    8

    Re: ADO Connection problem in C++ Builder

    I found my mistake.

    Wrong syntax:
    Network address = SQL Server Public IP
    Data source =SQL Server Local IP

    Correct syntax:
    Network address =SQL Server Local IP
    Data source =SQL Server Public IP

    thanks for your time and your interest .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center