JDBC-ODBC Connection

Discussion in 'Database' started by ravi_elite235, Dec 6, 2007.

  1. ravi_elite235

    ravi_elite235 New Member

    Joined:
    Dec 5, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    can anyone know the answer for this question?
    Code:
    Connection con = DriverManager.getConnection ( 
    "jdbc:odbc:wombat", "login", "password"); 
    Statement stmt = con.createStatement(); 
    ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM Table1"); 
    while (rs.next()) { 
    Integer x = rs.getInt("c"); 
    String s = rs.getString("a"); 
    Float f = rs.getFloat("b"); 
    } 
    What is WRONG with the code above?
    Choice 1
    Retrieval of the fields is in the wrong order.
    Choice 2
    The password must be encrypted before being sent to the DriverManager.
    Choice 3
    The Driver's URL is in the wrong format.
    Choice 4
    The ResultSet class returns primitive types for integers and floats.
    Choice 5
    The SQL statement is invalid.
     
    Last edited by a moderator: Dec 6, 2007
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,374
    Likes Received:
    388
    Trophy Points:
    83
    I see choice 4 as all the other option are not applicable.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice