在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. bzoj1927: [Sdoi2010]星际竞速
  2. 如何保持两个文件的手动同步。
  3. 缓冲区溢出基本C程序的控制台和Win32版本
  4. C#的未来:简化参数空值验证
  5. 去掉chorme浏览器自动补全时input框的背景样式
  6. c语言字符全排列数组,使用c语言递归实现字符串的全排列
  7. .net java xml_java.net.MalformedURLException – 在通过StAX解析XML文件时
  8. ajax传单参数接受不了,Choropleth传单ajax
  9. plc原理及应用_一年只一次,百篇电工+PLC技术资料大合集,不看真的亏!
  10. PowerBuild安装不了怎么办?
  11. Windows NTSTATUS Values 进程终止消息标识符
  12. 广度优先搜索算法1-已知若干个城市的路线,求从一个城市到另外一个城市的路径,要求路径中经过的城市最少。
  13. 刷爆朋友圈,码农月薪七万可以落户北京啦
  14. 实验室设计如何搭配颜色色彩
  15. 阿里云ECS-Centos7.9集群部署Redis服务遭木马攻击
  16. (超详细)MapReduce工作原理及基础编程
  17. 机械键盘恢复出厂fn_怎么切换fn恢复f1 - 卡饭网
  18. 模式识别实验matlab报告,西安交大模式识别实验报告.doc
  19. 最全ASCII对应码表-键值
  20. linux 网口对应网卡_电脑实用小工具:仓华网卡转换器+USB3.0分线器体验

热门文章

  1. 手动编译源代码安装GR GSM
  2. 计算任意多边形的面积
  3. 深度学习高温蒸馏:Softmax With Temperature
  4. 牛客网刷算法题的输入输出(C++)
  5. one-stage two-stage 的区别
  6. 服务器ibm3650性能,IBM System x3650 M3系列参数、功能、性能_IBM System x3650 M3系列服务器配置_太平洋产品报价...
  7. 【入门PLC】02、博途TIA Portal V16的HMI简单操作学习(人机交互界面)
  8. 没毕业就3次跳槽的经历,走不平凡的路,让人跌破眼镜。
  9. 如何写好一篇论文-02
  10. 多人审批功能简单实现