I found many answers to similar questions but I still can't solve my problem.
My connection code is:
import java.io.*;
import java.text.*;
import java.util.*;
import java.sql.*;
public class TransformData
{
public static void main(String args[])
{
String url = "jdbc:sqlserver://SQLFULL:1433;databaseName=BA_ELTRUN;";
Connection dbcon;
Statement stmt;
ResultSet rs;
Scanner input = new Scanner(System.in);
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}
catch(java.lang.ClassNotFoundException e)
{
System.out.print("ClassNotFoundException: ");
System.out.println(e.getMessage());
}
try
{
dbcon = DriverManager.getConnection(url,"username","password");
stmt = dbcon.createStatement();
}
catch(SQLException e)
{
System.out.print("SQLException: ");
System.out.println(e.getMessage());
}
}
}
When I run this I get the following exception:
ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver SQLException: No suitable driver found for jdbc:sqlserver://Konstantina\SQLFULL; databaseName=BA_ELTRUN
sqljdbc.jar and sqljdbca.jar are on this directory:C:\Program Files\Microsoft SQL Server JDBC Driver 2.0\Sqljdbc_2.0\Enu Do I have to move them in another directory?