Subject | Re: [firebird-support] Calling isql.exe from a windows batch |
---|---|
Author | Mark Rotteveel |
Post date | 2012-07-26T08:04:04Z |
On Wed, 25 Jul 2012 16:06:33 -0000, "zsmeier" <zsmeier@...> wrote:
http://www.javaworld.com/jw-12-2000/jw-1229-traps.html
You should also try to read (and log) the output from the error stream and
output stream exposed by the Process object. Also check if the user running
the service has read and write access on C:\temp.
BTW: If you are using Java, wouldn't it be easier to just execute those
statements from within Java using Jaybird?
Mark
> Hi,You might want to look at
> I have a problem calling isql.exe from a windows batch file, which is
> called from a running service.
>
> I wrote a simple java program, which calls a windows batch script with a
> parameter:
> System.exec("c:\Temp\hook.cmd foo").
>
> The batch script first writes a select statement into a file using the
> parameter:
> echo select if from users where name = 'foo' >> c:\Temp\statement.sql
> ...and second calls the isql.exe command with the file as input
> parameter and an output parameter to write the result
> <PATH_TO_FIREBIRD_BIN>\isql.exe -user sysdba -password masterkey
> <PATH_TO_DB>\database.fdb -i c:\temp\statement.sql -o c:\temp\result.txt
> I run this Java program from a console, it works just perfect, I have
> the results in the result.txt. Great!
> Installing the Java program as a windows service, the result.txt remains
> empty. The hook.cmd is called, the statement.sql is generated, but
> then... there are no results in the result.txt.
>
> Has anybody an idea? Had anybody a problem like this?
> Has this something to do with "current user" if the application runs as
> a Service (Which is SYSTEM)? There is not possible to connect with isql
> if the user is not the current windows user?
>
> Any help or clue would be greatly appreciated! Thanks.
http://www.javaworld.com/jw-12-2000/jw-1229-traps.html
You should also try to read (and log) the output from the error stream and
output stream exposed by the Process object. Also check if the user running
the service has read and write access on C:\temp.
BTW: If you are using Java, wouldn't it be easier to just execute those
statements from within Java using Jaybird?
Mark