Reputation: 15
I want get data from ms access with my java app. java version 1.8. I watched video from youtube. there was these code:
public class Main {
public static void main(String[] args) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:Test");
Statement st = conn.createStatement();
String sql = "Select * from playlist";
ResultSet rs = st.executeQuery(sql);
while(rs.next()) {
System.out.print(rs.getString(1));
}
} catch (Exception e){
System.out.print(e.getMessage());
}
}
}
my output is:
sun.jdbc.odbc.JdbcOdbcDriver
Process finished with exit code 0
what am i doing wrong? if there extras i have to do? please help!
Upvotes: 1
Views: 52
Reputation: 2308
The JdbcOdbc bridge driver was removed from Java in version 8.
Here is an answer with more info
Your exception contains more useful information than only the message, try printing the exception or printStacktrace method
Upvotes: 1