Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

problem with comparing dates with db

730895Apr 26 2010 — edited Apr 26 2010
hello all!
i am trying to compare date and time but have an error like:
SQLException: Can not issue data manipulation statements with executeQuery().
SQLState: S1009
VendorError: 0
my db look like that:
CREATE TABLE calendar (
		id INT, 
		MYUSER VARCHAR(30) NOT NULL, 
		title VARCHAR(100) NOT NULL, 
		date DATE NOT NULL,
                start TIME,
                end TIME
                
		
	);
and the function is:
 public  void  deleteCalendarEvent(int id,String date,String start) throws ClassNotFoundException {
		try {
   DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
        Date Date = df.parse(date);

DateFormat sdf = new SimpleDateFormat("hh:mm:ss");
Date stime = sdf.parse(start);

                    // This will load the MySQL driver, each DB has its own driver
			Class.forName("com.mysql.jdbc.Driver");
			// Setup the connection with the DB
			connect = DriverManager
					.getConnection("jdbc:mysql://localhost/feedback?"
							+ "user=sqluser&password=sqluserpw");





                        // Statements allow to issue SQL queries to the database
			statement = connect.createStatement();
			// Result set get the result of the SQL query
			resultSet = statement
					.executeQuery( "delete * from FEEDBACK.COMMENTS where id = '"+id+"' and date='"+Date+"' and start='"+stime+"'");


System.out.println("the event was deleted");
thanks all
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 24 2010
Added on Apr 26 2010
11 comments
326 views