This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes general error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "general error?" Watch "general error?" New topic
Author

general error?

Juwles Alco
Greenhorn

Joined: Nov 04, 2005
Posts: 5
Hi I get a "General Error" when I try to Insert values into a table, I would like to avoid preparedstatements at the moment. Does anyone know why this is, I have checked my table names and the that the types conform. My code is below:

try
{
this.setConnection();
Statement st = conn.createStatement();
String sql="INSERT INTO BOOKINGS (BookingID, CustomerID, CarReg, DateBooked, Duration, DateReturned, TotalPrice) VALUES("+"'"+"B100"+"'"+","+" '"+"C101"+"'"+"," +"'"+"T567 TGH"+"'"+","+"'"+"5/11/2005"+"'" +","+"5"+"," +"'"+"10/11/2005"+"'"+","+"50"+")";
int rows = st.executeUpdate(sql);
st.close();
this.closeConnection();
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
}
Any help would be very much appreciated..
Thanks
Julian
[ November 04, 2005: Message edited by: Bear Bibeault ]
Juwles Alco
Greenhorn

Joined: Nov 04, 2005
Posts: 5
Worked it, Primary key problem silly me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: general error?
 
Similar Threads
how to retreive date
SQL Column Date Type insertion problem
Simple mdb connection Error
insert multiple values into a single column
mysql- auto increment