每天進步一點點
          每天進步一點點
          package Test;
          import java.sql.*;
          /**
          ?* <p>Title: </p>
          ?*
          ?* <p>Description: </p>
          ?*
          ?* <p>Copyright: Copyright (c) 2006</p>
          ?*
          ?* <p>Company: </p>
          ?*
          ?* @author not attributable
          ?* @version 1.0
          ?*/
          public class TestConnect {
          ??? public TestConnect() {
          ??? }
          ??? static Connection con = null;
          ??? public static void main(String args[]) {
          ????? try {
          ??????? Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          ??????? //String url="jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ=D://demo.mdb";
          ??????? String url="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D://demo.mdb";
          ??????? //String url = "jdbc:odbc:Access";
          ??????? con = DriverManager.getConnection(url,"","");
          ??????? Statement stmt = con.createStatement();
          ??????? String sql = "select * from base";
          ??????? ResultSet rs = stmt.executeQuery(sql);
          ??????? while (rs.next()) {
          ????????? System.out.println("name= " + rs.getString(1));
          ??????? }
          ??????? rs.close();
          ??????? stmt.close();
          ??????? con.close();
          ??????? //JakartaBasicDataSource.closeBasicDataSourceConnection();
          ????? }
          ????? catch (Exception e) {
          ??????? e.printStackTrace();
          ??????? System.out.println("now you have not ActiveConnection..........break!!");
          ????? }
          ? }
          }
          posted on 2006-08-23 13:50 每天進步一點點 閱讀(694) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
           
          主站蜘蛛池模板: 惠安县| 松溪县| 柳林县| 全州县| 东阿县| 阿鲁科尔沁旗| 鄂托克前旗| 新田县| 临泽县| 永吉县| 邵东县| 师宗县| 贵南县| 嘉义县| 泾源县| 博客| 长武县| 康定县| 四会市| 来安县| 肇源县| 永吉县| 黔西| 五华县| 崇明县| 日土县| 濮阳市| 彩票| 桐柏县| 兰坪| 靖江市| 曲沃县| 梅州市| 锦州市| 东明县| 甘德县| 阿巴嘎旗| 紫金县| 梅州市| 区。| 五家渠市|