在Linux下实现对Microsoft Access Database(.mdb)查询访问

You will need the following:

Linux ( I’m running RedHat 9.0)

PHP

Apache

UnixODBC

MDBTools

INSTRUCTIONS

1) Download the UnixODBC RPM, found here. I installed unixODBC version 2.2.5.1.

rpm -ivh unixODBC-2-2.5-1.i386.rpm

2) Download the MDBTools rpm, found here. I installed mdbtools version 0.5.1. Read limitations!

rpm -ivh mdvtools-0.5-1.i386.rpm

3) Download the MDBTools ODBC driver rpm. Again I installed version 0.5-1.i386.rpm. Read limitations!

rpm -ivh mdbtools-odbc-0.5-1.i386.rpm

4) Add the mdbtools driver to your unixODBC config.

Create a new text file. NON-LINUX user: Beware do not do this on windows as you might get werid new lines, use vi.

[MDBToolsODBC]

Description = MDB Tools ODBC drivers

Driver = /usr/lib/libmdbodbc.so.0

Setup =

FileUsage = 1

CPTimeout =

CPReuse =

NOTE:The driver may be in /usr/local/lib/libmdbodbc.so.0. This happens if you build from source and use the make install command. The RPM puts it in /usr/lib.

Now install the driver using the file you created. This is called a template file.

odbcinst -i -d -f template.file

5) Define the datasource name. This is done in the /etc/odbc.ini file. So pull up this file in vi or another text editor and add the following lines.

[Dogs]

Description = Microsoft Access Database of Dogs

Driver = MDBToolsODBC

Database = /var/data/my_dog_db.mdb

Servername = localhost

UserName =

Password =

port = 5432

That’s it you should now have an odbc connection available. I will demonstrate using php, this assumes that your php is compiled with UnixODBC support, the version that ships with Redhat 9 does if yours does not then you can learn how here.

So I will write a quick php script to query my dogs database and print out the names and weights of my dogs.

$myDB = odbc_connect(”Dogs”,”",”");

$query = “select name, weight from dog_list”;

$result = odbc_exec($myDB, $query);

while (odbc_fetch_row($result)) {

print “Name = ” . odbc_result($result,”name”);

print “

Weight = ” . odbc_result($result,”weight”);

}

If you get a php error that says odbc_connect is not a function then see if you have php-odbc installed. Do rpm -qa php-odbc. If you see php-odbc returned then you have it if not install it., the rpm is available on the redhat discs.

Limitations:

- As of the time of writing this entry MDBTools did not support write access to the mdb files. This was fine for my purposes as I was reading data in and sticking it into a mysql database.

- There is a bug in MDBTools v0.5 which does not allow you to query tables or columns with an underscore. This was a bug I hit early on, but it has been fixed in new version 0.6 but that has not been released as of the time of writing this article. So I recompiled the 0.5 source code with the fix from the 0.6 CVS repository. I have bundled it into a 0.5 release and have the two rpms mentioned above here:

mdbtools-0.5-1.i386.rpm

mdbtools-odbc-0.5-1.i386.rpm

I would check the official download site before using my hacked version as I’m sure this bug will be fixed in 0.6 (plus rumor has write access will be present as well).

from http://www.517sou.net/blogview.asp?logID=1069&cateID=12

延伸阅读coded by nessus

java linux mdb,在Linux下实现对Microsoft Access Database(.mdb)查询访问相关推荐

  1. lnux php 连接access,在Linux下实现对Microsoft Access Database(.mdb

    在Linux下实现对Microsoft Access Database(.mdb [ 网络作者:佚名 更新时间:2009-02-23 | 字体:大 中 小] [导读]You will need the ...

  2. qt调用Linux脚本范例,QT下实现对Linux Shell调用的几种方法

    使用QProcess QThread ============================================ #include int main() { QProcess::exec ...

  3. Asp代码转换java代码器_asp下实现对HTML代码进行转换的函数

    asp下实现对HTML代码进行转换的函数 更新时间:2007年08月08日 12:08:49   作者: '****************************** '函数:HTMLEncode( ...

  4. Access 和vc6.0 相连,在我indows64 位系统中,出现找不到Microsoft Access Driver(*.mdb) ODBC驱动程序的安装例程。请重新安装驱动

    今天要连接Access时发现win7 64位旗舰版控制面板中管理工具下的数据源(ODBC)配置竟然只有SQLServer的驱动,其他的都没有了,这可不好玩!上网百度了一番,有人也遇过这样的问题,我在此 ...

  5. 问题“找不到Microsoft Access Driver(*.mdb)ODBC驱动程序的安装例程”的解决方法

    问题描述:笔者电脑明明安装了Access数据库软件,但打开控制面板-数据源(ODBC)-MS Access Database,总是提示"找不到Microsoft Access Driver( ...

  6. odbc里面没有Microsoft Access Driver(*.mdb)问题解决

    2019独角兽企业重金招聘Python工程师标准>>> 电脑的odbc里面没有Microsoft Access Driver(*.mdb),并且我已经装上了microsoft off ...

  7. win10 ODBC数据源32位没有Microsoft Access Driver(*.mdb,*accdb)

    在OrCAD Capure CIS进行配置过程中遇到了不少的问题,其中一个就是ODBC数据源32位没有Microsoft Access Driver(*.mdb,*accdb),究其原因就是没有安装M ...

  8. java iris_利用K-Means聚类算法实现对iris.data.ulab

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 利用K-Means聚类算法实现对iris.data.ulabel数据的聚类,这是在网上找到如果要换成我的iris.date iris.date.ulabl ...

  9. JAVA ftps设置_Java使用JSCH实现对FTPS服务器文件操作

    SFTP是Secure File Transfer Protocol的缩写,安全文件传送协议.可以为传输文件提供一种安全的加密方法.SFTP 为 SSH的一部份,是一种传输文件到服务器的安全方式.SF ...

最新文章

  1. vt Hypervisor Framework
  2. 自动装配——@Resource(JSR250)和@Inject(JSR330)---[java规范的注解]
  3. python画五角星填充不同颜色_Python绘制分形树(一)
  4. 使用Golang自定义Kubernetes Ingress Controller
  5. Spring-Cloud的版本是如何定义的
  6. 韩流音乐爱好者的福音!SM娱乐牵手腾讯音乐
  7. python做性能测试_Python做性能测试-1、Locust基础篇
  8. 多个excel合并为一个excel的多个sheet
  9. OMNeT++学习---TicToc(1)
  10. 2016-07-09Cpp_jianjie
  11. boren - 飞机大战9之战机爆炸
  12. android下划线链接,android7.0 TextView去除超链接下划线就这么难吗?
  13. 微信 客服消息 发送 微信会回调三次的问题
  14. 2022-2028年中国美容行业发展趋势前瞻与投资战略规划分析报告
  15. java 一周的第一天_Java获取某年某周的第一天
  16. alin42490怎样解除_最新版农药通用名称与CIPAC编号对照表
  17. 我们为什么要做智慧社区,智慧社区主要服务在哪些行业
  18. 【文本匹配】ESIM模型
  19. 微软中国裁员计划曝光:年底前裁完!补偿不变!
  20. uni-app web-view调用谷歌地图

热门文章

  1. Full Transportable Export/Import实验
  2. 2019_GDUT_新生专题V算法优化 F. Expedition POJ 2431
  3. halcon—利用顶帽操作减轻图像灰度不均匀对二值化的影响
  4. 深度学习小白装机-记录一下
  5. Android - 九宫格
  6. Jungle Roads丛林道路(最小生成树PrimKruskal算法)
  7. ios6.0 siri语音识别
  8. h5获取浏览器的相机和摄像头权限
  9. 陈老师的一些单片机外围电路设计心得
  10. 零输入响应与零状态响应响应