By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,104 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

how to connect to db2 using shell script commands

P: 1
Hi,

I'm trying to retrieve a record from DB2 without using DBI package like this.
Expand|Select|Wrap|Line Numbers
  1. system("db2 select \* from customer where cname=\'steve\' ");
  2.  
but it fails everytime with the error. this only happens when using a ' in the condition (such as 'steve' in this example). Using a number works fine.

Any ideas on how to resolve this is appreciated.
Nov 30 '09 #1
Share this Question
Share on Google+
1 Reply


numberwhun
Expert Mod 2.5K+
P: 3,503
There is no reason to be issueing system() commands in order to access information in a database using Perl.

You should really be using the DBI module with the DBD::DB2 driver to connect and get whatever information you need to. It is MUCH more efficient than the way you are trying to do it.

There are plenty of DBI tutorials out there for you to read and learn from.

Regards,

Jeff
Nov 30 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.