I am trying to connect my java Program to our SQLServer db that I access remotely by VPN, this DB uses windows authentication. I have sqljdbc4.jar in my libraries folder in Netbeans, also a jar file in the source packages tab(Not sure why its there). I think this problem is related to the VPN because I am pretty sure of all the credentials being used.
String url = "jdbc:sqlserver://AAAHCSQL01:1433;databaseName=netForumAAAHCDev;";
try{
conn = DriverManager.getConnection(url,userName,password);
}catch(SQLException e){
e.printStackTrace();
}
Here's the error:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'MBisesi_AAAHC'. ClientConnectionId:92c25c9c-506b-4c77-88c3-819fc0774883
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at namedropper.NameDropper.main(NameDropper.java:23)
I use a VPN and have the same error for this jdbc driver. Only difference is I run SQL Server in Mixed authentication mode. I can say two things:
WORKS
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:jtds:sqlserver://****:1433;instance=***;DatabaseName=***;</property>
<property name="hibernate.connection.username”>***</property>
<property name="hibernate.connection.password”>***</property>
DOESN'T WORK
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://****:1433;instanceName=***;DatabaseName=***</property>
<property name="hibernate.connection.username”>***</property>
<property name="hibernate.connection.password”>***</property>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.