简体   繁体   中英

How to get the correct connection string for c# to teradata?

I have been trying to establish connection to teradata.

Since there is already a odbc on my computer, for Java the string looks like

String connURL = "jdbc:odbc:DatabaseName" // and it works!


I need to establish the connection in c# . So I tried

TdConnection cn = new TdConnection ("Data Source = odbc:DatabaseName; User ID = xxx; Password = ooo;")

But it did not accept this string. What is the correct way to write the Data Source ? What is the jdbc counterpart in c# ?

You are using ODBC so you must only specify DSN:

DSN=myDsn;Uid=myUsername;Pwd=;

The jdbc:odbc is just a designation that the java driver uses and is not carried over to ODBC in .NET. I would suggest you use ADO.NET if that is an option.

or this for the TDConnection:

Data Source=myDsn;User Id=uid;Password=pwd;

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