web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

ODBC Batch Import - Error

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Community Member Profile Picture
    on at

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

  • Community Member Profile Picture
    on at

    Create the DSN on the batch server and try..

  • anne.M Profile Picture
    45 on at

    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.

  • Jens Kroeger Profile Picture
    87 on at

    Hi,

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

  • anne.M Profile Picture
    45 on at

    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
    87 on at

    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
    45 on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans