|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Jan 2006
Messaggi: 83
|
NetBeans e MySql....aiutoooo!!
Ragazzi dovrei communicare tra NetBeans 6.0.1 e MySQL 5.1 per poter interrogare un DataBase ed ottenere delle informazioni.Il problema dovrebbe essere nell'importazione del driver che mi permette di far communicare col database.
-Io ho scaricato la cartella mysql-connector-java-5.1.6 ,adesso dove la devo mettere??Potete dirmi passo per passo come importare il driver?Grazie Gli errori sono relativi al driver che nn è presente,il codice che utilizzo è questo: import java.sql.*; public class LeggiDataBase { public static void main(String argv[]) throws Exception { try { Class.forName("org.gjt.mm.mysql.Driver"); } catch (ClassNotFoundException e) { System.out.println("Errore - Driver jdbc non presente: " + e.getMessage()); } try { Connection conn = DriverManager.getConnection("jdbc:mysql:///nomedatabase","root","password"); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery("SELECT * FROM tabella"); while (rset.next()) { System.out.println(rset.getString(1)); } rset.close(); stmt.close(); conn.close(); } catch (SQLException e) { System.out.println("Errore: " + e.getMessage()); } } } |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 02:52.



















