Ciao a tutti!!
Sto usando la libreria JFreeChart e in particolare ho bisogno di usare la classe JDBCXYDataSet per interfacciarmi con un database. Ho provato ad eseguire la seguente query (attraverso il metodo executeQuery() di JDBCXYDataSet):
Ma questo mi lancia la seguente eccezione: java.sql.SQLException: query does not return ResultSetcodice:s.executeQuery("create view [V_NumLibriPU] as select id, count(titolo) as NumLibri from libri,utenti where id=idu and titolo not like \"%SCHEDA%\" group by id"); s.executeQuery("select count(id) as NumUtenti, NumLibri from V_NumLibriPU group by id order by NumLibri DESC");
(Se provo a lanciarla una seconda volta mi dice che la tabella V_NumLibriPU già esiste, anche se chiudo il programma e lo riapro).
Dopodiché ho provato ad eseguire questa query al posto della precedente:
Ultima prova che ho fatto è usare direttamente un'istanza della classe Statement:codice:s.executeQuery("create view [V_NumLibriPU] as " + "select id, count(titolo) as NumLibri " + "from libri,utenti " + "where id=idu and titolo not like \"%SCHEDA%\" " + "group by id " + "select count(id) as NumUtenti, NumLibri " + "from V_NumLibriPU " + "group by id " + "order by NumLibri DESC");
In questo caso funziona, però dalla seconda volta in poi che lancio questa istruzione, come nel caso precedente, anche se chiudo il programma e lo riapro mi lancia l'eccezione: java.sql.SQLException: table V_NumLibriPerUtente already existscodice:stat.executeUpdate("create view V_NumLibriPerUtente as " + "select id, count(titolo) as NumLibri " + "from libri,utenti " + "where id=idu and titolo not like \"%SCHEDA%\" " + "group by id");
Ma come è possibile che è già esistente??? Chi può darmi una mano?
Grazie.

Rispondi quotando