Question On Connection Metadata (hostname/port/internal name)

2010-05-27 Thread Barlow, Ed
Hi Guys

 

For the past few years have been writing an advanced enterprise monitor
for databases 

 

My database autodiscovery process is fairly good - but I have one issue.
I cant figure out how to fetch the information underlying a DSN on unix
- specifically I want to discover the hostname/port for each existing
DSN. 

 

This -can- obviously be done after I connect to a server using server
functions. On win32 I use  %atts=Win32::ODBC::GetDSN($dsn).  Sybase has
an interfaces file.  Mysql  Oracle are the show stoppers.

 

Are there any mechanisms/methods that can get the underlying information
about the dsns fetched with available_drivers()/data_sources()?  I am
not even sure this is possible given the DBD spec. Any ideas ? 

 

Thanks in advance

 

 

Ed Barlow

Director Database  Compliance

Millennium Partners

1700 East Putnam Ave, Old Greenwich, CT, 06870

* ed.bar...@mlp.com*

* 212 841- 4154 * 646 645-5930

 


##
The information contained in this communication is confidential and
may contain information that is privileged or exempt from disclosure
under applicable law. If you are not a named addressee, please notify
the sender immediately and delete this email from your system.
If you have received this communication, and are not a named
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
##


Re: Question On Connection Metadata (hostname/port/internal name)

2010-05-27 Thread John Scoles

Barlow, Ed wrote:

Hi Guys

 


For the past few years have been writing an advanced enterprise monitor
for databases 

 


My database autodiscovery process is fairly good - but I have one issue.
I cant figure out how to fetch the information underlying a DSN on unix
- specifically I want to discover the hostname/port for each existing
DSN. 

 


This -can- obviously be done after I connect to a server using server
functions. On win32 I use  %atts=Win32::ODBC::GetDSN($dsn).  Sybase has
an interfaces file.  Mysql  Oracle are the show stoppers.

 


Are there any mechanisms/methods that can get the underlying information
about the dsns fetched with available_drivers()/data_sources()?  I am
not even sure this is possible given the DBD spec. Any ideas ? 

 
Off the top of my head I would say No. The closest thing I can think of 
are the

load_dbnames
data_sources

methods on the DBD Driver handle.

Not sure if these will give you what you want though. In DBD oracle they 
really only just read the TNSNAMES.ora file which as you know may 
contain good or bad entries.


Hope this helps

cheers
John Scoles


Thanks in advance

 

 


Ed Barlow

Director Database  Compliance

Millennium Partners

1700 East Putnam Ave, Old Greenwich, CT, 06870

* ed.bar...@mlp.com*

* 212 841- 4154 * 646 645-5930

 



##
The information contained in this communication is confidential and
may contain information that is privileged or exempt from disclosure
under applicable law. If you are not a named addressee, please notify
the sender immediately and delete this email from your system.
If you have received this communication, and are not a named
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
##



Re: Question On Connection Metadata (hostname/port/internal name)

2010-05-27 Thread Jeffrey Seger
I don't have an Oracle database at hand at the moment, but I believe
that querying v$database, v$instance and/or v$parameter should get you
most of what you want in Oracle.

On Wed, May 26, 2010 at 8:37 AM, Barlow, Ed ed.bar...@mlp.com wrote:
 Hi Guys



 For the past few years have been writing an advanced enterprise monitor
 for databases



 My database autodiscovery process is fairly good - but I have one issue.
 I cant figure out how to fetch the information underlying a DSN on unix
 - specifically I want to discover the hostname/port for each existing
 DSN.



 This -can- obviously be done after I connect to a server using server
 functions. On win32 I use  %atts=Win32::ODBC::GetDSN($dsn).  Sybase has
 an interfaces file.  Mysql  Oracle are the show stoppers.



 Are there any mechanisms/methods that can get the underlying information
 about the dsns fetched with available_drivers()/data_sources()?  I am
 not even sure this is possible given the DBD spec. Any ideas ?



 Thanks in advance





 Ed Barlow

 Director Database  Compliance

 Millennium Partners

 1700 East Putnam Ave, Old Greenwich, CT, 06870

 * ed.bar...@mlp.com*

 * 212 841- 4154 * 646 645-5930




 ##
 The information contained in this communication is confidential and
 may contain information that is privileged or exempt from disclosure
 under applicable law. If you are not a named addressee, please notify
 the sender immediately and delete this email from your system.
 If you have received this communication, and are not a named
 recipient, you are hereby notified that any dissemination,
 distribution or copying of this communication is strictly prohibited.
 ##




-- 
Champions do not become champions when they win the event, but in the
hours, weeks, months and years they spend preparing for it. The
victorious performance itself is merely the demonstration of their
championship character. -T. Alan Armstrong

The Ow that can be expressed is not the true Ow. - Ao Tzu


How to suss out module dependencies...

2010-05-27 Thread William Bulley
I have a question for which I have not been able to find a good answer.

I have a Perl application that uses many Perl modules.  Most come from
CPAN, some I have written, others come with Perl distributions (core?).

I am faced with the need to transport this collection of Perl code from
operating system A to operating system B, both of which are perfectly
well supported by Perl.  Over several months I have added to system A
lots of modules that need other modules.

Unfortunately, system B is rather devoid of most of the modules that I
need for this application.  I dread having to make an inclusive list of
all the modules and all the modules that those modules need, and so on,
and so on.

This is something that CPAN does when I install a new module that has
dependencies on other modules.  BUT in my case I am NOT using the blib,
lib, t, MANIFEST, etc., etc., distribution model of CPAN, so I cannot
use those tools - including several others on CPAN that compliment or
implement this functionality.

So my question is: is there a way to ask the Perl compiler/interpreter
to spit out all the modules (and the other dependent modules) in my
application in some format (a structured tree, a linear text file, etc.)?

Failing that, are there some external tools that can accomplish this
given my main module as a starting point?  Thank you in advance.

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: How to suss out module dependencies...

2010-05-27 Thread C. Chad Wallace

At 2:53 PM on 27 May 2010, William Bulley wrote:

 I have a Perl application that uses many Perl modules.  Most come from
 CPAN, some I have written, others come with Perl distributions
 (core?).
 
 I am faced with the need to transport this collection of Perl code
 from operating system A to operating system B, both of which are
 perfectly well supported by Perl.  Over several months I have added
 to system A lots of modules that need other modules.
 
 Unfortunately, system B is rather devoid of most of the modules that I
 need for this application.  I dread having to make an inclusive list
 of all the modules and all the modules that those modules need, and
 so on, and so on.

The autobundle command of CPAN would give you a bundle file that lists
of all the modules you've installed on system A.  Then you can take
that bundle file over to system B and install it using CPAN.

Your bundle may end up with a lot of extra modules that your program
doesn't need, but you can edit the bundle file and remove them.

Or maybe you could see if you can get a profiler (like Devel::NYTProf)
to tell you which modules are loaded when you load and run your module.


-- 

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0



signature.asc
Description: PGP signature


Re: How to suss out module dependencies...

2010-05-27 Thread Hendrik Schumacher
A crude solution would be to print the contents of %INC somewhere in your
application:

perl -e 'use DBI; use Time::Local; print join (\n, keys %INC);'

Am Do, 27.05.2010, 22:41, schrieb C. Chad Wallace:

 At 2:53 PM on 27 May 2010, William Bulley wrote:

 I have a Perl application that uses many Perl modules.  Most come from
 CPAN, some I have written, others come with Perl distributions
 (core?).

 I am faced with the need to transport this collection of Perl code
 from operating system A to operating system B, both of which are
 perfectly well supported by Perl.  Over several months I have added
 to system A lots of modules that need other modules.

 Unfortunately, system B is rather devoid of most of the modules that I
 need for this application.  I dread having to make an inclusive list
 of all the modules and all the modules that those modules need, and
 so on, and so on.

 The autobundle command of CPAN would give you a bundle file that lists
 of all the modules you've installed on system A.  Then you can take
 that bundle file over to system B and install it using CPAN.

 Your bundle may end up with a lot of extra modules that your program
 doesn't need, but you can edit the bundle file and remove them.

 Or maybe you could see if you can get a profiler (like Devel::NYTProf)
 to tell you which modules are loaded when you load and run your module.


 --

 C. Chad Wallace, B.Sc.
 The Lodging Company
 http://www.lodgingcompany.com/
 OpenPGP Public Key ID: 0x262208A0






Re: How to suss out module dependencies...

2010-05-27 Thread William Bulley
According to Hendrik Schumacher h...@activeframe.de on Thu, 05/27/10 at 17:05:
 
 A crude solution would be to print the contents of %INC somewhere in your
 application:
 
 perl -e 'use DBI; use Time::Local; print join (\n, keys %INC);'

Good suggestion, but won't that list a whole bunch of other stuff
that is not being used, but that exists in the INC tree somewhere?

Maybe that's what you meant by crude.   :-)

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: How to suss out module dependencies...

2010-05-27 Thread William Bulley
According to C. Chad Wallace cwall...@lodgingcompany.com on Thu, 05/27/10 
at 16:41:
 
 The autobundle command of CPAN would give you a bundle file that lists
 of all the modules you've installed on system A.  Then you can take
 that bundle file over to system B and install it using CPAN.
 
 Your bundle may end up with a lot of extra modules that your program
 doesn't need, but you can edit the bundle file and remove them.
 
 Or maybe you could see if you can get a profiler (like Devel::NYTProf)
 to tell you which modules are loaded when you load and run your module.

Sounds like an early 20th century internal combustion vehicle...  :-)

I never heard of the autobundle command until now, but it does not
sound like it would address all those other modules such as those I
contributed and those that come with Perl installed on system A.

Nor have I heard of Devel::NYTProf (or any other Perl profilers) but
when I skimmed through the Devel::NYTProf POD on CPAN just now, it
looks like Devel::NYTProf is more interested in performance and the
time it takes for statements and/or subroutines to execute.  This is
not quite what I was looking for.

Thanks for the great suggestions.

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: How to suss out module dependencies...

2010-05-27 Thread David McMath
We dealt with a similar problem, moving from comfortable old server to a 
shiny new one.  Perlmonks had some interesting advice:


http://perlmonks.org/?node_id=203148

which I think is pretty cool (even though I only barely understand what 
it's going).


One of our folks ended up, though, using the CPAN::FindDependencies 
module and writing some stuff that walks up through our use statements 
until it finds something that's not ours, then asks CPAN.  You mention 
you're not using the normal CPAN model, but FindDependencies acutally 
goes back to a cpan site to get its answers, so maybe that's OK.


Maybe this is helpful,

dave

William Bulley wrote:

I have a question for which I have not been able to find a good answer.

I have a Perl application that uses many Perl modules.  Most come from
CPAN, some I have written, others come with Perl distributions (core?).

I am faced with the need to transport this collection of Perl code from
operating system A to operating system B, both of which are perfectly
well supported by Perl.  Over several months I have added to system A
lots of modules that need other modules.

Unfortunately, system B is rather devoid of most of the modules that I
need for this application.  I dread having to make an inclusive list of
all the modules and all the modules that those modules need, and so on,
and so on.

This is something that CPAN does when I install a new module that has
dependencies on other modules.  BUT in my case I am NOT using the blib,
lib, t, MANIFEST, etc., etc., distribution model of CPAN, so I cannot
use those tools - including several others on CPAN that compliment or
implement this functionality.

So my question is: is there a way to ask the Perl compiler/interpreter
to spit out all the modules (and the other dependent modules) in my
application in some format (a structured tree, a linear text file, etc.)?

Failing that, are there some external tools that can accomplish this
given my main module as a starting point?  Thank you in advance.

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: How to suss out module dependencies...

2010-05-27 Thread C. Chad Wallace

At 6:09 PM on 27 May 2010, William Bulley wrote:

 According to Hendrik Schumacher h...@activeframe.de on Thu, 05/27/10
 at 17:05:
  
  A crude solution would be to print the contents of %INC somewhere
  in your application:
  
  perl -e 'use DBI; use Time::Local; print join (\n, keys %INC);'
 
 Good suggestion, but won't that list a whole bunch of other stuff
 that is not being used, but that exists in the INC tree somewhere?

Actually, no.  %INC only lists modules that have been loaded into the
current instance, via the 'do', 'require', or 'use' operators.[1]  

The only extraneous stuff it includes is the pragmas (strict, features,
warnings, etc.) but those are easily excluded because of their
all-lowercase names.

Now that Hendrik mentioned it, it seems to me that %INC is probably your
best bet.  But what you would have to be sure of, in the script that
loads your module to dump %INC, is that you also run your module through
its paces to be sure that all dependencies are loaded--even if some are
required instead of used--before you dump %INC.


[1] see the %INC entry in perlvar.

-- 

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0



signature.asc
Description: PGP signature


Re: How to suss out module dependencies...

2010-05-27 Thread William Bulley
According to David McMath mcd...@stanford.edu on Thu, 05/27/10 at 18:27:

 We dealt with a similar problem, moving from comfortable old server to a 
 shiny new one.  Perlmonks had some interesting advice:
 
   http://perlmonks.org/?node_id=203148
 
 which I think is pretty cool (even though I only barely understand what 
 it's going).

I like what I see there, and like you, it will take some meditation
to find out the inner truth normally revealed to true believers...  ;-)

This might actually work!  Thanks.

 One of our folks ended up, though, using the CPAN::FindDependencies 
 module and writing some stuff that walks up through our use statements 
 until it finds something that's not ours, then asks CPAN.  You mention 
 you're not using the normal CPAN model, but FindDependencies acutally 
 goes back to a cpan site to get its answers, so maybe that's OK.

According to the POD for CPAN::FindDependencies there is this:

   Any modules listed as dependencies but which are
   in the perl core distribution for the version of
   perl you specified are suppressed.

So this would disincline me from trying to use CPAN::FindDependencies.

But this gave me an idea!  I looked for dependencies on CPAN and found this:

   
http://search.cpan.org/~jlleroy/Devel-Dependencies-1.00/lib/Devel/Dependencies.pm

This looks promising at first blush...

 Maybe this is helpful,

Thanks again.

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: How to suss out module dependencies...

2010-05-27 Thread William Bulley
According to Bruce Sears bse...@epgy.stanford.edu on Thu, 05/27/10 at 18:41:

 One difference with what I did is that mine determines if the mod is a 
 core mod and does not list it, if so.  I was trying to parse through all 
 of our homegrown packages and see what non-core mods (and versions) they 
 depended on.  didn't spend a lot of time making it prettier, so some 
 calls were system calls to start perl within perl (seems yucky) and 
 parsing STDOUT response, but it seemed to do the job, so it remained 
 ugly...  I agree with Dave about the fact that your setup should not 
 need to be CPAN compliant in order for you to still get the dependeny 
 list you want if you use CPAN::FindDependencies. 

Pardon me for being dense, but when you say what I did and mine
what are you referring to.  That is, which solution or which trick
should I go back and re-consider?  I have seen so many suggestions
in the past half-hour that my head is spinning!  :-)

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|


Re: How to suss out module dependencies...

2010-05-27 Thread William Bulley
According to C. Chad Wallace cwall...@lodgingcompany.com on Thu, 05/27/10 
at 18:41:
 
 Actually, no.  %INC only lists modules that have been loaded into the
 current instance, via the 'do', 'require', or 'use' operators.[1]  

Okay, my ignorance of %INC is showing.  Thanks.

 The only extraneous stuff it includes is the pragmas (strict, features,
 warnings, etc.) but those are easily excluded because of their
 all-lowercase names.

I agree - not a problem., 

 Now that Hendrik mentioned it, it seems to me that %INC is probably your
 best bet.  But what you would have to be sure of, in the script that
 loads your module to dump %INC, is that you also run your module through
 its paces to be sure that all dependencies are loaded--even if some are
 required instead of used--before you dump %INC.
 
 [1] see the %INC entry in perlvar.

I have had to go back to the docs time and again to get the two straight
in my head (USE and REQUIRE) since they evolved over time and I never did
much module or package coding until recently.

What I think you are saying is that once all/most of my code paths are
traversed, then all/most of the associated modules will be part of %INC
for me to try Hendrick's suggestion.  I'd liken it to blowing up a kid's
balloon just to see what is written on the surface of the rubber which
is hard to read with the balloon is deflated.  Of course, unlike here,
one has to be careful not to inflate the balloon too much or bad things
happen...   ;-)

I have several great suggestions now to try.  Thanks!

Regards,

web...

--
William Bulley Email: w...@umich.edu

72 characters width template -|