ODBC Connection Error

Hi,

I am creating an ODBC connection to get data from external DB but it show me an error "Unable to log on to database

[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

"

Here is my code;

LoginProperty loginProperty;

OdbcConnection odbcConnection;

Statement statement;

ResultSet resultSet;

LoginProperty myLoginProperty;

str sql, criteria;

int output;

SqlStatementExecutePermission perm;

str myUserName=“sa”;

str myPassword=“Superadmin786”;

str myConnectionString;

;

myConnectionString=strfmt(“UID=%1;PWD=%2”,myUserName,myPassword);

myLoginProperty = new LoginProperty();

myLoginProperty.setDSN(“wss1”);

//myLoginProperty.setServer(“192.168.200.36:1433”);

myLoginProperty.setDatabase(“phcDB”);

myLoginProperty.setOther(myConnectionString);

//Create a connection to external database.
try
{
odbcConnection = new OdbcConnection(myLoginProperty);
}
catch
{
throw error(“Error creating ODBC Connection”);
}

if (odbcConnection)

{

sql =“SELECT * FROM tblTrainingForWebSite”;

//Assert permission for executing the sql string.

perm = new SqlStatementExecutePermission(sql);

perm.assert();

//Prepare the sql statement.

statement = odbcConnection.createStatement();

resultSet = statement.executeQuery(sql);

while(resultSet.next())
{

info(resultSet.getString(1));//AccountNum
}

resultSet.close();
statement.close();

}

else

{

error(“Failed to log on to the database through ODBC.”);
}

According to the error message, you’re trying to log into the database with an account from a different, untrusted domain. Reconsider your strategy for authentication with the database. If you want to use username and password instead of Windows authentication, you’ll have to reconfigure the database server.