• 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

throwing SQLException : GeneralError

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my programe is throwing SQLException GeneralError using oracle9i

//this is code

public void insertData(String name,int id,float price,int sales,float total)
{
try
{
//columns = statement.executeUpdate("insert into coffees values ("+name+","+id+","+price1+","+sales1+","+total1+")");
pStatement = connection.prepareStatement("insert into coffees values(?,?,?,?,?)");
pStatement.setString(1,name);
pStatement.setInt(1,id);
pStatement.setDouble(1,price);
pStatement.setInt(1,sales);
pStatement.setDouble(1,total);
pStatement.executeUpdate();
connection.commit();
System.out.println("no of rows inserted "+columns);
}
//catch block and other code
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check your database, normally if you are inserting duplicate primary-key values, you will receive such kind of error...

Can you post the stack trace?
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic