简体   繁体   English

如何获得c#到teradata的正确连接字符串?

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

I have been trying to establish connection to teradata. 我一直在努力与teradata建立联系。

Since there is already a odbc on my computer, for Java the string looks like 由于我的计算机上已有odbc ,因此对于Java来说,字符串看起来像

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


I need to establish the connection in c# . 我需要在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 ? 编写Data Source的正确方法是什么? What is the jdbc counterpart in c# ? c#中jdbc对应是什么?

You are using ODBC so you must only specify DSN: 您正在使用ODBC,因此您只能指定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. jdbc:odbc只是java驱动程序使用的名称,不会在.NET中转移到ODBC。 I would suggest you use ADO.NET if that is an option. 我建议你使用ADO.NET,如果这是一个选项。

or this for the TDConnection: 或者这个用于TDConnection:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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