Dear experts,
I have succesfully compile my program, but when I run it, the program just stop there with no response until I press <ctrl><C>.
I know exactly which line cause the problem. It is
this line "javax.naming.Context context = new javax.naming.InitialContext(parms);" that cause this problem.
The datasource and resource have been properly set up in WebSphere. For your information,the following is my .java
______________
import javax.sql.DataSource;
import javax.naming.*;
import com.ibm.ejs.ns.jndi.*;
import java.sql.*;
import java.util.*;import com.ibm.websphere.advanced.cm.factory.*;
public class DataBean
{
private final
String DATASOURCE = "Minnie";
public Connection getConnection()
{
Connection conn = null;
DataSource ds = null;
try
{
java.util.Properties parms = new java.util.Properties();
parms.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
javax.naming.Context context = new javax.naming.InitialContext(parms);
ds = (DataSource)context.lookup(DATASOURCE);
conn = ds.getConnection("aaa","aaa");
}
catch (Exception t)
{
// DataSource not found. Throw Exception
}
finally {
return conn;
}
}
}
______________
Is there anything that I have to do to make it work. It seems normal with the javax.naming.*
Shireen