Hello everyone.
I have a little problem, I wrote a class in AX 2009 witch imports data from a DB2 database. For the connection I use ODBC (System-DNS).
The class runs directly without any problems, only as batch job, I get an error: The user can not login to Database. But tht user and the password are part of the odbc settings.
public void run()
{
loginProperty loginProperty = new LoginProperty();
ODBCConnection odbcConnection;
Statement sql;
ResultSet result;
;
//BP Deviation documented
loginProperty.setDSN('DNSNAME');
//BP Deviation documented
odbcConnection = new ODBCConnection(loginProperty);
if (odbcConnection)
{
//BP Deviation documented
sql = odbcConnection.createStatement();
//BP Deviation documented
result = sql.executeQuery("Select * from DEMOTbl");
while (result.next())
{
......
}
*This post is locked for comments
Dear Jens,
Thank you so much for your explanation. It does help fix my problem.turns out , I create system dsn at the wrong server.
Happy holiday !
Regards,
Anne.
Hello.
An entry must be made on the batch server in the DNS system. Important, if you open it via the start menu, probably the 64 bit version will be opened, I have also entered it in the 32 bit version. Of course as a system DNS entry.
In addition, I have entered it on the AOS server, which is not running as a batch server.
Unfortunately, that was a few years ago, at the moment I am working more with 2012 and 365.
Best wishes from my holiday in Norway
Jens
Hi Jens,
thanks for responding. Could you elaborate a little bit more on 'connection on the batch server' statement? i did not get your point. does that means you use system DSN to achieve that or how?
regards,
Anne.
Hi,
in my case I cratered the connection on the Batch Server.
Hi,
I know its been years but I'm having the same problem.I already created dsn in the sys dsn for both 64 and 32 bit but still get the same error. do anyone have solutions for this? thanks.
Create the DSN on the batch server and try..
where is your DSN created? is it on the local machine form where you are running it?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156