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
What is JDBC Connection? Explain steps to get Database connection in a simple java program.
Where is mysql jdbc driver located?
What do you mean by two phase commits?
How to retrieve warnings in jdbc?
Where jdbc drivermanager class is used?
Why hibernate is better than jdbc?
Is jdbc a middleware?
Which type of driver is unique in jdbc?
Which is better odbc or jdbc?
What is the difference between client and server database cursors?
What types of DataSource objects are specified in the Optional Package?
Which is best database for java?
Why can't Tomcat find my Oracle JDBC drivers in classes111.zip?
What is database deadlock ? How can we avoid them?
What does the jdbc driver interface do?