Hi Ranchers ,
Why this program throws SQLException
Although I put all classes and jar files in class path
the error is
111 java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC][SQLServer]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
import java.sql.*;
class jdbc
{
public static void main(
String[] args)
{
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con=DriverManager.getConnection("jdbc:microsoft:sqlserver://209.172.34.240:1433;databaseName=Northwind,user=ossqluser,password=os34sql");
con.close();
System.out.println("Connection Success..!!!");
System.exit(0);
}
catch(ClassNotFoundException eclass)
{
System.out.println("Driver Not Found ! "+eclass);
}
catch(SQLException esql)
{
System.out.println("111 "+esql);//.getMessage());
}
}
}