JDBC J2EE Interview Questions [135 Questions]

  1. What is difference b/w Type-1 and Type-4 JDBC Driver with Example ?Give me brief description with small Example
  2. connection pooling concept through weblogic 8.1Hi,

    I tried using connection pooling concept through weblogic 8.1 .

    import java.sql.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    public class ConnectionpoolDemo {
    public static void main(String[] args) {
    try {
    InitialContext ic=new InitialContext();
    Object obj=ic.lookup("MyDsJNDI");
    DataSource ds=(DataSource)obj;
    Connection con=ds.getConnection();
    Statement st=con.createStatement();
    ResultSet rs=st.executeQuery("select empno,ename from emp");
    while(rs.next()){
    System.out.print(rs.getString(1)+"t");
    System.out.println(rs.getString(2));
    }
    } catch (NamingException e) {
    e.printStackTrace();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }

    }

    Output:

    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at ConnectionpoolDemo.main(ConnectionpoolDemo.java:8)



    EXCEPTION OCCURRED AT LINE

    Object obj=ic.lookup("MyDsJNDI");
  3. SCROLLABLE_SENSITIVE resultsetExplain with examples for SCROLLABLE_SENSITIVE resultset?
  4. Functionality of the cancel() methodWhat is the functionality of the cancel() method, provided in java.sql.Statement?
  5. Call stored procedure in Java using CallableStatementsHow can we call a stored procedure in Java using CallableStatements? Give an example.
  6. You must first Login or Register to view all 135 questions from this category.


    Registering yourself is FREE, takes just less than a minute and opens up a whole new GetGyan experience.