http://www.perlmonks.org?node_id=1006145

Shuraski has asked for the wisdom of the Perl Monks concerning the following question:

Oh wise monks...

I have a web app lovingly crafted in Perl using Catalyst. It is linked to an SQLite database on my development machine. Now it's time to deploy. I have a web server to host the front end. And a db server to host the back end. My institution requires this, and it seems like good practice. Only I have no idea how to pass queries from the web server to the db server, and how to pass fetched data back from the db server to the web server. Various advice has included, "Oh, that's easy, just wrap it all in JSON" -- but I have not been able to find more specific recipes despite a grand tour of google and CPAN.

I'm sure someone here has solved this in their sleep many a time...Any advice on at least where to begin? I am quite capable of figuring most things out from at least a starting point...

Grateful thanks.

Replies are listed 'Best First'.
Re: Passing queries and data from a web server to a db server and back again...
by roboticus (Chancellor) on Nov 29, 2012 at 03:30 UTC

    I'd suggest moving to a database that supports network connections and just use the DBI package. I'm sure MySQL and PostgreSQL would be good. If your company already supports other databases, you might use one of those. I assume you're already using DBI to access SQLite, so if that's the case you'd just have to build your database on the database server and figure out the connection strings for DBI.

    On the other hand, if your application doesn't require much in the way of data, and you don't expect it to grow beyond the capabilities of SQLite, then I guess you could always use DBD::Proxy so you can run SQLite on the database machine and your Catalyst app on the web server machine.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Thanks for the suggestion, did the conversion over to MySQL today. Come to think of it, now I remember hearing this about SQLite at some point -- good for quick development but not for deployment. So now I know. I am already using DBI for access, and will use that for MySQL as well.

      Will keep you posted if I run into any glitches... I will also check out the features of DBD::Proxy -- never know when that might come in handy...

Re: Passing queries and data from a web server to a db server and back again...
by space_monk (Chaplain) on Nov 29, 2012 at 10:55 UTC

      Thanks for bringing my attention to this node -- was an interesting read, very helpful in that it got me to dig further into the documentation for sqlite.

      Thanks again!