Is there a way to check if DB exists using perl ? Its a quick and easy one. but im still getting used to perl and DB
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The DBI module is a popular way access and manipulate databases in perl. Here is a short example of usage of DBI which tests a connection:
The last line could also be something more like:
Or something similar – just edit the first parameter as makes sense.
As you can see – you’ll get unable to connect if the DB can’t be found.
Here is the documentation relevant to DBI:
http://dbi.perl.org/docs/
Sidenote: Also, note you can access sqlplus – or any command line – within a perl script. Just use backticks. It may be worth it to check that way, if you have the tools available on the machine.