Title: Message
Hi!
 
Have you figured out a way of solving this problem?
 
What does the batch-job that you are referreing to actually do?
Is it used to e.g synchronize data between an Axapta database and some other database? And how often does this job start?
 
Anyway, I guess you connect to the database using ODBCConnenction,
If he connection to the database is lost you will get an error either when you try to create an instance of the OBDCConnection-object, providing the necessary login-properites, or you will get an error when you try to use the executeQuery or executeUpdate-methods of the Statement-object.
 
So these are the scenarioes where you would like to catch any errors.
 
So looking at this method you will find that any errors are caught (either internal or error) and the messages in the infolog are cleared, preventing these from popping on the screen.
If the batch-job uses this method to create the ODBC-connection and further uses this connection to synchronize data, you can make the batch-job not do the job that it is ment to do if the creation of the object fails.
 
E.g
 
if (this.createODBCConnection())
    this.syncData() // Runs until it is finished
else
    // Do nothing, wait for next time the batch-job starts (if the connection is re-established it will be able to create the connection this time)
 
In the syncData-method you will most likely call the executeQuery or executeUpdate-methods. Calls to any of these method should be placed in an try-catch-clause. The same goes with calls to methods on the resultSet-object (when you get the data in your query).
 
So if the connection is lost whilst running the batch-job
 
private boolean createODBCConnection()
{
    LoginProperty   loginProperty = new LoginProperty();
    HNDMedIntegrationParameters intParameters;
    ;
 
    intParameters = HNDMedIntegrationParameters::find();
 
    loginProperty.setDSN(intParameters.ODBCDSN);
    loginProperty.setUsername(intParameters.ODBCUserId);
    loginProperty.setPassword(intParameters.ODBCPassword);
 
    try
    {
        odbcConnection = new OdbcConnection(loginProperty);
    }
    catch (Exception::Error)
    {
        infoLog.clearBrowser();
        infoLog.clear(0);
    }
    catch (Exception::Internal)
    {
        infoLog.clearBrowser();
        infoLog.clear(0);
    }
 
    return odbcConnection ? true : false;
}
 
- Bj�rn
 
-----Original Message-----
From: vozadali [mailto:[EMAIL PROTECTED]
Sent: 19. mars 2004 09:14
To: [EMAIL PROTECTED]
Subject: [development-axapta] Re: Bj�rn Gudbrand, Windows service instead of batch jobs

When I tried today the ax32.exe in the scheduled tasks started on the
foreground, I mean the Axapta application started visually.

But on yesterday as I mentioned below it just started as an operation
on windows tasklist but not visually.

Anyway the problem when the database connection is lost, still
persists. This batch client will run on server machine, and I should
have a way to understand it it crashes.

Thanks

--- In [EMAIL PROTECTED], "vozadali" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> Thank you very much for your explanation. I have done all the
things
> you said. But there is still another problem.
>
> When I run the Axapta as a scheduled task, the Axapta application
> doesn't start visually, instead it is run on background. I mean
> ax32.exe exists in the tasklist of the Windows but I cannot see the
> Axapta application. It does the batching operation correctly on
> background.
>
> The problem is that, if an error occurs on the connection with the
> database, normally Axapta client gives an error message and quits
> when we click the buttons that appear. But when running as a
> scheduled task we don't have a chance to click that buttons and
> ax32.exe doesn't kill itself. So we have no way that the ax32.exe
is
> running on the background or it has been interrupted and not
running
> due to a database error, I think.
>
> Do you have an idea what to do when an error occurs on database
> connection? How can we catch that situation and take precautions to
> restart the Axapta client when connection with the database is
> established?
>
> Thank you very much.
>
> Volkan.
>
> --- In [EMAIL PROTECTED], Bj�rn Gudbrand Idstad
> <[EMAIL PROTECTED]> wrote:
> > Hi!
> > 
> > You can add a Scheduled task (Start->All programs->Accessories-
> >System Tools->Scheduled Tasks).
> > Add the ax32.exe file from you client bin-directory. Set the
> desired time that you want your application to run e.g when the
> computer startes. Enter a username and a password.
> > Now when you have created the task select it in the Scheduled
task-
> form, right-click and select properties.
> > In the run-control add a regconfig-reference to the path
> (C:\Axapta\Client\Ax25ClientSP3\Bin\ax32.exe "-regconfig=AUTOBATCH"
> > 
> > Create a regconfig named AUTOBATCH using the Config Editor.
> > In the startup command-setting add BATCH=MAIL. Save the config.
> > 
> > Now you create a batchgroup called MAIL in Axapta, then add the
> mail-batchjob to that group.
> > 
> > You may also make Axapta skip the logon-window and have it logged
> on automatically. You do this by selecting Tools->Options.
> > On the General-tab->Network account name enter the account that
use
> when you log on to the computer.
> > 
> > So if this is done correctly Axapta will now start automatically
> whenever the computer is restarted and then run the batch-jobs in
the
> MAIL-batchgroup.
> > 
> > Regards
> > Bj�rn
> >
> >       -----Original Message-----
> >       From: Andrae, Tobias [mailto:[EMAIL PROTECTED]
> >       Sent: 5. mars 2004 08:19
> >       To: [EMAIL PROTECTED]
> >       Subject: AW: [development-axapta] Windows service instead of
> batch jobs
> >      
> >      
> >       ...put Axapta in the autostart group ;-)
> >       br Tobias
> >      
> >       -----Urspr�ngliche Nachricht-----
> >       Von: vozadali [mailto:[EMAIL PROTECTED]
> >       Gesendet: Donnerstag, 4. M�rz 2004 21:24
> >       An: [EMAIL PROTECTED]
> >       Betreff: [development-axapta] Windows service instead of
> batch jobs
> >      
> >       Hi guys,
> >      
> >       As far as I know one client should always be kept running for
> >       executing batch jobs, but this is not a very good solution. I
> am
> >       sending periodical mails to employees in Axapta using various
> >       criteria, and currently I do it using a class which works as
> a batch
> >       job. But the computer it resides is usually automatically
> restarts
> >       due to security updates of Windows, and the client is
> restarted
> >       manually.
> >      
> >       Does anybody knows a better solution for sending periodical
> mails?
> >       Can we create a windows service for that?
> >      
> >       Thanks
> >      
> >      
> >      
> >      
> >      
> >       Yahoo! Groups Links
> >      
> >      
> >      
> >      
> >      
> >      
> >      
> >   _____ 
> >
> >       Yahoo! Groups Links
> >      
> >
> >       *      To visit your group on the web, go to:
> >             http://groups.yahoo.com/group/development-axapta/
> >              
> >       *      To unsubscribe from this group, send an email to:
> >             [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]
> subject=Unsubscribe>
> >              
> >       *      Your use of Yahoo! Groups is subject to the Yahoo!
> Terms of Service <http://docs.yahoo.com/info/terms/> .




Yahoo! Groups Links

Reply via email to