• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception in Bean Service

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Movin' this on over to the JDBC forum where all the crazy database folks hang out.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tejaswini,
Where do you do the Class.forName() call?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic