0

hi friends
i am connecting to sql server with java through eclipse as IDE.
here's my base connectivity class to sql server

public class BaseDAO {

    public Connection getConnection() throws Exception
    {
        String userName = "aman";
        String password = "password";
        String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=amandb";

                    // step 1
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();

            // Step 2
        return DriverManager.getConnection(url, userName,password);

    }

}

but i use to get error like
No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=amandb

can anybody tell, if its error of jar file i added or some code specific error. kindly help if possible to solve the concerned issue

thanx in advance....

Edited by Dani: Formatting fixed

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by aman_dba
0

hi peter

i have added this jar file to the project libraries
but still i am facing the same problem

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.