• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            <2006年10月>
            24252627282930
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            統計

            • 隨筆 - 44
            • 文章 - 0
            • 評論 - 86
            • 引用 - 0

            常用鏈接

            留言簿(6)

            隨筆分類(31)

            隨筆檔案(44)

            Mining

            最新隨筆

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            在Linux下實現對Microsoft Access Database(.mdb)查詢訪問
            介紹了如何在Linux訪問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).

            posted on 2006-10-09 11:19 泡泡牛 閱讀(5854) 評論(0)  編輯 收藏 引用 所屬分類: Linux

            少妇久久久久久久久久| 国产成人久久精品麻豆一区| 亚洲欧美一级久久精品| 国产 亚洲 欧美 另类 久久| 国产精品久久久久一区二区三区| 免费观看久久精彩视频 | 人妻中文久久久久| 亚洲欧美成人久久综合中文网| 亚洲国产视频久久| 久久伊人精品青青草原日本| 久久久久久综合一区中文字幕 | 久久婷婷人人澡人人| av午夜福利一片免费看久久 | 国产精品久久久久…| 亚洲欧美久久久久9999| 人人妻久久人人澡人人爽人人精品| 久久久久四虎国产精品| 日本欧美国产精品第一页久久| 久久久这里有精品中文字幕| 一级做a爰片久久毛片16| 久久久久99这里有精品10 | 97精品久久天干天天天按摩| 色综合久久天天综线观看| 一本一本久久A久久综合精品| 国产香蕉久久精品综合网| 国产成人精品久久一区二区三区av | 国产精品青草久久久久福利99| 国产成人精品久久二区二区| 久久九九兔免费精品6| 日本强好片久久久久久AAA | 久久99精品国产麻豆宅宅| 久久99国产精品成人欧美| 久久精品国产亚洲av麻豆蜜芽| 日本免费久久久久久久网站| 99精品久久久久久久婷婷| 国产伊人久久| 成人亚洲欧美久久久久 | 久久国产免费直播| 色综合久久最新中文字幕| 久久亚洲美女精品国产精品| 国产免费久久精品99久久|