B4J Question NSSM/Webserver app/SQL Server connect

Jones Hone

Active Member
Licensed User
Longtime User
I have a web server app.
Use jtds-1.3.1-a.jar to connect to MS sql server.
Everything is OK.

In the same APP, on the same computer, in the same directory.
I use "NSSM" to make the app a windows service.
It can be made into a service and web server starts correctly.
But only SQL SERVER connection fails!
It returns the following message:
"java.sql.SQLException: Unable to open database "TESTDB" requested for login. Login failed."

I switched back to running it with java.exe -jar myapp.jar and it all worked fine again.

Has anyone encountered this problem?
Or is "JDTS" not able to be executed in then service mode?
 

aeric

Expert
Licensed User
Longtime User
A related thread
 
Upvote 0

Isaacc

New Member
Could be a permission issue. Set the service to run as a user with SQL access or grant NT AUTHORITY\SYSTEM access in SQL Server.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I am not familiar with running services on Windows.
Maybe you need to use Windows server edition or configure it to run more like a server, like disabling power saving mode or sleep.

Ask AI for advice.
 
Upvote 0

JohnF76

Member
Licensed User
Longtime User
I have a web server app.
Use jtds-1.3.1-a.jar to connect to MS sql server.
Everything is OK.

In the same APP, on the same computer, in the same directory.
I use "NSSM" to make the app a windows service.
It can be made into a service and web server starts correctly.
But only SQL SERVER connection fails!
It returns the following message:
"java.sql.SQLException: Unable to open database "TESTDB" requested for login. Login failed."

I switched back to running it with java.exe -jar myapp.jar and it all worked fine again.

Has anyone encountered this problem?
Or is "JDTS" not able to be executed in then service mode?

The Windows SYSTEM account doesn't have access to network resources.
Try running your serveice as the same user that you run the JAVA program.
You should run this sevice as an account that has the required network resources with the password set to NOT expire.
This account should NOT be an account with administrator authority.
 
Upvote 0

Jones Hone

Active Member
Licensed User
Longtime User
Thank you all.
After many days of research, I still haven't solved it.
Abandon the "SERVICE" mode for now.
I can only wait until I have time to study it.
 
Upvote 0
Top