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....

I'm not sure on correctness of connection string as I so far did not need to connect to MS SQL so here are just general suggestions.

Did you download Java driver for your database? (Microsoft SQL Server JDBC Driver)

Did you add this driver to your project libraries?

hi peter

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.