每天進(jìn)步一點(diǎn)點(diǎn)
          每天進(jìn)步一點(diǎn)點(diǎn)
          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-07-31 17:26 每天進(jìn)步一點(diǎn)點(diǎn) 閱讀(680) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
           
          主站蜘蛛池模板: 宜兰市| 吕梁市| 蒙阴县| 黑龙江省| 盐亭县| 盱眙县| 错那县| 太原市| 湟源县| 佛教| 木兰县| 临西县| 资溪县| 农安县| 乐安县| 通许县| 伊吾县| 呈贡县| 鄂州市| 温州市| 饶阳县| 上思县| 胶南市| 航空| 广州市| 分宜县| 贵德县| 洛阳市| 日喀则市| 崇阳县| 新源县| 庐江县| 平昌县| 诸暨市| 威海市| 盐亭县| 永仁县| 腾冲县| 澎湖县| 拜泉县| 翼城县|