Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BMP Datasource connection problem

 
henry takoe
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've an entity bean that connects to the database via DataSource object.
I've created a datasource and set the password and id @ the container level.
However when i attempt to connect to the database, i get a user/password not correct SQL error.
What seems to be the cause of the problem? Will the datasource object grab the pwd/id from the container?
Below is a snippet of the connection code. Thks.
public RecordLockebKey ejbCreate(String a_strBwrId, String a_strDeptCode, String a_strUserId, String a_strFunctionID)
throws javax.ejb.CreateException, java.rmi.RemoteException {
Connection l_cnConnection = null;

int l_nSQLStatus = 0;
try {
l_cnConnection = PAMPCommon.getConn(); // Getting connection from pool
l_stStmt = l_cnConnection.createStatement(); // Creating Statement

**The code fragment for PAMPCommon.getConn()**
public static Connection getConn() throws SQLException, ClassNotFoundException {
Connection l_cncon = null;
boolean retry = false;
int numOfRetries = 0;
PAMPCommon l_udForSOP = null;
if(COPAMSConstants.PAMP_DEBUG) l_udForSOP = new PAMPCommon();
do {
try {
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
Context m_cxctxInitial = getInitialContext();
DataSource l_dsdataSource = (DataSource) m_cxctxInitial.lookup("jdbc/pamp");
l_cncon = l_dsdataSource.getConnection();
} .............
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic