在这段代码中,我想得到我在ms访问中存储的值的输出。但是,我在这个项目中找到的每一步都很好。但它的输出是无关紧要的。没有任何异常或错误发生。只显示输出sun.jdbc.odbc.JdbcOdbcDriver
。我的代码如下:
import java.sql.*;
public class TestDatabase {
public static void main(String[] args) {
try {
Class.forName = ("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:kundan");
Statement stmt = conn.createStatement();
String sql = "select * from kumar";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
System.out.println("\n" + rs.getString(1) + "\t" + rs.getString(2) + "\t" + rs.getString(3) + "\t" + rs.getString(4));
}
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
}