1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
import java.io.*;
import java.sql.*;
public class Videotek {
public static void main(String[] args) {
String data = "jdbc:odbc:VDT_MYSQL";
try {
Class.forName("sun.jdc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(data,"root","eolines");
Statement st = conn.createStatement();
String sql = "SELECT * FROM VDT_LST_FILM";
ResultSet rec = st.executeQuery(sql);
System.out.println("ID_FILM\tLABEL_FILM\tID_GENRE\tSUMMARY");
while(rec.next()) {
System.out.println(rec.getString(1) + "\t" + rec.getString(2) + "\t" + rec.getString(3) + "\t" + rec.getString(4));
}
st.close();
} catch(SQLException sql_e) {
System.out.println("Erreur SQL : " + sql_e.toString() + " " + sql_e.getErrorCode() + " " + sql_e.getSQLState());
} catch(Exception e) {
System.out.println("Erreur : " + e.toString() + e.getMessage());
}*/
System.out.println(data);
}
} |
Partager