1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

help !!!

Discussion in 'Java' started by meena, Sep 19, 2004.

  1. meena

    meena New Member

    Joined:
    Jul 25, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    hi,

    i want to use database - access in my java pgm.
    first of all , i dunno wheter jdbc driver is installed in my sys
    or not. how to check it. if not, how to install it.

    then, vot r the lines of code in java in order to access my
    database (ms-access).

    plz, itz very urgent. plz mail me asap

    bye,
    meena
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,293
    Likes Received:
    365
    Trophy Points:
    83
    Try executing this code. If it runs successfully you have JDBC installed if not you need to get it for Access. Let me know if it runs.

    Code:
      Query = "Some Valid SQL";
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      String sourceURL = "jdbc:odbc:Dictionary";
      Connection databaseConnection = DriverManager.getConnection(sourceURL);
      Statement stmt = databaseConnection.createStatement();
      stmt.executeUpdate(Query);
    
    Also you can see the Database drivers at
    http://www.idssoftware.com/download.html#ODBC

    Thanks
    Shabbir Bhimani
     
  3. Amit Ray

    Amit Ray New Member

    Joined:
    Jul 12, 2004
    Messages:
    75
    Likes Received:
    4
    Trophy Points:
    0
    Occupation:
    Software Developer
    Home Page:
    For most database systems, you can simply download a JDBC driver to connect to the Db with Java, but there aren't any free ones for Access. What you can do is create an ODBC datasource (with Windows), and use the JDBC-ODBC bridge to connect to that. I think the JDBC-ODBC bridge is included with the JDK package. Good luck!

    You can create an access datasource in Win2k as follows: Start->Control panel->Administrative tools->Data Sources(ODBC)->MS Access Database->System DSN->Add->Select MS Access Database Driver ->Finish->Enter datasource name->Select Database->Click ok

    Cheers,
    Amit. :)
     
  4. meena

    meena New Member

    Joined:
    Jul 25, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    hi

    thanx very much. itz workin. (the code)

    bye
     
  5. Amit Ray

    Amit Ray New Member

    Joined:
    Jul 12, 2004
    Messages:
    75
    Likes Received:
    4
    Trophy Points:
    0
    Occupation:
    Software Developer
    Home Page:
    gr8 ... just drop a line if you need further help ...

    Cheers,
    Amit Ray. :)
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,293
    Likes Received:
    365
    Trophy Points:
    83
    Looks nice when something like this comes up

    ALso if you need any further help just drop a query.

    Thanks
    Shabbir Bhimani
     

Share This Page