0

I try to connect to my BD This is my code

 public class JavaSQLTest {
/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
 try {
 Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
 String connectionUrl = "jdbc:sqlserver://FRANK-PC\\SQLEXPRESS" +
 "databaseName=Pendu;";
 Connection con = DriverManager.getConnection(connectionUrl);
 } catch (SQLException e) {
 System.out.println("SQL Exception: "+ e.toString());
 } catch (ClassNotFoundException cE) {
 System.out.println("Class Not Found Exception: "+ cE.toString());
 }
 }
}

I get Class Not Found Exception: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver after running....

How to connect properly on a sql server ???

Thanks Frank

asked Apr 8, 2012 at 20:00
1
  • Check this stackoverflow question. It is exactly what you ask. Commented Apr 8, 2012 at 20:10

1 Answer 1

2

You have to put the SQL Server JDBC driver library into the classpath .

answered Apr 8, 2012 at 20:09
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.