• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing a file system HSQLDB through PHP

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Matthew Snow
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic