Results 1 to 3 of 3

Thread: file not found

  1. #1
    smartshahezad is offline Member
    Join Date
    Feb 2010
    Location
    london
    Posts
    2
    Rep Power
    0

    Default file not found

    hello guys
    i m a beginner java programmer and have created a small access database...
    now i want to connect that database in the java program..
    i hv written the code but wen i rum it, it says dat file(database) not found
    pls help me...
    i m using netbeans6.7.1
    the code i wrote is


    package practiceptograms;
    import java.sql.*;
    public class Database {
    public static void main(String[] args){
    Connection userDB;
    Statement myStatement;

    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String sourceURL = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=UserDB.mdb;";
    userDB = DriverManager.getConnection(sourceURL,"admin","");
    myStatement = userDB.createStatement();

    }
    catch (ClassNotFoundException cnfe) {
    // if Class.forName string is wrong
    System.out.println(cnfe);
    }
    catch (SQLException sqle) {
    // if connection canít be made
    System.out.println(sqle);
    }


    }
    }


    and the output is ====
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.

    i kip ma programs in ma usb and wenevr i opena project from netbeans my files loadsup...
    do also tell me if i nid to save the database in a particular kinda folder or smethin lik dt...

    thnx

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    The "current working directory" is probably not what you think it is. Use the full path to the file.

  3. #3
    smartshahezad is offline Member
    Join Date
    Feb 2010
    Location
    london
    Posts
    2
    Rep Power
    0

Similar Threads

  1. compilation problem "javac:file not found..."
    By Faruq in forum New To Java
    Replies: 9
    Last Post: 02-02-2010, 07:35 PM
  2. Replies: 2
    Last Post: 01-05-2010, 06:41 AM
  3. javac:file not found
    By lovearora in forum New To Java
    Replies: 3
    Last Post: 02-09-2009, 04:20 AM
  4. javac file not found
    By teamkeff in forum New To Java
    Replies: 6
    Last Post: 06-23-2008, 11:17 PM
  5. file not found outside of Netbeans
    By annie in forum NetBeans
    Replies: 0
    Last Post: 06-21-2008, 11:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •