Why am I getting a n exception with these codes?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpuser123
    New Member
    • Dec 2009
    • 108

    #1

    Why am I getting a n exception with these codes?

    public static void test_conn(){
    try
    {
    // Step 1: Load the JDBC driver.
    Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;

    // Step 2: Establish the connection to the database.
    String url = "jdbc:odbc: MS Access Database";
    Connection conn = DriverManager.g etConnection(ur l);
    System.out.prin tln("connection login timeout "+DriverManager .getLoginTimeou t());


    }
    catch (Exception e)
    {
    System.err.prin tln("Got an exception! ");
    System.err.prin tln(e.getMessag e());
    }

    }



    When I run these codes i get the following exception :


    "Got an exception!
    No data found"

    I doubt there is a problem with my url..I've used the Ms access datasource and I want to connect to a database named test.mdb...

    How can I achieve this ?


    Thabks in adv
Working...