Subject | Calling isql.exe from a windows batch |
---|---|
Author | zsmeier |
Post date | 2012-07-25T16:06:33Z |
Hi,
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.
Zsolt.
[Non-text portions of this message have been removed]
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.
Zsolt.
[Non-text portions of this message have been removed]