hello guys: I have a problem with this lab, so i have the following myownjdbcprogram.java and then the following failure:
import java.sql.*; public class MyOwnJDBCProgram { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here String url = "jdbc:derby://localhost:1527/sample"; Connection con,con1; String createString,createString1; Statement smtm; String query = "select location.location_id,location.location from _" + "location"; /**"select location.location_id _" + "location.location,cd.title,cd.author _" + "from location inner join _" + "cd on location.location_id=cd.location";*/ createString = "create table Location" + "(Location_id Integer not NULL PRIMARY KEY," + "Location VARCHAR(40))"; createString1 = "create table cd" + "(cd_id integer not NULL PRIMARY KEY, " + "TITLE VARCHAR(40)," + "AUTHOR VARCHAR(40),"+ "YEAR_CREATED INTEGER,"+ "RATING INTEGER,"+ "LOCATION INTEGER not null _" + "foreign key references location(location))"; Statement stmt; try { // Load database driver. This is old method of loading // database driver. Class.forName("org.apache.derby.jdbc.ClientDriver"); } catch(java.lang.ClassNotFoundException e) { System.err.print("ClassNotFoundException: "); System.err.println(e.getMessage()); } try { // Create database connection con = DriverManager.getConnection(url, "app", "app"); con1=DriverManager.getConnection(url, "app", "app"); // Create a statement and execute it stmt = con.createStatement(); stmt.executeUpdate("Insert into location values _" + "(0,'Cha Cha Cha bar')"); stmt.executeUpdate("Insert into location values _" + "(1,'Limon Restaurant')"); stmt.executeUpdate("Insert into location values _" + "(2,'Taqueria el Balazo')"); stmt.executeUpdate("Insert into location values _" + "(3,'Office')"); stmt.executeUpdate("Insert into location values _" + "(4,'Home')"); stmt = con1.createStatement(); stmt.executeUpdate("insert into cd values _" + "(0,'Rock and Roll Aint Noise Pollution','AC/DC',1980,0,9)"); stmt.executeUpdate("insert into cd values _" + "(1,'Shake a Leg','AC/DC',1980,2,6)"); stmt.executeUpdate("insert into cd values _" + "(2,'Have a Drink on Me','AC/DC',1980,2,5)"); stmt.executeUpdate("insert into cd values _" + "(3,'You Shook Me All Night Long','AC/DC',1980,1,82)"); stmt.executeUpdate("insert into cd values _" + "(4,'Back in Black','AC/DC',1980,4,9)"); stmt.executeUpdate("insert into cd values _" + "(5,'Let Me Put My Love into You','AC/DC',1980,4,9)"); // Perform the query ResultSet rs = stmt.executeQuery(query); // Display the rows // Get the metadata ResultSetMetaData rsmd = rs.getMetaData(); // Get and display Column type PrintColumnTypes.printColTypes(rsmd); System.out.println(""); // Get the number of columns int numberOfColumns = rsmd.getColumnCount(); // Display the column names for (int i = 1; i <= numberOfColumns; i++) { if (i > 1) System.out.print(", "); String columnName = rsmd.getColumnName(i); System.out.print(columnName); } System.out.println(""); // Display the rows of table while (rs.next()) { for (int i = 1; i <= numberOfColumns; i++) { if (i > 1) System.out.print(", "); String columnValue = rs.getString(i); System.out.print(columnValue); } System.out.println(""); } // If there is no exception, the tables table must be successfully created // System.out.println("locate table is successfully created"); //System.out.println("cd table is successfully created"); // Close statement and connection stmt.close(); con.close(); con1.close(); } catch(SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); } } } The progran doesnt insert data in the tables The failure is : in the tab window jdbcsamples(run single) say: SQLException: La cláusula VALUES debe contener al menos un elemento. Los elementos vacíos no están permitidos. BUILD SUCCESSFUL (total time: 2 seconds) The pr Anyone could help me please? diego -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en