I have found a workaround like this. Say my batch operation is done
one 10.00 everyday. I have created a .bat file, which closes the
ax32.exe client and restarts it (when it restarts it automatically
begins doing the batching as you explained to me). I have added
this .bar file to scheduled tasks of Windows. It starts at 9.55,
closes the ax32.exe client (in case it stopped due to an error on
network connection) and restarts it. When it is 10 o'clock batch
operation starts. I would make this restarting ax32.exe operation
more frequently but as far as I know the smallest time period of
scheduled tasks in windows is 1 day. Perhaps a script or small
program can be written to do this every one hour, but I don't know
how to do. Anyway doing this everyday is fine.
Thanks for the codes in your reply, I will adapt them to mine.
Volkan
--- In [EMAIL PROTECTED], Bj�rn Gudbrand Idstad
<[EMAIL PROTECTED]> wrote:
> 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:
> > > development-axapta-
[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 Sponsor
> ADVERTISEMENT
> click here
<http://rd.yahoo.com/SIG=12cuo3vk5/M=268585.4521611.5694062.1261774/D=
egroupweb/S=1705006764:HM/EXP=1079770455/A=1950450/R=0/SIG=124efgk3i/*
http://ashnin.com/clk/muryutaitakenattogyo?YH=4521611&yhad=1950450>
> <http://us.adserver.yahoo.com/l?
M=268585.4521611.5694062.1261774/D=egroupweb/S=:HM/A=1950450/rand=4546
28592>
>
>
> _____
>
> 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 Sponsor | |
|
|
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]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

