RE: Script to test connecting to Oracle DBs

2012-08-01 Thread Martin Gainty

#!/bin/sh
C:/grep/grep.exe -S (SERVICE_NAME = tnsnames.ora  service.ora
rm -r new.ora
echo #!/bin/sh  tns_ping.sh
C:/cygwin/bin/sed.exe 's/(SERVICE_NAME \=/tnsping.exe /' 
service.oratns_ping.sh
vi tns_ping.sh

If you find There is a way to pipe the 2 commands let me know but for now this 
little shell script works  

Martin
___ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und 
Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.


 Date: Sat, 28 Jul 2012 13:45:18 +1200
 Subject: Script to test connecting to Oracle DBs
 From: newbie01.p...@gmail.com
 To: beginners@perl.org; dbi-us...@perl.org
 
 Hi all,
 
 I am looking for a Perl script or something similar that I can use to test
 connection from a client PC to several databases on a server.
 
 Does anyone know of any such script lying around somewhere :(-
 
 Currently, am testing connection from a client PC to an Oracle DB using
 Oracle's sqlplus. All is well and good until I have to test connection to
 multiple databases on the server.
 
 So I am hoping to use a Perl script that I can use which will parse some
 sort of config file that contains hostname.tns_alias combination and then
 test connection to the Oracle DB and run a simple SQL like SELECT COUNT(1)
 from USER_TABLES, if I get an error, that means there is an issue
 connection to that database, otherwise all is good.
 
 At the moment, easiest I can think of using Perl's system command to run
 sqlplus. Or is it better to look at using DBI? Would be very much
 appreciated if someone can provide me a simple DBI script to start with if
 that is the best approach to use.
 
 Any suggestion/advice much appreciated. Thanks in advance.
  

Re: Script to test connecting to Oracle DBs

2012-08-01 Thread Leo Susanto
use strict;
use DBI;
use DBD::Oracle qw(:ora_types);

my $user   = '';
my $passwd = '';
my $tnsName = '';

$ENV{'ORACLE_HOME'} = 'C:\oracle\product\10.2.0\client_1';
my $dbh = DBI-connect(dbi:Oracle:$tnsName, $user, $passwd);
my $SQL = qq{ SELECT XXX};

my $sth0 = $dbh-prepare($SQL);
print SQL is prepared;\n;
$sth0-execute();
print SQL is executed;\n;
$sth0-finish();


On Fri, Jul 27, 2012 at 6:45 PM, newbie01 perl newbie01.p...@gmail.com wrote:
 Hi all,

 I am looking for a Perl script or something similar that I can use to test
 connection from a client PC to several databases on a server.

 Does anyone know of any such script lying around somewhere :(-

 Currently, am testing connection from a client PC to an Oracle DB using
 Oracle's sqlplus. All is well and good until I have to test connection to
 multiple databases on the server.

 So I am hoping to use a Perl script that I can use which will parse some
 sort of config file that contains hostname.tns_alias combination and then
 test connection to the Oracle DB and run a simple SQL like SELECT COUNT(1)
 from USER_TABLES, if I get an error, that means there is an issue
 connection to that database, otherwise all is good.

 At the moment, easiest I can think of using Perl's system command to run
 sqlplus. Or is it better to look at using DBI? Would be very much
 appreciated if someone can provide me a simple DBI script to start with if
 that is the best approach to use.

 Any suggestion/advice much appreciated. Thanks in advance.

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




Script to test connecting to Oracle DBs

2012-07-27 Thread newbie01 perl
Hi all,

I am looking for a Perl script or something similar that I can use to test
connection from a client PC to several databases on a server.

Does anyone know of any such script lying around somewhere :(-

Currently, am testing connection from a client PC to an Oracle DB using
Oracle's sqlplus. All is well and good until I have to test connection to
multiple databases on the server.

So I am hoping to use a Perl script that I can use which will parse some
sort of config file that contains hostname.tns_alias combination and then
test connection to the Oracle DB and run a simple SQL like SELECT COUNT(1)
from USER_TABLES, if I get an error, that means there is an issue
connection to that database, otherwise all is good.

At the moment, easiest I can think of using Perl's system command to run
sqlplus. Or is it better to look at using DBI? Would be very much
appreciated if someone can provide me a simple DBI script to start with if
that is the best approach to use.

Any suggestion/advice much appreciated. Thanks in advance.


Re: Script to test connecting to Oracle DBs

2012-07-27 Thread Rob Dixon
On 28/07/2012 02:45, newbie01 perl wrote:
 Hi all,
 
 I am looking for a Perl script or something similar that I can use to test
 connection from a client PC to several databases on a server.
 
 Does anyone know of any such script lying around somewhere :(-
 
 Currently, am testing connection from a client PC to an Oracle DB using
 Oracle's sqlplus. All is well and good until I have to test connection to
 multiple databases on the server.
 
 So I am hoping to use a Perl script that I can use which will parse some
 sort of config file that contains hostname.tns_alias combination and then
 test connection to the Oracle DB and run a simple SQL like SELECT COUNT(1)
 from USER_TABLES, if I get an error, that means there is an issue
 connection to that database, otherwise all is good.
 
 At the moment, easiest I can think of using Perl's system command to run
 sqlplus. Or is it better to look at using DBI? Would be very much
 appreciated if someone can provide me a simple DBI script to start with if
 that is the best approach to use.
 
 Any suggestion/advice much appreciated. Thanks in advance.

I'm not clear why sqlplus won't let you connect to multiple databases,
assuming you don't want to connect to them all /simultaneously/?

I would say you were better off using the DBI module, and you will also
need the SBS::Oracle driver module. The documentation

http://metacpan.org/module/DBI
http://metacpan.org/module/DBD::Oracle

is very extensive, but the basic idea looks like the program below.

I hope this helps.

Rob


use strict;
use warnings;

use DBI;

autoflush STDOUT;

my ($user, $pass) = qw/ username  password /;

my @databases = qw/ db1 db2 db3 db4 /;

for my $dbname (@databases) {

  print Database: $dbname\n;

  my $dbh = DBI-connect(dbi:Oracle:$dbname, $user, $pass,
  { PrintError = 1, PrintWarn = 1 } );
  
  next unless $dbh;

  my ($count) = $dbh-selectrow_array('SELECT COUNT(*) FROM user_tables');
  print Database $dbname: Count: $count\n;
}

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




Re: connecting to Oracle

2007-08-24 Thread rahed
[EMAIL PROTECTED] (Octavian Rasnita) writes:

 Hi,

 I want to make a program that connects to a remote Oracle database and
 then make it a .exe Windows executable.

 Is it possible to make it not depend on Oracle's client?

Install Oracle Instant Client, build DBD::Oracle and then try
which libraries are necessary to include in your exe program via pp
(Perl Packager).

-- 
Radek

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




connecting to Oracle

2007-08-22 Thread Octavian Rasnita

Hi,

I want to make a program that connects to a remote Oracle database and then 
make it a .exe Windows executable.


Is it possible to make it not depend on Oracle's client?

Thanks.

Octavian


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: connecting to Oracle

2007-08-22 Thread Chas Owens
On 8/22/07, Octavian Rasnita [EMAIL PROTECTED] wrote:
 Hi,

 I want to make a program that connects to a remote Oracle database and then
 make it a .exe Windows executable.

 Is it possible to make it not depend on Oracle's client?

 Thanks.

 Octavian

Yes, but it would be a lot of work, slow, buggy, and a complete waste
of your time.  It is better to either distribute the Oracle client
libraries or require that your users have them.  As for packaging up
all of your code into one file see PAR* and PAR::Packer**.  You should
be able to include the Oracle client libraries inside the file
PAR::Packer creates.  You should also look at the DBI*** and
DBD::Oracle if you haven't already.

* http://par.perl.org/wiki/Main_Page
** http://search.cpan.org/~smueller/PAR-Packer-0.976/lib/PAR/Packer.pm
*** http://search.cpan.org/~timb/DBI-1.58/DBI.pm
 http://search.cpan.org/~pythian/DBD-Oracle-1.19/Oracle.pm

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Perl connecting to Oracle and SQL Server databases ...

2006-12-17 Thread Benbart

Hi all,

Does anyone know of any resource that I can go to for example on 
connecting to Oracle and Microsoft SQL Server databases using Perl 
??? I need more than connecting to the database, some example on how 
to do SELECT, INSERT, UPDATE and DELETE will be very helpful as well.


Thanks in advance ...





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Perl connecting to Oracle and SQL Server databases ...

2006-12-17 Thread Jeff Pang
Download the codes of Perl for System Administration and look at No. 7 
charter,you may find what you needed.
See:   http://examples.oreilly.com/perlsysadm/

Good luck!

-Original Message-
From: Benbart [EMAIL PROTECTED]
Sent: Dec 17, 2006 4:31 AM
To: beginners@perl.org
Subject: Perl connecting to Oracle and SQL Server databases ...

Hi all,

Does anyone know of any resource that I can go to for example on 
connecting to Oracle and Microsoft SQL Server databases using Perl 
??? I need more than connecting to the database, some example on how 
to do SELECT, INSERT, UPDATE and DELETE will be very helpful as well.

Thanks in advance ...





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




--
Books below translated by me to Chinese.
Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Perl connecting to Oracle and SQL Server databases ...

2006-12-17 Thread Tony Heal
I did a simple google search for 'using perl with oracle' and came up with
these

http://www.cs.purdue.edu/homes/cs290w/perlLecs/PerlOracleExample.html

I did not look to far into this but it looks promising

http://vsbabu.org/mt/archives/2002/09/05/perl_for_oracle.html


MS SQL was a little harder search but I did find this

The search was 'Using Perl DBI to interface to MS SQL'

http://www.easysoft.com/developer/languages/perl/sql_server_unix_tutorial.ht
ml

Tony




-Original Message-
From: Benbart [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 17, 2006 4:32 AM
To: beginners@perl.org
Subject: Perl connecting to Oracle and SQL Server databases ...

Hi all,

Does anyone know of any resource that I can go to for example on 
connecting to Oracle and Microsoft SQL Server databases using Perl 
??? I need more than connecting to the database, some example on how 
to do SELECT, INSERT, UPDATE and DELETE will be very helpful as well.

Thanks in advance ...





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Connecting to Oracle

2006-08-23 Thread Xavier Noria

On Aug 23, 2006, at 7:52 AM, anand kumar wrote:

  Can anyone please explain how to connect to oracle database  
server using perl script which is in separate linux server. Please  
note that currently I am using putty to connect to linux server for  
perl scripting and we have the Oracle database on a windows server.  
I have tried using the DBD::Oracle module from cpan.org but i could  
not install the module because the oracle drivers are accessible to  
Perl on the Linux server.


AFAIK you need to install the Oracle client in the local machine.

-- fxn




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Connecting to Oracle

2006-08-22 Thread anand kumar
Hi all
   
  Can anyone please explain how to connect to oracle database server using perl 
script which is in separate linux server. Please note that currently I am using 
putty to connect to linux server for perl scripting and we have the Oracle 
database on a windows server. I have tried using the DBD::Oracle module from 
cpan.org but i could not install the module because the oracle drivers are 
accessible to Perl on the Linux server.
   
  In this regard please suggest any solution or any documentation
   
  Regards
Anand Kumar


-
 Here's a new way to find what you're looking for - Yahoo! Answers 
 Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it 
NOW

Connecting to Oracle over network

2004-05-24 Thread jason corbett
Hello. I am using Windows 2000 to connect to an Oracle database over the company 
network. I have the DBI/DBD drivers installed on my computer. I want to connect using 
the script below. When i run the script, it doesn't come back with anything. It just 
goes to the command prompt. Can someone tell me how to do this, and what env variables 
need to be set and where? I am not using any proxies btw.
 
Regards,
JC
 
#!perl -w
use strict; 
use DBI; 
#  $ENV{ORACLE_HOME}=what goes here??; 
my $dbh = DBI-connect('DBI:Oracle:','[EMAIL PROTECTED]','passwd' 
 ) or die Can't connect to Oracle database: \n $DBI::errstr\n; 
my $msg = 
  $dbh-selectrow_array( 
 SELECT SYSDATE || ' Hello Cygwin DBI! :-)' message FROM DUAL 
   ); 
# Let's have some formatting fun! :-) 
my $msg_len = length( $msg ); 
my $underline = '=' x ($msg_len + 6); 
print \n, $underline, \n, 
|| , ' ' x $msg_len,  ||, \n, 
|| , $msg,  ||, \n, 
|| , ' ' x $msg_len,  ||, \n, 
$underline, \n\n; 
$dbh-disconnect;



-
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year

Re: connecting to oracle

2002-10-11 Thread Peter Scott

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Charles Belcher) writes:
is there an alternative to using DBI and DBD::Oracle to connect to an Oracle
database to run a simple select statement?

You could run sqlplus from Perl like any other program.

I would find it simpler to use DBI and DBD::Oracle to run the simple select
statement, even if I had to install the modules first.  Unless they just
didn't build on my system for some reason.

-- 
Peter Scott
http://www.perldebugged.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]