File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes JDBC Remote DB Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Remote DB Connection" Watch "JDBC Remote DB Connection" New topic

JDBC Remote DB Connection

John Lark
Ranch Hand

Joined: Feb 08, 2010
Posts: 72
Hey All,

Here is my situation. I am trying to use a JTDS Connector to connect my webapp on Server A to backup database on Server B using windows authentication. These Servers are both in the same domain and the user in Server A has been assigned to have administrative privliges to server B. If I manually set the JTDS Server name, domian and password to Server A's Login, everything works on both the remote and local database. If I leave these fields untouched, I can log in locally but not remotley, which is what I would expect to work. Given Server A's user has permisions on Server B. I cant have the user manually put in this information, as they shouldnt have it when they login externally to the application. I have tried retriving it using the localhost URL.getUserInfo(), System.getProperty("") and even NTSystem. Why wont JTDS work? Should I try a different method of connecting? Is there a setting for JTDS that I could change which will handle the remote connection using the local user(which is part of the domain I am on).

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

What do you mean by "Server A's user"?

Since you said the problem occurs in a web app, you should be looking at the user of the process which is running the web app. If I were to make a wild guess it would be that your web app container is running as a Windows service and you haven't configured that service to log on as the special user you set up.
John Lark
Ranch Hand

Joined: Feb 08, 2010
Posts: 72
I got this fixed a while ago but wanted to post the solution. So in the setup I am using One Domain user will match one Virtual Machine. so by Server A's user I mean the user that is associated (by us)with server A. Also, you where 100% correct. My container was running with local credentials, so I just changed them to the "Server A's" credentials and everything worked.

I agree. Here's the link:
subject: JDBC Remote DB Connection
Similar Threads
Don't understand mode flag
test user problem in MS Sql Server 2005
Connect to db, simple question !!
Database Updates in EJB method
How to create SQL server2005 database on remote machine using jdbc?