After creating conntinpool in weblogic
how to write the code in programe where i can use that pool
object in the programe connecting to the database
and how to debug programe withou eclipse

Answer Posted / penchala

import java.sql.*;
import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

class WLConnection
{


public static void main(String arg[]){
Context ctx = null;
java.util.Hashtable ht = new Hashtable();

ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");

Connection conn = null;

try {
ctx = new InitialContext(ht);
javax.sql.DataSource ds = (javax.sql.DataSource)
ctx.lookup ("jdbc/sample");
conn = ds.getConnection();


}
catch (Exception e) {
// a failure occurred

}
}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is JDBC Statement?

567


What is the role of class.forname while loading drivers?

567


What is a jdbc connection?

474


How can we disable a constraint ?

565


Why did my jdbc code throw a rollback sqlexception?

510






What is the JDBC syntax for using a literal or variable in a standard Statement?

564


What are database warnings in jdbc and how can we handle database warnings in jdbc?

613


java based application for hospital management

3449


Which interface is responsible for transaction management in jdbc?

464


What is drivermanager in java?

493


What is SQL Warning? How to retrieve SQL warnings in the JDBC program?

550


What is the full form of jdbc and what is its purpose?

545


What is the fastest type of JDBC driver?

597


Which constraint cannot be specified as an explicit constraint and should be specified with the column only ?

490


When do we use execute method in java jdbc?

547