.NET Provider Invalid Connection String

Connectivity

.NET Provider Invalid Connection String

Hi,

i am using .net provider for Teradata 1.2.0.0 (also i tried version 1.1.0.0) with Visual Studio 2005 project.

String sConnection = "Data Source=" + sDataSource + ";User ID=" + sUser + ";Password=" + sPassword;
DbProviderFactory pf = DbProviderFactories.GetFactory("Teradata.Client.Provider");
DbConnection con = pf.CreateConnection();
con.ConnectionString = sConnection;
con.Open();

When i try to open connection, i get "Invalid Connection String" exception.

Any idea?

3 REPLIES
Teradata Employee

Re: .NET Provider Invalid Connection String

Can you try this?

    public class Program
{
static void Main(String[] args)
{
DbProviderFactory factory =
DbProviderFactories.GetFactory("Teradata.Client.Provider");

TdConnectionStringBuilder conStrBuilder = (TdConnectionStringBuilder)
factory.CreateConnectionStringBuilder();

conStrBuilder.DataSource = "X";
conStrBuilder.UserId = "Y";
conStrBuilder.Password = "Z";

DbConnection cn = factory.CreateConnection();

try
{
cn.ConnectionString = conStrBuilder.ConnectionString;

cn.Open();

DbCommand cmd = cn.CreateCommand();
cmd.CommandText = "SELECT CURRENT_TIMESTAMP";
Console.WriteLine(cmd.ExecuteScalar());
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
finally
{
if (cn != null)
{
cn.Close();
}
}
}
}


Does your UserID and or Password has a single quote or dougle quote in it?

Re: .NET Provider Invalid Connection String

i found the problem.
it is about Regional Settings.

when use English it runs.
but i am using Turkish so when i try, i get exception that i said.
Teradata Employee

Re: .NET Provider Invalid Connection String

I know the Data Provider has been tested on Japanese machines because it is localized for Japan.

Does TdConnectionStringBuilder help with this issue? Did you create Unicode source-code and make sure that "Data Source", "User ID" and "Password" keywords use the corresponding ASCII/LATIN character ranges?