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 a jdbc driver and how many jdbc drivers are available?
What are the steps to connect to a database in java?
Where is mysql jdbc driver located?
What is sqlwarning and discuss the procedure of retrieving warnings?
What is a rollback in jdbc?
What are the different types of drivers under jdbc?
Is jdbc and orm?
How does JDBC API helps us in achieving loose coupling between Java Program and JDBC Drivers API?
What is db client?
What is jdbc in java?
Why do we need a jdbcrowset like wrapper around resultset?
How do I write Greek ( or other non-ASCII/8859-1 ) characters to a database?
How to insert and delete a row programmatically? (new feature in JDBC 2.0)
Which jdbc driver type s is are the jdbc odbc bridge?
How to update a resultset programmatically?