简体   繁体   中英

OleDBConnection error Database Server Not Found C#

I'm trying to connect to a remote SQL Anywhere 10 database server using the following connection string but receiving a "Database Server Not Found" error.

OleDbConnection conn = new OleDbConnection("Provider=SAOLEDB.10;ENG=dental;DBN=dentserv;
LINKS=tcpip(host=192.168.1.100,PORT=2638);
Integrated Security = True; User ID = dba; PWD = sql");

Using the same code, I can connect to a local database that is setup the same way as the remote server I'm attempting to connect to without any issue:

OleDbConnection conn = new OleDbConnection("Provider=SAOLEDB.10;Data Source = dental; 
Database=dental;Integrated Security = True; User ID = dba; PWD = sql");

I've added and removed multiple variables within the string to troubleshoot to see if there was anything missing (ENG instead of Data Source, with and without DBN, DSN, etc.), most seem to be interchangeable but always throwing the same error of no server.

For some additional information, I am able to connect to this server database using a different database management tool using the same port IP credentials with no issue. It's Database URL is: jdbc:sybase:Tds:192.168.1.100:2638?ServiceName=

Connection String: DBN=DENTSERV;DSN=DENTAL;UID=DBA;PWD=SQL

Any thoughts? I've been working on this for awhile with no further progress. Any insight will be much appreciated!

The host (host=192.168.1.100); appears to be a private IP (IP for your local network), you cant use that for remote access you may use a Public IP also the server need to be configured for remote access.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM