Hi Alex,

Assuming that I understood your situation I'll make this suggestion. I'm not sure 
whether this option is supported in you PHP version but I think it'll be definitely 
available after (and with) 5.0.

There are new function series called Sqlite (www.sqlite.org), an embded file based SQL 
driver which supports SQL-92. As I see, this will be the best substitute for Access 
MDB, on Linux platforms. From what I've tried sqlite is much faster and much stable 
than MS Access.

This would've been the ideal solution if your PHP version is supported. If not the 
case still U can stick to Flat File based or CSV based data solutions (U'll have to 
mess up lot with PHP :)).

Regards,

Kosala

-----Original Message-----
From: Alex Gemmell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 6:12 PM
To: PHP List
Subject: [PHP-DB] Linux/PHP/Access Database - oh boy :(

Hello all,

I am fairly new to Linux/PHP so please bear with me.  I have an awfully awkward 
problem to solve - a stop gap solution for the next 6 months until we have out 
in-house servers set up and running.  I also have a very short timeframe to sort this 
out.  I am using PHP on a remotely hosted Linux web server to build my website, 
however I have been given a MS Access database to use!  Despite my best efforts (and 
two days Google trawling) I haven't found a suitable solution so I am turning to your 
collective knowledge...

First things first - I do not run the server and cannot install any new tools on to it 
(I cannot access the folders above my web root).  There are lots of suggestions on the 
net about installing MDBTools and UnixODBC RPM 
(http://bryanmills.net:8086/archives/000099.html) - but that involves the admin who 
won't do it!  I can, of course, put scripts that may help in the actual web folder and 
reference them if anyone has any ideas...

I know I must use a DSN-less connection.  I first tried connecting directly to the mdb 
file using:
        $conn = new COM("ADODB.Connection") or die ("Cannot create ADODB Connection 
object."); 
        
        //$connstr = "PROVIDER=MSDASQL;DBQ=/prices/mydb.mdb;"."DRIVER={Microsoft 
Access Driver (*.mdb)};" 
        //$connstr = "Provider=Microsoft,.Jet.OLEDB.4.0; Data Source=". 
realpath("prices/mydb.mdb") ." ;";
        // I've never got the above two connection strings to work but I include them 
for completeness and in case any realises they might help me!
        $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". 
realpath("prices/mydb.mdb") ." ;";

       $conn->open($connstr);

This worked on my localhost running IIS 5 (unsurprisingly) but fell over immediately 
on the Linux box.  I am told this is because COM support in PHP before version 4.3.x 
is buggy (he PHP version installed on the server is 4.1.2).  Is this true?  Will 
upgrading to version 4.3.x solve all my problems?

Also, I heard that converting the .mdb file to a .dbf file might help - but how do I 
connect to that with PHP?  The PHP manual says this about dbase functions:
"These functions allow you to access records stored in dBase-format (dbf) databases. 
There is no support for indexes or memo fields."
That's no good because I have long text fields in the Access database that are of type 
"memo"!
The Manual also says "we recommend that you do not use dBase files as your production 
database" - eek!  It's only a small database (one table with about 50 records, each 
with no more than 20 fields) so hopefully it will suffice.

Am I right in thinking I have very few options?   I don't want to move over to ASP 
(would that even help?) because it means learning VBScript and I don't have a lot of 
time.  Also, I can't use another database (e.g. MySQL) cos the server admin is NOT 
helping me and won't install anything new.

I know 99% of you will want to tell me to just back out of this horrible tangle and 
take a different route, but is there one person out there who can help me get through 
this nightmare?

Thank you!

Alex Gemmell
¦:¦ Reply-to: [EMAIL PROTECTED]:¦
 
Or call me for free using Skype: 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to