Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

ODBC Batch Import - Error

Posted on by 87

 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

  • anne.M Profile Picture
    anne.M 45 on at
    RE: ODBC Batch Import - Error

    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.

  • Jens Kroeger Profile Picture
    Jens Kroeger 87 on at
    RE: ODBC Batch Import - Error

    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

  • anne.M Profile Picture
    anne.M 45 on at
    RE: ODBC Batch Import - Error

    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.

  • Jens Kroeger Profile Picture
    Jens Kroeger 87 on at
    RE: ODBC Batch Import - Error

    Hi,

    in my case I cratered the connection on the Batch Server.

  • anne.M Profile Picture
    anne.M 45 on at
    RE: ODBC Batch Import - Error

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: ODBC Batch Import - Error

    Create the DSN on the batch server and try..

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: ODBC Batch Import - Error

    where is your DSN created? is it on the local machine form where you are running it?

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.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,219 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans