Mar
09
2011

More Hacking Nikon's "Picture Project"

ODBC Connections To Access Databases in PHP

Wednesday, March 9, 2011 - 01:28:51 pm
(Posted Under: Development, Photography, PictureProject)
As a follow up to Hacking Nikon's "Picture Project", with a bit of playing around, amazingly I've been able to automate the entire process of moving photos onto network drives. The only missing part of the puzzle was updating the access database without screwing around with Access.

Using the ADOdb Database Abstraction Library for PHP, it's possible to create a connection to the Access database and manipulate the data from a PHP script. Pretty sweet, and it put's all the pieces in place for me.

The execution of a simple SQL query will relocation the file location.

UPDATE SourceTable SET Path='DST' WHERE Path='SRC'
Of course, with anything Microsoft, nothing is simple. "UPDATE SourceTable SET Path=Replace(Path, SrcPattern, DstPattern)", which would work if run directly in Access does not work with the ODBC drivers as the 'replace' function isn't available. Every row to update needs to be SELECTed, and then UPDATEd individually, with any text replacement done in PHP.

As far as I can tell it only works under Windows. It'd be convenient for me if there were ODBC drivers for Access under Linux. But with that said, I can absolutely make this work for me.

Post Comment



All fields are required. Email addresses will not be published, but are required for anti-spam purposas.

Switch Styles

About Style Switching.

!Weblog Index

Feb March 2011 Apr
SU MO TU WE TH FR SA
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

Categories

RSS FeedRSS Feed