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 drivers in java?
What are the steps required to execute a query in jdbc?
What is jdbc in java?
any one can explain about policy file rule? when i connect database with applet then ther is no compile time error but the run time error is occureed.i.e access is denied.policy file rule is related to this problem.
Why jdbc is used in java?
What is metadata in jdbc?
What is JDBC Connection? Explain steps to get Database connection in a simple java program.
What is jdbc connection interface?
How can we retrieve the file in the oracle database?
How to check jdbc driver version in sql server?
What is jdbc and odbc in java?
What are the advantages of using jdbc datasource?
How to check jdbc connection in linux?
Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection?
Which is better jpa or jdbc?