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 ?
Re: ADO Connection problem in C++ Builder
How does your ADOConnection string look like?
What error/exception do you get?
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...
Re: ADO Connection problem in C++ Builder
Quote:
Originally Posted by
GeoAstrix
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
Re: ADO Connection problem in C++ Builder
Can't find SQL Server or access denied
Re: ADO Connection problem in C++ Builder
Quote:
Originally Posted by
GeoAstrix
Can't find SQL Server or access denied
Is TCP/IP enabled? (look at the SQL Server Configuration manager!)
Re: ADO Connection problem in C++ Builder
Yes Victor .TCP/IP (port 1433) and Named Pipes Protocols are enabled
Re: ADO Connection problem in C++ Builder
Quote:
Originally Posted by
GeoAstrix
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
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 .
Re: ADO Connection problem in C++ Builder
did you ask the network/LAN admin?
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.
Re: ADO Connection problem in C++ Builder
Quote:
Originally Posted by
GeoAstrix
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.
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 .