I am getting an error when trying to create a datasource connection to MS SQL server using JTDS driver within my Spring Config. I am using domain authentication from a non windows machine.
ERROR:
Caused by: java.sql.SQLException: Login failed.
The login is from an untrusted domain and cannot be used with Windows authentication.
Spring-Datasource.xml:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver"/>
<property name="url" value="jdbc:jtds:sqlserver://MS_SERVER/ms_db;domain=myDomain;integrated security=false"/>
<property name="username" value="myUser"/>
<property name="password" value="myPassword"/>
</bean>
I can create the connection manually and works perfect like:
public static void main(String[] args) {
System.out.println("Starting Connection test");
Connection connection;
String url = "jdbc:jtds:sqlserver://MS_SERVER/ms_db;domain=myDomain;integrated security=false";
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
connection = DriverManager.getConnection(url, "myUser","myPassword"));
System.out.println("Connection successful");
}
catch (Exception e) {
System.err.println("Cannot connect to database server");
e.printStackTrace();
}
}
Any suggestions would be appreciated
org.apache.commons.dbcp.BasicDataSource, does it work?