Salve a tutti, sono ormai diversi giorni che sono inchiodato su un problema e non riesco a venirne fuori. Ecco il codice:
E la query:codice:public String[][] compArray(){ int l = 0; this.temp = new String[10][2]; try { Class.forName("org.hsqldb.jdbcDriver"); Connection connection = DriverManager.getConnection( "jdbc:hsqldb:test[path]/Ordine/test","SA",""); //interrogo db Statement smt = connection.createStatement(); ResultSet rs = smt.executeQuery(query); while(rs.next() == true){ String a = rs.getString("GRUPPO"); Integer b = rs.getInt("ORDER"); a = temp[l][0]; temp[l][1] = String.valueOf(b); l++; } connection.close(); smt.close(); rs.close(); } catch(ClassNotFoundException e){ JOptionPane.showMessageDialog(null, "Database non connesso! (Class)"); } catch(SQLException e){ JOptionPane.showMessageDialog(null, "Database non connesso (SQL)"); } return temp; }
Solo che nel momento che vado a eseguirlo mi da errore!codice:private String query = "SELECT GRUPPO, ORDER FROM GRUPPI";
specifico che nel db ho già inserito la tabella:
Grazie!codice:CREATE MEMORY TABLE GRUPPI(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY, GRUPPO VARCHAR(40), ORDER INTEGER NOT NULL)

Rispondi quotando


