Skip to Main Content

Java Database Connectivity (JDBC)

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!

syntax errors using sql and java

843853Jul 5 2001 — edited Jul 6 2001
Could somebody inform of the correct syntax for using UPDATE and INSERT SQL commands in a java program? Any information I can find demonstrates this with:

INSERT INTO table_name(column_name, ..., column_name)
VALUES(value, ..., value)

However - this isn't working? any suggestions - and I know its very basic, but I'm just learning.
String query = " INSERT INTO SESSIONS (" +
"id,module_name, module_number, level, session " +
"term, class_list, location, lecturer" + ")
VALUES('"+
fields.id.getText() + "', '"+
fields.module_name.getText() + "', '" + fields.module_number.getText() + "', '" +
fields.level.getText() + "', '" fields.session.getText() "', '" +
fields.term.getText() + "', '" fields.class_list.getText() "', '" +
fields.location.getText() + "', '" fields.lecturer.getText() "')";

output.append( " \nSending query: " + connection.nativeSQL(query)+ "\n");
output.append( "query sent");

thanks
int result = statement.executeUpdate(query);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2001
Added on Jul 5 2001
5 comments
120 views