|
From: Ted H. <odi...@ho...> - 2005-03-28 18:58:10
|
Thanks for the reply Leif.
The key piece of information was that Wrapper runs as a different user by
default when run as a service vs as a console.
I uninstalled the service then added the line:
wrapper.ntservice.account=DOMAIN\username
to wrapper.conf. I then reinstalled the service.
Then (in Win2k) I added that same DOMAIN\username to "Control Panel /
Administrative Tools / Local Security Policy / Local Policies / User Rights
Assignments / Log on as Service / Security ... / Add ..."
Then I modified the properties of the installed (Wrapper) service so that it
would log on as the same DOMAIN\username as above by changing "Control Panel
/ Administrative Tools / Services / (Wrapper Service) Properties / Log on
(tab) / "This Account ... ".
Incidentally, with an NT machine, the process is a bit more straight
forward. After modifying wrapper.conf and installing the service, update
the service properties by setting "Log on as this account" to
DOMAIN\username. WinNT then indicated that the "Log on as Service Right
Assignment" was automatically made to that DOMAIN\username.
Thanks a bunch for pointing me in the right direction.
-- Ted
From: Leif Mortenson
Ted,
Unless you have specified an account to run as in the wrapper.conf
file, the Wrapper
will run as the SYSTEM user when running as an NT service. When run as
a console
app, it is run as the user you have logged in as.
From the error message, my first guess is that the file that stores the
ODBC
data source data. Make sure that the SYSTEM user has access to that file.
Another common mistake is to declare the ODBC data source for the
current user rather than as a system-wide data source. If you do this then
your
user will be able to see it, but the SYSTEM user will not.
Post back with the results.
Cheers,
Leif
Ted Hammond wrote:
>My application runs off two datasources. One datasource uses a pure jdbc
>driver (to get to MySQL) and the other uses the jdbc:odbc bridge to reach
>Access.
>
>When I run the application as a Console as in
>
>--> Wrapper Started as Console
>
>everything runs super fine.
>
>When I run the application as a Service as in
>
>--> Wrapper Started as Service
>
>the pure jdbc datasource performs properly but the odbc datasource bombs :(
>
>I get (from wrapper.log only when running the application as a service):
>
>
>
>>java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]
>>The Microsoft Jet database engine cannot open the file '(unknown)'.
>>It is already opened exclusively by another user, or you need permission
to
>>
>>
>view its data.
>
>
>>at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
>>at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
>>at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
>>at
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
>>at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
>>at java.sql.DriverManager.getConnection(DriverManager.java:512)
>>at java.sql.DriverManager.getConnection(DriverManager.java:171)
>>
>>
>
>etc.
>
>The mdb (Access) datasource is set up without any username / password
>required.
>
>Why does everything work fine when run as a Console but not as a Service?
>
>I read the other ODBC thread from 8/2004 but that didn't seem to shine much
>light on my problem. The ODBC datasource is set up as "System DSN". I am
>having this problem on NT4 as well as on Win2k.
>
>Any help would be really appreciated. Thanks.
>
|