Java – Ms Access Database Application – 2 – Connection to Database

Java

Video is ready, Click Here to View ×


Please Rate, Comment & Subscribe.

33 thoughts on “Java – Ms Access Database Application – 2 – Connection to Database

  1. I can run the program but unable to see the results, then I gave exception in in catch "system.out.println("unable to connect")" and it gives me the catch exception statement. Can you please help me with this

  2. when i write the the code and try to run it it won run it only says in the console section terminated … please help some one.

    this is the code

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
     
    public class Db {
     
    Connection con;
    Statement st;
    ResultSet rs;
     
    public Db() {
    connect();
     
    }
     
    public void connect() {
    try {
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    Class.forName(driver);
    String db = "jdbc:odbc:Reservation";
    con = DriverManager.getConnection(db);
    st = con.createStatement();
    String sql = "select * from info";
    rs = st.executeQuery(sql);
    while (rs.next()) {
    String fname = rs.getString("Fname");
    String lname = rs.getString("Lname");
    String age = rs.getString("Age");
     
    System.out.println(fname + " " + lname + " " + age);
    }
    } catch (Exception ex) {
     
    System.out.println(ex.getMessage());
    }
    }
     
    public static void main(String[] args) {
     
    new Db();
     
    }
     
    }

  3. Ive got no errors on net beans but the code doesnt work.I am using netbeans 86 and office 07 and tried it on office 3 as well doesnt work..someone please give a solution ?
    btw CreativityTuts you are the best..

  4. Hi, I have the same problem as the last comment, the dummy record is not showing up, the build is successful though. Does this method work with the latest software versions (windows 8, MS Access 2013, and Netbeans 7.3 with the latest JDK1.7.0_25) ?

  5. hello i would like to have a feedback because the result on netbeans when i run is nothing "" i configured the ODBC settings properly but still cant print the dummy record i place on the database , i followed every code you place and every process you did what can be wrong ?

  6. I am trying to connect java to Ms ACCESS database, i use the same code to connect oracle data base and it work. But I change use Ms access driver connection access code but it is not connecting. Please can you send me a downloadable video on how to configure ms access to connect java netbeans?

  7. I am not able to configure ms access through control panel as there's nothing showing in my SYSTEM DSN 🙁
    I tried it by running odbcad32 from syswow64. My program is compiling fine but not giving me expected results.
    I am using windows 7, 64bit.

Leave a Reply

Your email address will not be published. Required fields are marked *