Hello, i don't know if this topic exists already or not, but i'll try my luck anyways. I am currently trying to make a connection with an sql server, and i have absolutely no idea what to do. I work with SQL Express 2008 R2 version. I downloaded the sqljdbc.jar and sqljdbc4.jar drivers from the internet. I put them in the folder where my project is, and added them as external jars to my project (in eclipse: project>properties>
Java Build Path>add external jars) . Then i tried to run the following code:
import java.sql.*;
import java.util.*;
class JdbcTest1 {
public static void main(
String args[]) {
try { // Step 1: Load the
JDBC driver.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// Step 2: Establish the connection to the database.
String url = "jdbc:microsoft:sqlserver://localhost:1433/E"; //the port i use is 1433 and E is my database
Connection conn = DriverManager.getConnection(url,"sa","blabla"); //sa is the username and blabla is the password
} catch (Exception e)
{
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
}
}
}
}
And i get the error: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433/E
And from now on i'm stuck. Been on a ton of forums and blogs and so on, tried a lot of solutions, none worked. Can someone please help me and tell me step-by-step what i have to do?
PS: I have already dealt with TCP/IP and Authentication Method problems, so I guess that everything comes from the code and the drivers
Thank you very much