I have tried every possible way of connecting the database to the program, but its just not happening! Help me please :(

    final static String fileName ="Netlync.mdb";
    static{
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+fileName;
    con = DriverManager.getConnection(url,"","");



        }catch(Exception exx){
            exx.printStackTrace();
        }}
            private static Connection con;

" its just not happening! "

yah ... this isn't really helping.
is there a stacktrace printed?
how do you know " i's not happening "?

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3072)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    at java.sql.DriverManager.getConnection(DriverManager.java:579)
    at java.sql.DriverManager.getConnection(DriverManager.java:243)
    at DatabaseManager.<clinit>(DatabaseManager.java:46)
    at FacultyFrame.setVisible(FacultyFrame.java:61)
    at FacultyFrame.<init>(FacultyFrame.java:54)
    at FacultyFrame.main(FacultyFrame.java:108)
java.lang.NullPointerException
    at DatabaseManager.getFaculty(DatabaseManager.java:14)
    at FacultyFrame.setVisible(FacultyFrame.java:61)
    at FacultyFrame.<init>(FacultyFrame.java:54)
    at FacultyFrame.main(FacultyFrame.java:108)

it looks like your problem lies somewhere here: Could not find file '(unknown)'.

if you check the stacktrace, you'll see what line of what class of your code throws the exception. start there.

13: java.lang.NullPointerException
14: at DatabaseManager.getFaculty(DatabaseManager.java:14)

would be a good place to start looking...

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.