• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception in Bean Service

 
tejaswini vasist
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i have this wholesaler deployment that im doing.In the beanservice i connect to the database and store the order there.But everytime i get this exception:No suitable driver found.The database access in the other files work perfectly except beanservice.
This is my code:
public class ProjectBeanService1
{
public String processProject1(Order order) throws Exception
{
String insertQuery = new String();
ResultSet rsb = null;
Statement stmtb = null;
Connection conb=null;
Connect ctb = new Connect();
try
{
conb= ctb.getConnection();
}
catch(Exception e)
{
System.out.println("connection exception");
}
try
{
insertQuery = "insert into samsung values('";
insertQuery = insertQuery + order.getItemName() + "',";
insertQuery = insertQuery+ order.getQuantity()+")";
System.out.println("insertquery" +insertQuery);
stmtb = conb.createStatement();
stmtb.executeUpdate(insertQuery);
System.out.println("Inserted");
}
catch(Exception e)
{
System.out.println("Sorry !!! Unable to insert");
System.out.println(e.getMessage());
}

int bool=0;
int repint=0;
String rep=new String();
String sep = System.getProperty("line.separator");
String response = "\n\nHi, " + "!" + sep;
String dealerName = new String();
int quant = 0;
response += sep + "From Samsung wholesaler" + sep+"\t\t******";
response += sep +" : We are processing your order of "+order.getQuantity();
response += " items of " + order.getItemName();
System.out.println("beanservice1 : "+response);
System.out.println("service 111 : "+response);
stmtb.close();
rsb.close();
return response;
}
}
Is there something im supposed to do if i have to access the database here?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Movin' this on over to the JDBC forum where all the crazy database folks hang out.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tejaswini,
Where do you do the Class.forName() call?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic