aspose file tools*
The moose likes PHP and the fly likes Accessing a file system HSQLDB through PHP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » PHP
Bookmark "Accessing a file system HSQLDB through PHP" Watch "Accessing a file system HSQLDB through PHP" New topic
Author

Accessing a file system HSQLDB through PHP

Matthew Snow
Ranch Hand

Joined: May 02, 2007
Posts: 82
I am able to do this in Java with HSQLDB's jdbc driver as follows:



This would reference a db.script file located on the file system at C:\Test\ which contained the schema for all the tables being used as well as their data. Is it also possible to reference a HSQLDB script file within the same working directory as your PHP code using oci, odbc, pdo or something else?


When you break the big rules, you get a lot of little rules.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41816
    
  62
I don't think HSQLDB has bindings to languages other than Java. Derby apparently has: https://www.ibm.com/developerworks/data/library/techarticle/dm-0409casey/; maybe that's an option instead of HSQLDB?


Ping & DNS - my free Android networking tools app
Matthew Snow
Ranch Hand

Joined: May 02, 2007
Posts: 82
I see. The reason I'm wanting to do this is I'm dealing with large amounts of data from a web service and so have sacrificed memory for speed and of course I'm running into heap size issues just using arrays. Rather than just increasing PHP's heap size, I thought I'd use the on-demand'ness of a database to dump the data in bulk from the web service so I could query it as needed much faster. I was hoping to go with a "lite as can be" local file system database like HSQLDB which wouldn't require web server or a bunch of libraries to setup. Is there something akin to this in PHP, or should I be approaching the problem in another way?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

It isn't hard to set up MySQL, and using MySQL with PHP is a very common thing to do. They even gave it its own acronym: LAMP meaning Linux, Apache, MySQL, PHP. Not that you have to use all four of those technologies of course, I just mean that MySQL+PHP is a very common pairing.
Matthew Snow
Ranch Hand

Joined: May 02, 2007
Posts: 82
Thanks for the advice. From what I'm reading online it seems like that's going to be my bread and butter for PHP development, though for this instance I'll probably go with SQLite.
Matthew Snow
Ranch Hand

Joined: May 02, 2007
Posts: 82
Just as a wrap up if anyone else new to PHP is trying to use a minimalist database with their PHP script, the following code works after enabling the php_sqlite3.dll extension in the php.ini file for Windows users. When run, this code will create a file test.db in the same directory where it is run.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing a file system HSQLDB through PHP