cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

I have difficulty using the xp_cmdshell to start an .exe file or a .batch file, which starts an exe, which in turns is a desktop application connecting to the database. so, from dbisql I write xp_cmdshell 'C:\\temp\\startreports.bat' Actually I have this problem only when I start the DBSRV10 from within a service (dbsvc).

Our startreports.exe is on environment and registry dependant, so that I start the service with a specific user (which has an appropriate profile for the exe) so it looks something like:

dbsvc -a WIN_USER -p WIN_PWD -s Manual -sd "SOME_DESCRIPTION" -t network -w SVC_NAME "C:\\Program Files (x86)\\SQL Anywhere 10\\win32\\dbsrv10.exe" -xs http(port=8888) -n SRV_NAME -c 768M "C:\\TEST\\DB1.db"

I dont see any other possibility to change the service (could the -i change something) (-i = allow service to interact with desktop), but I had always difficulty to add this option to the dbsvc!!

View Entire Topic
Baron
Participant

an interesting alternative is the SYSTEM statement, which can start an GUI from within DBISQL even if the DB is started as Service. The drawback is that this statement can only be used within dbisql, and can not be called within a procedure.

Breck_Carter
Participant
0 Likes

Have you tried the Windows START command from a call to xp_cmdshell?

VolkerBarth
Contributor
0 Likes

The question is what process runs the xp_cmdshell command. If the database server running as a service does start that command, you are pretty much still in the invisible window station and cannot show a GUI to the interactive user. That's my limited understanding, of course...

Baron
Participant
0 Likes

Yes I tried, it does the same thing, except that it starts the program in a new dos-window

Breck_Carter
Participant
0 Likes

So you are saying that you CAN run START from xp_cmdshell in a procedure running in a service, AND get a GUI showing?

FWIW START has a lot of options / capabilities, some of them [cough] magically confusing 🙂

Baron
Participant
0 Likes

No, I didnt say that. I said the SYSTEM statement can do that (start GUI application even if the DB is started as service).

Baron
Participant
0 Likes

I know that it took long time to discuss this subject, and I understand that it goes on the OS to allow or not allow desktop interaction for a service. I got the answer thankfully since last week, and with my new answer wanted just to mention the SYSTEM statement (which was for me new)

VolkerBarth
Contributor
0 Likes

wanted just to mention the SYSTEM statement (which was for me new)

FWIW, I wasn't aware of that command either, so thanks for that:)

Breck_Carter
Participant
0 Likes

New to me too, and embarrassing... because it dates back to V5.5 at least:

 User's Guide 
   Part VI. SQL Anywhere Reference
     Chapter 43. Watcom-SQL Statements
      SYSTEM statement
Function
To execute an operating system command from within ISQL.
Syntax
SYSTEM [ operating-system-command ]
Usage
ISQL (DOS and QNX only).