This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes BMP Datasource connection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "BMP Datasource connection problem" Watch "BMP Datasource connection problem" New topic

BMP Datasource connection problem

henry takoe

Joined: Apr 29, 2003
Posts: 1
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 {
Context m_cxctxInitial = getInitialContext();
DataSource l_dsdataSource = (DataSource) m_cxctxInitial.lookup("jdbc/pamp");
l_cncon = l_dsdataSource.getConnection();
} .............
I agree. Here's the link:
subject: BMP Datasource connection problem
It's not a secret anymore!