View Poll Results: ERROR!!!!!!!!

Voters
1. You may not vote on this poll
Multiple Choice Poll.
Results 1 to 3 of 3
  1. #1
    Elshan0011 is offline Member
    Join Date
    Nov 2009
    Location
    India
    Posts
    3
    Rep Power
    0

    Default Simple DATABASE FROM MSACCESS But ERROR!!!!!!!!

    PLZ HELP ME!! PLZ HELP ME!! PLZ HELP ME!!

    my database name elshan,it create from MSAcsess.
    it's in same directory but i found this error!

    import java.sql.*;
    public class Bookdb
    {
    public static void main(String []arg)throws classNotFoundException
    {
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String url = "jdbcdbc:Elshan";
    class.forName(driver);
    Connection con=DriverManager.getConnection(url);
    System.out.println("Connected to"+con.getCatalog());
    }
    }


    error code!

    D:\Java>javac Bookdb.java
    Bookdb.java:6: <identifier> expected
    class.forName(driver);
    ^
    Bookdb.java:6: '{' expected
    class.forName(driver);
    ^
    Bookdb.java:8: <identifier> expected
    System.out.println("Connected to"+con.getCatalog());
    ^
    Bookdb.java:10: '}' expected
    }
    ^
    4 errors

  2. #2
    Elshan0011 is offline Member
    Join Date
    Nov 2009
    Location
    India
    Posts
    3
    Rep Power
    0

    Default

    FOUND ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


    import java.sql.*;
    public class Bookdb{
    public static void main(String []arg) throws Exception{
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String url = "jdbc:odbc:Elshan";
    Class.forName(driver);//Class 'c' must be Capital
    Connection con=DriverManager.getConnection(url);
    System.out.println("Connected to"+con.getCatalog());
    }
    }

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,345
    Blog Entries
    7
    Rep Power
    20

    Default

    Thanks for all the exclamation marks on this page.

    kind regards,

    Jos

Similar Threads

  1. Replies: 2
    Last Post: 10-11-2009, 12:31 PM
  2. New simple application using a simple database
    By webbusiness23 in forum New To Java
    Replies: 9
    Last Post: 08-03-2009, 02:55 AM
  3. How to connect to msaccess?
    By azzaiel in forum New To Java
    Replies: 1
    Last Post: 06-28-2009, 02:19 AM
  4. Replies: 3
    Last Post: 04-30-2009, 09:28 AM
  5. MSAccess and hibernate
    By bbq in forum JDBC
    Replies: 3
    Last Post: 04-30-2008, 04:38 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
  •