user3375228
user3375228

Reputation: 3

I am a newbie with java and I am trying to connect to a derby database. I am using netbeans 7.4

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConnect {


public static void main(String[] args) {

    String host = ("jdbc:derby://localhost:1527/Employees");
    String uName = ("sa");
    String uPass = ("saa");
try {

    Connection con = DriverManager.getConnection(host, uName, uPass);
}
catch ( SQLException err) {
    System.out.println( err.getMessage());
}
}

}

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - exception java.sql.SQLException is never th [missing fragment here]

Upvotes: 0

Views: 40

Answers (1)

David
David

Reputation: 393

The code looks fine except that you misspelled DriverManager as DriveManager. (Notice the missing 'r')

Upvotes: 1

Related Questions