On Wed, Jun 23, 2010 at 16:31, Chap Harrison <c...@pobox.com> wrote:
> Hi,
>
> I have a Perl app that makes SQL queries to DBF (DBase IV) databases.  I 
> haven't found a reliable DBI::DBD module for accessing DBase IV, but I do 
> have a copy of the JDBC library, so I wrote a simple Java command-line 
> program that accepts a database path and a query on the command line, 
> connects to the database, executes the query, and writes the result set to 
> STDOUT.  Then, from Perl, I write
>
>    my @rows = qx(java lmi_DBFAccess -d '$db_path' -q "$sql_query");
>
> It's kludgy, but it works.  However, due to the overhead of qx, and of 
> establishing a fresh connection to the database for every query, it's slow, 
> and I want to improve it.
>
> I figure that I should convert lmi_DBFAccess to run as a local daemon, and 
> use IPC to send the above parameters - and receive the results.  
> lmi_DBFAccess will now cache its previously-established connections and use 
> them when needed.
>
> I've never done IPC before (well, besides command piping).  I've been wading 
> through perlipc, and I have a headache.  Would someone be so kind as to give 
> a high-level outline of what I need to do on the Perl side?
>
> Some salient details:
>
> -- I'm running in Cygwin on Windows Server 2003
> -- Perl 5.10
> -- As can be inferred from the qx above, a synchronous protocol is fine.
>
> Sure do appreciate it!
> Chap Harrison
snip

You may want to look at [Inline::Java][1].  It allows you interact
with Java from inside of Perl instead of having to run a separate
process.

[1] : http://search.cpan.org/dist/Inline-Java/Java.pod

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to