Owen Nishimura

Greenhorn
since Aug 01, 2001
For More
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
0
0
Total given
0
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

Recent posts by Owen Nishimura

One hex digit represent 4 binary digits. The max value a hex
can have is F (decimal 15) which is 1111 in binary. The way I
approach it is to use base 10 (decimals) as an intermediary between them like this:
F = decimal 15, decimal 15 = 1111 binary
E = decimal 14, decimal 14 = 1110 binary
D = decimal 13, decimal 13 = 1101 binary
So if you have a larger hex number, you just apply this to each
hex digit.
0x4A:
4 = decimal 4 = 0100 binary
A = decimal 10 = 1010 binary
0xEC13
E = decimal 14 = 1110 binary
C = decimal 12 = 1100 binary
1 = decimal 1 = 0001 binary
3 = decimal 3 = 0011 binary
Answer = 1110 1100 0001 0011
Owen
22 years ago
I'm trying to understand the difference between two ways to get a connection from a Weblogic 6.0 connection pool. I've come across two different ways that we can get a connection from a pool (after it's been created thru the console).
1. Have a connection pool manager with a getConnection method that uses the following code:
Connection conn = null;
Driver myDriver =(Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
Properties props = new Properties();
props.put("connectionPoolID","PoolName");
conn = myDriver.connect("jdbc:weblogic :pool", props);

2. Using JNDI and providing a URL (such as PROVIDER_URL below) for the machine the connection pool is on. The following code could be used in a connection pool manager class too:
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,"t3://hostname :port");
try {
ctx = new InitialContext(ht);
javax.sql.DataSource ds =(javax.sql.DataSource) ctx.lookup("myJtsDataSource");
java.sql.Connection conn = ds.getConnection();
} catch (Exception ex) {}

Is either method preferable to the other? Or does it not matter?
Are there better methods?