Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Problem to connect to sql server (with BMP and JBOSS)

  Asked By: Ashan    Date: Jun 13    Category: Java    Views: 1067
  

i have a problem here.i am tryin BMP in jboss 3.2.6.
when i try to connect to sql i am getting following error "javax.ejb.EJBException: ejbCreate:No suitable driver."
i am using class.forname
Connection coll=DriverManager.getConnection("jdbc:odbc:bank","sa","leo");
this is the line that i am getting error


03:26:24,890 ERROR [LogInterceptor] EJBException in method: public abstract Stud
ent Studenthome.create(java.lang.String,java.lang.String) throws java.rmi.Remote
Exception,javax.ejb.CreateException
javax.ejb.EJBException: ejbCreate:No suitable driver
at StudentBean.ejbCreate(StudentBean.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)

Share: 

 

6 Answers Found

 
Answer #1    Answered By: Debbie Reyes     Answered On: Jun 13

first step you should cetain that your sql  server driver  is ok on your machine
and then you should create odbc  with your sql server  driver and test to connect  it correctly and then you could implement your jdbc :


private static final String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
private static final String dsn = "jdbc:odbc:yourODBCname";
private Connection conn;

public static void main(String[] args) {

try {
Class.forName(driver);
conn = DriverManager.getConnection(dsn, "username", "password");
} catch(Exception e) {
e.printStackTrace();
}
}

it's better that you use another username and password that you make it in sql server yourself instead of 'sa'.

 
Answer #2    Answered By: Leroy Schmidt     Answered On: Jun 13

i got it.i wasnt using Class.forName(driver);
that means i wasnt loading the driver.
i would like to know whether it right way to use class.forname() in BMP
or any other way i mean better way to connect  to database.

 
Answer #3    Answered By: Edwin Chavez     Answered On: Jun 13
 
Answer #4    Answered By: Burk Martin     Answered On: Jun 13

why dont you use CMP ? .. where on your jboss  have you put your
driver ? ... did you get it work ?

 
Answer #5    Answered By: Hubert Taylor     Answered On: Jun 13

Thank you for ur url
URL was really helping.
if u have similar kind relating to deployment in jboss  please send.

 
Answer #6    Answered By: Lurlene Fischer     Answered On: Jun 13

i got it.i wasnt using Class.forName(driver);
that means i wasnt loading the driver.
i would like to know whether it right way to use class.forname() in BMP
or any other way i mean better way to connect  to database.

 
Didn't find what you were looking for? Find more on Problem to connect to sql server (with BMP and JBOSS) Or get search suggestion and latest updates.




Tagged: