I have having great difficuly in getting the jdbc driver from Microsoft to connect to SQL Server 2000 (SP3). The code below is directly from the Microsoft site and my server is set to Mixed mode authetication.
The SQL Server error is "login failed for user 'myUserName'"
Does anyone have any experiece using this driver with SQL Server? I've have put in way too many hours on this already.
I would appreciate any help. Thank you
import java.*;
public class Connect{
private java.sql.Connection con = null;
private final String url = "jdbc:microsoft:sqlserver://";
private final String serverName= "myServer";
private final String portNumber = "1433";
private final String databaseName= "Northwind";
private final String userName = "myUserName";
private final String password = "myPW";
// Informs the driver to use server a side-cursor,
// which permits more than one active statement
// on a connection.
private final String selectMethod = "cursor";
// Constructor
public Connect(){}
private String getConnectionUrl(){
return url+serverName+":"+portNumber+";databaseName="+databaseName+";selectMethod="+selectMethod+";";
}
private java.sql.Connection getConnection(){
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con = java.sql.DriverManager.getConnection(getConnectionUrl(),userName,password);
...
The SQL Server error is "login failed for user 'myUserName'"
Does anyone have any experiece using this driver with SQL Server? I've have put in way too many hours on this already.
I would appreciate any help. Thank you
import java.*;
public class Connect{
private java.sql.Connection con = null;
private final String url = "jdbc:microsoft:sqlserver://";
private final String serverName= "myServer";
private final String portNumber = "1433";
private final String databaseName= "Northwind";
private final String userName = "myUserName";
private final String password = "myPW";
// Informs the driver to use server a side-cursor,
// which permits more than one active statement
// on a connection.
private final String selectMethod = "cursor";
// Constructor
public Connect(){}
private String getConnectionUrl(){
return url+serverName+":"+portNumber+";databaseName="+databaseName+";selectMethod="+selectMethod+";";
}
private java.sql.Connection getConnection(){
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con = java.sql.DriverManager.getConnection(getConnectionUrl(),userName,password);
...