http://qs321.pair.com?node_id=123057

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

Don't bother saying it =] I know I should use DBI. But this is one of those situations where installing a module that's not all perl is BAD. I have been through ten rounds on it already and cannot win. *whew*

So, with that out the way, anyone have suggestions on how best to do this? I will be forking off about ten or so kids and I know they can share objects. I was thinking just creating an oject that holds a DB connection prior to the fork and then they could all see it, right? I can't test until Monday, but I wanted to see what all/any of you thought, first. There may be some very simple option I'm missing. thanks =]

We speak the way we breathe. --Fugazi

Replies are listed 'Best First'.
Re: DB connection sharing w/o DBI?
by dws (Chancellor) on Nov 03, 2001 at 22:39 UTC
    But this is one of those situations where installing a module that's not all perl is BAD.

    You mention fork(), which suggests that you might not be in Win32. If you were, you could use either Win32::ODBC or Win32::OLE (to do db access through ADO). Both are part of the standard install (for ActiveState, at least).

    Please say more about what environment you're working on, and what type of database you're trying to connect to.

      Sorry about that. Been a while since I posted and I forgot my manners =]

      This would need to work on most *NIX flavors and it would always be connecting to Oracle. Took a stroll through CPAN before posting and seems all the modules to access Oracle involve some binary of some sort...no pure perl that I saw.

      We speak the way we breathe. --Fugazi

        To my knowledge there is no pure-Perl implentation of Oracle's network protocols. DBD::Oracle makes use of a locally-installed Oracle client library (which I suspect probably carries licensing issues) to do the actual work.

        You may have some luck getting ODBC to work. I believe there are some freely available ODBC implementations out there, though I don't know if any of those are pure-Perl either.

        You say you've gone through the process of trying to install non-Perl components (I'm assuming modules that are implemented at least partially in C) and have failed. I'm not sure that it's going to be easier for you to find an all-Perl solution this or if you just need to bite the bullet and solve whatever fundamental problem that exists with your system that is making it difficult for you to install C-based Perl modules.

Re: DB connection sharing w/o DBI?
by runrig (Abbot) on Nov 04, 2001 at 01:56 UTC
    Sorry to hear it. Sounds like maybe someone wants this solution to fail and is sabotaging it so it can be implemented some other way. You could pipe sql to SQL*Plus and read the results back out, it's kind of kludgy and slow but I did the same thing with Informix (piping to Informix's dbaccess) awhile back when it was taking a long time to get someone to install the Informix SDK (a prerequisite for DBD::Informix). I tried to batch the commands as much as possible so I wouldn't have to essentially connect to the database too many times. In fact, to be efficient, it might be worthwhile to just code alot of it in PL/SQL if you can't whack any sense into someone with a heavy clue x 4.
      you're close =] It's actually a large political war I'm trying to side-step. Short version is I'm taking functionality we have in one place and putting it in another because it makes sense. The official channels for getting that done are too busy arguing over who's got the bigger, errr.. I mean, who's going to get the credit. I figure if I just do it then the arguing becomes moot. But I have to do it without any official help, which means no altering the servers in any way I cannot as my own ID...fun, eh?

      We speak the way we breathe. --Fugazi

        no altering the servers in any way I cannot as my own ID..

        Well, you can always install into your own directories by running 'perl Makefile.PL PREFIX=/home/myhomedirectory/perl/lib', and then making sure that the directories and files are readable by everyone, and using 'use lib qw(/home/myhomedirectory);' in all the scripts you write (that's assuming you're doing the make/make test/make install thing instead of using the CPAN module or downloading an ActiveState PPM or ...?) :-)