java操作dbf文件
来源:互联网 发布:sql一对多查询join 编辑:程序博客网 时间:2024/05/07 20:09
今天才知道原来java可以直接读取dbf文件,不用附加到数据库了
遇到不少问题 mark一下1),我是win7系统,提示 [Microsoft][ODBC 驱动程序管理器] 驱动程序不支持此功能” 需要把vfpodbc.dll降级版本 , 大小为955K,版本6.1.8630.1 放到C:\Windows\System32
下载地址百度一下都有
2)、url的db路径为dbf 文件存放的路径,不要指向dbf文件 select * from xx为该文件的名
3)、遇到个问题不知道为啥 System.out.println(rs.getString(column));报异常,no data found 但是 String str=rs.getString(column); 然后打印str 就不报错了 不知道为啥?
贴出代码:
import java.io.IOException;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;/** * 如果提示 [Microsoft][ODBC 驱动程序管理器] 驱动程序不支持此功能” * 更新vfpodbc.dll, 大小为955K,版本6.1.8630.1 放到C:\Windows\System32 * url的db路径为dbf文件存放的路径 select * from xx为该文件的名 */public class connection { public static void main(String[] args) throws SQLException, IOException { System.out.println("输出:"); connection cont = new connection(); cont.Close(); } Connection con = null; Statement st = null; ResultSet rs = null; public connection() throws SQLException { getConnection(); } public Connection getConnection() throws SQLException { try { String url = "jdbc:odbc:driver={Microsoft Visual FoxPro Driver};" + "SourceType=DBF;SourceDB=" + "C://"; con = DriverManager.getConnection(url); } catch (Exception e) { e.printStackTrace(); } String sql = "select * from get where A0='基金资产净值:'"; st = con.createStatement(); rs = st.executeQuery(sql); while (rs.next()) { String str = rs.getString("A4"); System.out.println(str); } return con; } public void Close() { try { if (rs != null) { rs.close(); } if (st != null) { st. close(); } if (con != null) { con.close(); } } catch (SQLException e) { e.printStackTrace(); } }}
- java操作dbf文件
- JavaDBF操作DBF文件
- C#操作dbf文件
- java读写dbf文件
- java 读取dbf文件
- java编辑dbf文件
- Java 读取dbf文件
- 使用java操作dbf文件的方法---JDBF(转载)
- jdbc-odbc操作dbf文件
- java 读取 dbf数据库的dbf文件代码
- python下用dbfread操作DBF文件
- c# 对dbf文件的操作问题
- java对DBF的Memo字段操作
- Java解析之纠结的DBF文件
- Java dbf文件写入远程服务器
- DBF操作:多线程下的ADO连接DBF文件获取信息的解决
- ASP对FoxPro自由表(DBF文件)的操作
- c语言写的*.dbf文件的操作函数库
- 设计方舟第一站之细节
- a标签
- flash中的crossdomain.xml文件详解
- grep 命令
- 由for循环想到的
- java操作dbf文件
- ios pdf解决显示乱码问题
- flv 播放器NetStream问题NetStream.Play.InsufficientBW NetStream.Buffer.Full
- error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned
- linux网络命令
- English_adopt/take-up
- Java线程同步 (synchronized wait notify)
- AD10 多层板设计错误解决
- C#读取注册表信息