在Linux下实现对Microsoft Access Database(.mdb

【 网络作者:佚名 更新时间:2009-02-23 | 字体:大 中 小】

[导读]You will need the following:Linux ( I’m running RedHat 9.0)PHPApacheUnixODBCMDBToolsINSTRUCTIONS1) Download the UnixODBC RPM, found here. I installed unixODBC version 2.2.5.1.rpm -ivh unixODBC-2-2.5-...

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).

转载请注明来源:IT学习网

网址:http://www.t086.com/ 向您的朋友推荐此文章

特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系我们,我们会尽快予以更正。

lnux php 连接access,在Linux下实现对Microsoft Access Database(.mdb相关推荐

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

    在Linux下实现对Microsoft Access Database(.mdb)查询访问 You will need the following: Linux ( I'm running RedHa ...

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

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

  3. linux配置apache文件大小,linux下限制Apache日志access.log以及error.log文件大小

    如果网站开启了apache日志文件以及错误日志功能,那么很可能apache日志文件access.log在一段时间内就会很庞大至上百兆甚至几十个G,尤其大访问量的网站更是如此.error_log错误日志 ...

  4. linux上连接ftp服务器,linux下lftp连接ftp服务器进行上传与下载的方法详解

    摘要 腾兴网为您分享:linux下lftp连接ftp服务器进行上传与下载的方法详解,中英翻译,中建在线,掌上看家,银行帮等软件知识,以及微信一键转发工具,小学英语冀教版,正是在下表情包,易问电信,万能 ...

  5. linux mysql如何远程连接mysql数据库,Linux下远程连接MySQL数据库的方法

    Linux下远程连接MySQL数据库的方法 踩坑笔记 估计搞了一个多小时才把这个远程连接搞好.一台本地电脑,一台云服务器,都是linux系统. 步骤 1.在服务器端开启远程访问 首先进入mysql数据 ...

  6. linux连接到程序,Linux下C程序的链接过程

    今天看到一个很有意思的小程序,它让我对Linux下C程序的编译链接有了一个全新的认识! 这个程序的就是写一个简单的输出"hello World!": 要求:1.不使用C运行库,写一 ...

  7. linux设备连接磁带机,linux下磁带机的使用

    Linux下使用磁带机的方式有多种, tar命令是最经常使用的方法,tar主要用于单机环境下,将数据直接写入磁带机.磁带机在Linux下对应的设备名称为/dev/stX,如果是第一个磁带机,即为/de ...

  8. linux查看mysql连接日志文件,linux下查看mysql日志文件的方法

    查看mysql日志方法: mysql默认不允许我们查看日志.需要更改一些设置 1 vi 更改配置文件 允许用户查看日志文件 sudo vi /etc/mysql/mysql.conf.d/mysqld ...

  9. android读写access数据库,Android中利用远程Microsoft Access数据库应用程序

    我写一个Android应用程序,它接受一个字符串,通过条码阅读器读取,然后当一个特定的按钮按下时,它会认为字符串发送到数据库将他们的价值设定为"库存"或"缺货" ...

最新文章

  1. 橘子CPS联盟操作手册2021.09
  2. 探讨由于死锁或进程阻塞造成的ASP突然不能访问的问题
  3. SGU - 507 启发式合并维护平衡树信息
  4. JavaScript原型学习
  5. usb接口电路_RS232接口与RS485的不同之处
  6. LUA table.sort的问题,数组与表的区别
  7. 为什么苹果不再需要谷歌地图?
  8. Qt4_实现Edit菜单
  9. 笔记之配置 solr和zookeeper遇到的问题
  10. exchange服务器磁盘性能,如何解决Exchange磁盘空间问题
  11. 5. Linux 设备文件名
  12. Mongodb下载、安装、配置与使用
  13. 开平方的快速算法(C程序)
  14. python暴力破解压缩密码?
  15. iOS开发各种证书问题
  16. java ip138_判读ip所在地(通过百度ip138的提供的服务) java实现
  17. ERP 毛需求PAB初值净需求量计划产出量pab计划投入量 atp求法
  18. Centos6 安装python3 pip3 ipython3
  19. IDC数据:中国VR市场2017预计增幅将达441.2%
  20. java固件包_iOS13 各版本固件下载地址以及更新方法

热门文章

  1. charles证书过期如何处理
  2. azure databricks 时区设置
  3. 基于javascripts的语法特性使用设计原则
  4. 小草说----大数据和机器学习为什么这样火
  5. time of our lives---从世界杯主题曲看厚脸皮的德国人:)
  6. 计算机类博士阶段学术规划,计算机博士生职业生涯规划咨询
  7. 洛谷三月月赛——P5238 整数校验器
  8. Salem and Sticks-萨鲁曼的棍子 CodeForce#1105A 暴力
  9. linux+手机+gps,Linux环境下利用GPS+蓝牙实现移动定位
  10. Microsoft.NET Framework 全面开源