posts - 44,  comments - 48,  trackbacks - 0
 

package connection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class ConnectionAccess {


 public static void main(String[] args) {
try{
 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 Connection con=DriverManager.getConnection("jdbc:odbc:employee","","");
 Statement stmt =con.createStatement();
 ResultSet rs =stmt.executeQuery("select fname,minit from employee");
 while (rs.next()){
 System.out.print("\t fname:"+rs.getString(1));
 System.out.print("\t minit:"+rs.getString(2));
 System.out.println();
 }
 rs.close();
 stmt.close();
 con.close();
 }catch(Exception e){
 e.printStackTrace();
}
 }

}

posted @ 2006-08-22 13:07 摩西 阅读(720) | 评论 (1)编辑 收藏
  http://tianhb.blogchina.com/1134569.html 
posted @ 2006-08-21 12:37 摩西 阅读(124) | 评论 (0)编辑 收藏
仅列出标题
共5页: 上一页 1 2 3 4 5