1- ODBC operation failed.
Unable to log on to the database.
2- [Microsoft[ODBC SQL Server Driver[SQL ServerLogin failed. The login is from an untrusted domain and cannot be used with Integrated authentication.
3- Object 'OdbcConnection' could not be created
Hi all i am trying to pull some data from external databse to ax table so i configured a DSN and the connection was successfully, i called it to x but the connection failed
LoginProperty loginProperty; OdbcConnection odbcConnection; Statement statement; ResultSet resultSet; str sql, criteria; SqlStatementExecutePermission perm; MYTABLE MYTABLE; ; // Set the information on the ODBC. loginProperty = new LoginProperty(); loginProperty.setDSN('DSN'); loginProperty.setDatabase('DB'); //Create a connection to external database. odbcConnection = new OdbcConnection(loginProperty); if (odbcConnection) { sql = 'SELECT * FROM MYTABLE ORDER BY FIELD ASC ;'; //Assert permission for executing the sql string. perm = new SqlStatementExecutePermission(sql); perm.assert(); //Prepare the sql statement. statement = odbcConnection.createStatement(); resultSet = statement.executeQuery(sql); //Cause the sql statement to run, //then loop through each row in the result. while (resultSet.next()) { //It is not possible to get field 3 and then 1. //Always get fields in numerical order, such as 1 then 2 the 3 etc. info(resultSet.getString(1)); info(resultSet.getString(2)); info(resultSet.getString(3)); info(resultSet.getString(4)); } //Close the connection. resultSet.close(); statement.close(); } else { error('Failed to log on to the database through ODBC.'); }
So any help please