View previous topic :: View next topic |
Author |
Message |
vaporino Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/6th Day/movie_the_6th_day_adam_gibson.gif)
Joined: 10 May 2006 Posts: 126
|
Posted: Mon Sep 11, 2006 11:03 pm Post subject: JDBC e MySql |
|
|
Ciao ragazzi........
volevo fare un piccolo database usando java e mysql.........
ho seguito un po di guide e ho cercato per prima cosa di connetermi con mysql usando il connettore jdbc della sun.
Qui di seguito vi riporto il codice della mia applicazione:
Code: |
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
// Notice, do not import com.mysql.jdbc.*
// or you will have problems!
public class LoadDriver {
public static void main(String[] args) {
// The newInstance() call is a work around for some
// broken Java implementations
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
}catch (Exception ex)
{
}
try {
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/db?user=root&password=********");
} catch (SQLException ex){
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
// handle the error
}
}
}
|
Ma non capisco perchè ottengo
Code: |
SQLException: No suitable driver
SQLState: 08001
VendorError: 0
|
Cosa significa ??? e come faccio vedere se mi sono connesso a mysql?? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lavish Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
Joined: 13 Sep 2004 Posts: 4296
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|