Authenticating to a SQL Server instance as a Windows User via JDBC -



Authenticating to a SQL Server instance as a Windows User via JDBC -

i'm having back upwards multiple database types tenant-enabled web application. among others, have supported microsoft's sql server, using net.sourceforge.jtds.jdbc.driver class connection string "jdbc:jtds:sqlserver://192.168.1.189:1433/applicationname". works, requires user explicitly defines user in sql server instance , enables sql server authentication.

now, inevitably, requirements changed, , we're supposed back upwards connecting sql server via windows authentication. evidently requires sort of alter connection string, since info base of operations server must somehow able distinguish whether credentials passed info base of operations connection user defined in sql server installation or in windows os. it?

acting on advice internet, if progressed far extending connection string ;usentlmv2=true;domain=workgroup. seems create info base of operations server aware want authenticate windows user, actual log-in fails with

the login untrusted domain , cannot used windows authentication. (code 18452, state 28000)

now im testing set-up, both j2ee app , sql server instance in fact on same machine (although in production may not be), , still computer isn't trusted plenty log on itself? evidently i'm missing big part of puzzle here. 1 have convince sql server instance user started can in fact log on via jdbc?

edit

since have sunk much unsuccessful effort trying integrate our web application total microsoft infrastructure stack (sql server, active directory, domain name service...), have restrict question:

does know way access sql server installation user business relationship defined "windows user" via jdbc form j2ee application, without having utilize active directory, windows machine running web application , proprietary dll? bounty solution of sub-problem. entire problem broad answered in 1 forum post.

what describe appears feasible. have sql server 2008 r2 express running on stand-alone server , able connect using windows username/password on server via jtds 1.3.1 separate windows machine , xubuntu 14.04 box.

on machine running sql server created windows user named 'kilian'. in sql server created sql login nt authority\authenticated users. in database (named 'mydb') created user named 'authenticatedusers' sql login. maintain things simple gave user db_owner rights on database.

there no sql login 'kilian' , no database user name.

then, other 2 machines (the windows workstation , xubuntu box) ran this:

class="lang-java prettyprint-override">package com.example.jtdstest; import java.sql.*; public class jtdstestmain { public static void main(string[] args) { seek (connection con = drivermanager.getconnection( "jdbc:jtds:sqlserver://192.168.1.137:52865/mydb" + ";domain=whatever", "kilian", "4thebounty")) { seek (statement s = con.createstatement()) { string sql = "select lastname clients id=1"; seek (resultset rs = s.executequery(sql)) { rs.next(); system.out.println(rs.getstring("lastname")); } } } grab (exception e) { e.printstacktrace(system.out); } } }

additional notes:

i did not have include usentlmv2=true. able connect or without parameter.

i did have include domain= tell sql server not utilize sql authentication, actual value supplied made no difference. (i literally used 'whatever', not name of server or name of workgroup belongs.)

sql-server jdbc jtds windows-nt

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -