ragazzi devo accedere in scrittura ad un DB scritto con PHPMyAdmin (ho in output 4 files..); la cartella del DB la metto nel URL puntato dal localhost,ma non riesco ad accedervi, infatti si attiva la pagina "error2.jsp"(ps quando ad esempio provo ad accedere al DB attraverso l'URL "localhost:3306/venditadvd" mi chiede se voglio scaricare il file "default" (???)) .
Di seguito il codice per accedere al DB:
cosa c'è di sbagliato secondo voi??codice:try { String driver ="com.mysql.jdbc.Driver"; Class.forName(driver).newInstance(); } catch (ClassNotFoundException ce) {System.out.println(ce);} catch (InstantiationException ie) {System.err.println( ie.getMessage() );} catch (IllegalAccessException ia) {System.err.println( ia.getMessage() );} try{ con = DriverManager.getConnection("jdbc:mysql://localhost:3306/venditadvd","user","psw"); Statement s = con.createStatement(); String query= "INSERT INTO Utenti(Nome,Password,email,indirizzo) values ('"+ nome +"','"+ pwd +"','"+ email +"','"+ indirizzo +"');"; rs = s.executeUpdate(query);} catch (SQLException se) { rs = 0;} if (rs == 0) { getServletConfig().getServletContext().getRequestDispatcher("/error2.jsp").forward(request, response); } else { getServletConfig().getServletContext().getRequestDispatcher("/login.jsp").forward(request,response); }
grazie

Rispondi quotando
