Java et jdbc

Fermé
fredo - 4 déc. 2002 à 09:58
 fredo - 4 déc. 2002 à 10:18
// bonjour j'ai un serveur appache et j'utilise Easyphp j'arrive pas acceder a ma table membre
// avec ce code peut etre que url n'est pas bon.





import java.sql.*;


class req
{
String url = "jdbc:mysql://localhost" ;
String uid = " " ;
String password = " " ;
String table =" membre" ;

public static int nb_col(String table,String url, String uid, String password)
{
Connection conn = null ;
PreparedStatement stmt ;
int nb =0;
try
{
conn = DriverManager.getConnection(url,uid,password) ;
stmt = conn.prepareStatement("Select *From"+ table);
ResultSet rs =stmt.executeQuery() ;
ResultSetMetaData rsmd = rs.getMetaData();
nb = rsmd.getColumnCount();
}
catch(SQLException e)
{

}

return nb;
}

}
A voir également:

1 réponse

en fait je ne connais pas le driver de mysql
0