ODBC Connection to MS-SQL Server when starting as service

General chat about HostMonitor (all messages posted before March 07, 2003 available here).
Blackjack
Posts: 5
Joined: Mon Jan 13, 2003 6:00 pm

Post by Blackjack »

Hi,
I've problems using the odbc log when using hostmon as a service. Starting Hostmon as a "normal" program, everything is fine and it writes logs to my MS SQL 2000 Server. Hostmon runnig as service has problems to find the odbc connection. A problem could be that Hostmon only finds User-DSN and no System-DSN as ODBC connection. Any idea what to do ?


User avatar
Marcus
Posts: 367
Joined: Mon Nov 18, 2002 6:00 pm

Post by Marcus »

Hostmonitor uses only the user-dsn. This means you can't use the system account when running HM as a service AND want to log to a database (the system account only sees system-dsn).

Solution:
Run HM with a user account (non system account), login as that user and create the odbc connection as a user-dsn.

When running as a service (under the above user account) HM will find the connection.
Blackjack
Posts: 5
Joined: Mon Jan 13, 2003 6:00 pm

Post by Blackjack »

That wasn't the solution,
I started the service with another account, - the account I used for installing the User DSN. But it had no effect, I don't see the ODBC connection in HM. I just used the HM option for changing the logon of the service. Changing the service setting directly has also no effect.
Are there any other possibilities ?

User avatar
Marcus
Posts: 367
Joined: Mon Nov 18, 2002 6:00 pm

Post by Marcus »

I can only say what I have done:

Create a user account

Log in using the above account and create the USER-DSN.

Start HM with the above user account as a service.

Stop HM service, start HS as an application (still as the above user).

Set the startup options in HM with the same account. Change the advanced logging options.

Save the settings and stop the application and start the service (still running under the above user account).

Don't forget if you start HM as application with a different account, you wil not see the USER-DSN (which was created for a different user).

If this still doesn't work, I'm out of suggestions.
Blackjack
Posts: 5
Joined: Mon Jan 13, 2003 6:00 pm

Post by Blackjack »

Hey, you were right. Thanx a lot !

The only problem is, that the tray icon is no more there. Is that normal ?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

I think you don't see icon because you changed user account using standard Service application from Control Panel instead of setup user account in the HostMonitor's Options dialog. In order to fix this stop HostMonitor service, change account back to "local system" account, enable "allow service to interact with desktop" option, start HostMonitor as application, and setup user account on Service page in the Options dialog. Close application, start service.
http://www.ks-soft.net/hostmon.eng/mfra ... tm#Service
http://www.ks-soft.net/hostmon.eng/mfra ... tm#Service

Regards
Alex
User avatar
Marcus
Posts: 367
Joined: Mon Nov 18, 2002 6:00 pm

Post by Marcus »

In order to fix this stop HostMonitor service, change account back to "local system" account, enable "allow service to interact with desktop" option, start HostMonitor as application, and setup user account on Service page in the Options dialog. Close application, start service.
But will you be able to use the USER-DSN?? This is not available for the system account, only SYSTEM-DSN is. This was the problem he started with.
Blackjack
Posts: 5
Joined: Mon Jan 13, 2003 6:00 pm

Post by Blackjack »

Right, than I've the same problem, I can't see the user DSN then. But thats ok, it works fine although I don't see the system tray.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

H'm, interesting...
I checked code and made some experiments, it looks like impersonating the security context of the user does not have any effect for some ODBC functions (probably because these functions work with registry). I cannot find any mentioning about this problem in MSDN documentation :sad: Will try to find some workaround.

Regards
Alex
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Ok, there is solution at http://www.ks-soft.net/download/hm358.zip
Now HostMonitor uses system-DSN when started in service mode.

Regards
Alex
User avatar
Marcus
Posts: 367
Joined: Mon Nov 18, 2002 6:00 pm

Post by Marcus »

I downloaded the update, created a system-dsn (the same as my user-dsn) and it worked. Assuming HM actually uses the system-dsn when started as a service (which I did not check).

But when starting HM as an application (for configuration) I still *only* see the user-dsn.

This is very confusing. The problem lies in the fact that I don't have control over the console and use Terminal Services to configure HM. Therefor I have to stop the HM running as a service and start it as an application.

If the two types of execution use different types of configuration, it's bound to happen that failures arise.

So my suggestion is to use the same dsn configuration (user or system) for both types of execution (service or application).

If it has any influence, I prefer the system-dsn.......
Guest

Post by Guest »

I think I'll also prefer the system DNS,
it works very good now with the update.
Good job.
Right, it's confusing - without documentation. Maybe you can put both possibilities (System and User DSN) in the
options dialog.


Blackjack
Posts: 5
Joined: Mon Jan 13, 2003 6:00 pm

Post by Blackjack »

I think I'll also prefer the system DNS,
it works very good now with the update.
Good job.
Right, it's confusing - without documentation. Maybe you can put both possibilities (System and User DSN) in the
options dialog.


agressiv
Posts: 35
Joined: Sun Oct 06, 2002 6:00 pm

Post by agressiv »

I've been using a System DSN since before 3.50 and never had to do anything special - just make sure the SQL user had INSERT rights to the table - I've never used User DSN's (user DSNs = bad) and we've been running as a service since day 1...

/gw
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Ok, there is update at http://www.ks-soft.net/download/hm361.zip
(just update to HM 3.60 (release) before using update).
Update has new option that allows you to choose DSN (option located on Miscellaneous page in the Options dialog). This option has effect when HM running as regular application, in service mode can be used system DSN only.

Regards
Alex
Locked