Announcements
No record found.
Hi,
Need urgent help.
I am using below code for establishing ODBC connection but getting error as
"ODBC operation failed.Unable to log on to the database."
Please help.
static void SITestODBC(Args _args) { OdbcConnection oDBCConnection; LoginProperty loginProperty; str connectionString; try { connectionString = "DSN=RFIDDB_UAT;Database=myTest_db;UID=sa;PWD=$1234;"; loginProperty = new LoginProperty(); loginProperty.setOther(connectionString); oDBCConnection = new ODBCConnection(loginProperty); if(oDBCConnection) { info("success"); } } catch { throw error("@CHI814"); } }
Hi Rhushikesh Raut,
How did you create your DSN?
You don't need to put the username and password in your connection string.
Try the following code:
loginProperty = new LoginProperty(); loginProperty.setDSN("dsnName"); loginProperty.setDatabase("databaseName"); odbcConnection = new OdbcConnection(loginProperty);
Refer to:docs.microsoft.com/.../how-to-connect-to-an-external-database-from-x-code
Hi Will, I will test the connection directly from Administrative tools first and will update you. It might be the case that the credentials have been changed as before this error I was able establish connection with same code.
Hi Rhiushikesh,
Please check if any permissions have been changed on the external database as well. That could also cause this issue.
also maks sure you are allow required Ports through firewall(s)
1433 (ODBC)
netbios (UDP ports 137, 138 & TCP 139 for NetBIOS over TCP)
Regards,
Amith Prasanna
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Giorgio Bonacorsi 653
André Arnaud de Cal... 493 Super User 2026 Season 1
Syed Haris Shah 317 Super User 2026 Season 1