Sto lavorando sul JDBC.
Passando da Access a MySQL sono andato incontro a questo problema:
java.sql.SQLException: ResultSet is from UPDATE. No Data.
La classe java è la seguente
Quando lavoravo con Access questa classe funzionava correttamente: qualcuno mi sa spiegare il motivo dell'errore?codice:import javax.servlet.*; import javax.servlet.http.*; import javax.swing.*; import java.io.*; import java.util.*; import java.sql.*; public class InserisciCalciatore extends HttpServlet { public void service (HttpServletRequest req, HttpServletResponse res) throws IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); String cc=req.getParameter("cognome_calciatore"); ... String t3c=req.getParameter("telefono3_calciatore"); String query="INSERT INTO calciatori VALUES ('"+cc+"','"+nc+"','"+gn+"','"+mn+"','"+an+"','"+ln+"','"+pn+"','"+ic+"','"+t1c+"','"+t2c+"','"+t3c+"')"; /* prepare the db connection */ String dbUrl="jdbc:mysql://localhost:3306/db_archiviocalciatori"; String user="***"; String password="***"; try { /* the following command load the jdbc driver */ Class.forName("org.gjt.mm.mysql.Driver"); Connection c = DriverManager.getConnection(dbUrl,user,password); Statement s=c.createStatement(); ResultSet r=s.executeQuery(query); while(r.next()) { ... } s.close(); } catch (Exception e) { ... } }


 
			
			 
					
					
					
						 Rispondi quotando
  Rispondi quotando