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

Give an example for getXXX method?

547


What are the jdbc api components?

650


What is meant by jdbc?

516


What do you understand by DDL and DML statements?

502


What are the functions of the jdbc connection interface?

496






what is the meaning of following code snippets Class c=class.forName(driverClassName); Driver d=(driver)c.newInstance();

4316


What is DML?

565


What is jdbc thin client?

493


What is jdbc and jpa?

505


How do I insert/update records with some of the columns having NULL value?

503


Can I get a null resultset?

539


What is executequery in java?

482


Is jdbc open source?

446


Can we return resultset in java?

465


What are the steps involved in establishing a connection using jdbc in java?

510