下在一个jdk应该就可以了,详细请参考相关资料
解决方案 »
- java写swap
- Java从哪个版本开始就支持多继承了?
- 如何使用jar包中的类(初学者)
- 设置windows风格时,为什么说找不到com.sun.java.swing.plaf.windows.windowsLookAndFeel呢?
- 谁能告诉我s2是需要什么东西啊....内有代码(问题很难但是无奈分数有限对不起了啊)
- 新手求助: jdk安装配置的问题
- 针对qlampskyface的帖子再调查,毕业一年做java程序员,跳槽是否是明智的选择
- 关于属性properties的问题,谢谢!
- 菜!.java怎么样编译成.class啊
- 如何开始...
- 一个有关Java访问数据表的问题:
- 兄弟姐妹们,帮帮忙吧
//the following code, hope it will give a basic idea
//the code below will use JDBC to connect to your data source
//read ALL the data inside and print out in you console window
//IF YOU CAN GET THIS JOB DONE I THINK YOU WILL ABTAIN A LOT!!
//step1
//use microsoft Access to create a table named BOOKS.//step2
//establish a data source naemed "BooksInfoODBC"(quote not include)
//if you don't how to create a data source in you computer,
//check with your frieds//step 3
//create a java class and run the following codeimport java.io.*;
import java.sql.*;public class Test1 {
public static void main(String[] args) {
try {
// loads the jdbc odbc bridge driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException e) {
System.err.println("Error" + e) ;
}
try {
// establish db connection through a Connection object
Connection con = DriverManager.getConnection("jdbc:odbc:BooksInfoODBC") ; // instance of a sql statement
Statement stmt = con.createStatement(); // prepare sql statement
String sqlStr = "SELECT * FROM BOOKS"; // execute the SELECT query through executeQuery()
// save the result in ResultSet
ResultSet rs = stmt.executeQuery(sqlStr); // process the result of the ResultSet
System.out.println(" the records selected are");
ResultSetMetaData info = rs.getMetaData(); while (rs.next()) {
for (int i=1; i<=info.getColumnCount(); i++) {
System.out.print("\t" + rs.getString(i));
}
System.out.println();
} // close the ResultSet, Statement and Connection objects
rs.close();
stmt.close();
con.close();
}
catch (SQLException e) {
System.err.println("Error " + e);
}
}
}