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
Write a program JDBCcode forfetching student database with SQL.
How to check jdbc connection in java?
Is jpa faster than jdbc?
Are all the required JDBC drivers to establish connectivity to my database part of the JDK?
Is java a database?
How can we disable a constraint ?
What is the return type of class.forname() method?
What is jdbc vs odbc?
Differentiate between a statement and a preparedstatement.
What is jdbc url for mysql?
What is use of connection pooling?
What is JDBC PreparedStatement?
What is difference between odbc and jdbc?
What are the differences between stored procedure and functions?
Compare jdbc and odbc and how is jdbc required in this context.