PDA

View Full Version : Problem with Connection in ejb method


Sheetal
03-18-2004, 01:30 PM
Hi,

I'm working on this project which uses DB2 as the database..and I'm
using WSAD to design my application with EJBs and Java.

I have a method in a session bean which is:

public boolean isvaliduser(String username, String password)
{
Context ctx= new InitialContext;
int valid;
Datasource ds=(Datasource)ctx.lookup("jdbc/eshop");
Connection con=ds.getConnection();
CallableSatement cst= con.prepareCall("?=ValidateUser(?,?)");
cst.setString(1,username);
cst.setString(2,password);
cst.execute();

etc
etc.....

}

I have set up a datasource (jdbc/eshop) in WSAD which connects to the
database in DB2..and so I use tht to get the connection....but I am
getting an error at the get connection() stmnt..and it says tht
Connection is of the type com.ibm.rmi.iiop.Connection....wheras it shd
be of the type javax,sql.Connection...I don't understand this..
Plz let me know why this is happening......
Thnx in advance...
Sheetal

Dave
03-19-2004, 10:09 AM
ssashital@hotmail.com (Sheetal) wrote in message news:<aa91b983.0403181330.4516941f@posting.google.com>...

I would guess your data source is setup incorrectly since it is not
returning you a javax.sql.Connection

Dave

Hi, I'm working on this project which uses DB2 as the database..and I'm using WSAD to design my application with EJBs and Java. I have a method in a session bean which is: public boolean isvaliduser(String username, String password) { Context ctx= new InitialContext; int valid; Datasource ds=(Datasource)ctx.lookup("jdbc/eshop"); Connection con=ds.getConnection(); CallableSatement cst= con.prepareCall("?=ValidateUser(?,?)"); cst.setString(1,username); cst.setString(2,password); cst.execute(); etc etc..... } I have set up a datasource (jdbc/eshop) in WSAD which connects to the database in DB2..and so I use tht to get the connection....but I am getting an error at the get connection() stmnt..and it says tht Connection is of the type com.ibm.rmi.iiop.Connection....wheras it shd be of the type javax,sql.Connection...I don't understand this.. Plz let me know why this is happening...... Thnx in advance... Sheetal


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service