I need to connect using JDBC to SQL Server using Windows Authentication where I provide username and password from the connection String. Is this possible with Windows Authentication?
I have tried this with both JTDS and msql-jdbc but can't get it to work
private Connection getDBConnection() {
Connection dbConnection = null;
try {
System.out.println("load driver");
Class.forName("net.sourceforge.jtds.jdbc.Driver");
log.info("loaded");
String con = "jdbc:jtds:sqlserver://PNT00-PMP-SQL01:1433/iceware;domain=workgroup;userName=user;password=password";
dbConnection = DriverManager.getConnection(con);
log.info("got connection");
return dbConnection;
} catch (Exception e) {
log.error(e.getMessage());
}
return dbConnection;
}
I have tried various combinations for the username and domain but usually get something like:
019-01-18 14:15:31 ERROR com.pts.demo.service.JdbcService - Login failed for user '/'. ClientConnectionId:962eeab5-226c-4f85-9911-644a570529ab
Any help much appreciated