用java连库,用语句新建一个库,然后,再操作本地文件目录,把新建的库copy出来,哈再放到应用程序里,提供下载!最后把新建的库再删除了,哈 是不是很简单呀!!!

解决方案 »

  1.   

    private String userName = "";
      private String password = "";
      private String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
    String url="jdbc:odbc:driver={Microsoft DBase Driver (*.dbf)};DBQ=D:\\Temp"; private java.sql.Connection connection;
      protected ResultSet resultSet = null;
      protected ResultSetMetaData resultSetMetaData = null;
      private java.sql.Statement statement=null;
      /*
       创建一个连接
      */
      private Connection getNewConnection() {
        try {
          this.connection.close(); //试图关闭连接
        }
        finally {
          this.connection = null; //释放连接
          try {
            Class.forName(this.driverName); //加载驱动程序
            try {
              this.connection = DriverManager.getConnection(this.url, this.userName,this.password);
    //          JOptionPane.showMessageDialog(null, "数据库连接成功!");
            }
            catch (SQLException e) {
              JOptionPane.showMessageDialog(null, url);            //JOptionPane.showMessageDialog(null,"连不上数据库,请检查数据源");
                System.exit(0);
               throw e;
            }
          }
          finally {
            return this.connection; //返回新建立的连接
          }
        }
      }
      public java.sql.Connection getConnection() {
          if (connection != null) {
            try {
              if (connection.isClosed()) {
                connection = null;
                getNewConnection();
              }
            }
            catch (SQLException ex) {
            }
          }
          if (connection == null) { //没有设置连接则创建一个连接
            getNewConnection();
          }
          return connection;
        }
    用SQL语句在TEMP中创建数据表,就OK了
      

  2.   

    从Oracle 查询得数据,导入DBF中就可以了
      

  3.   

    to  LittleLandlord(小地主) :
    如何在D:\\Temp 目录下建立dbf格式的数据库表:我目前需设三个字段:姓名(varchar2(2))、帐号(varchar2(20))、工资(number(10,2)),谢谢!
      

  4.   

    用SQL语句,CREATE TABLE tablename (name CHAR(20),account CHAR(20))
      

  5.   

    String sql = "CREATE TABLE tablename (name CHAR(20),account CHAR(20),wage NUMBER(10,2))";执行SQL语句不会?
      

  6.   

    执行完SQL语句,就已经在D:\temp创建了一个tablename.DBF数据库文件
      

  7.   

    只需要安装dbase的驱动就可以了,是不是,不需按照dbase?解决完即给分,谢谢!
      

  8.   

    只需要安装dbase的驱动就可以了,是不是,不需安装dbase?解决完即给分,谢谢!