LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-23-2008, 02:24 AM   #1
naren_3276
LQ Newbie
 
Registered: Oct 2008
Posts: 1

Rep: Reputation: 0
Connection to DB2 Database through Linux script.


Hi,

Iam using the following Linux version:
OpenSSL 0.9.7d 17 Mar 2004. i am new to linux and i write a sample code.In my system DB2 client was installed in "C:\Program Files\IBM\SQLLIB\BIN\".

#!/bin/bash

./home/db2inst1/sqllib/db2profile
#---+DB2 VARIABLE
USER_NAME=""
USER_PWD=""
DATABASE_NAME=""

function connDB
{
db2 connect to $DATABASE_NAME user $USER_NAME using $USEER_PWD
}
connDB
exit 0

please give valuable suggestions.

Thanks,
Naren
 
Old 10-23-2008, 07:59 AM   #2
gentsch
LQ Newbie
 
Registered: Sep 2004
Location: Georgia
Distribution: RHEL *
Posts: 1

Rep: Reputation: 0
Connection to DB2 on Linux...try Perl

I'll preface this by saying I am an Informix DB bigot, and do not have a LOT of experience with DB2.

Having said that connecting to relational database engines is fairly consistent at a high level.

While it is possible to use shell scripts it may be easier to maintain in the long run to use something like Perl.

You can install the Perl DBI module and the DBD:: DB2 driver and then you use normal connect, prepare, execute, fetch, close logic. IBM and CPAN have this documented fairly well.

Try googling with "Perl DB2 DBI".

IBM Database Magazine also has some articles on Perl and DB2.

I did see a similar question at another forum bytes.com

Good luck!

S

Last edited by gentsch; 10-23-2008 at 09:27 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Database connection using Shell Script sumitarun Linux - Newbie 2 05-09-2010 12:18 PM
Connecting to IBM AS400 db2 database from perl keysorsoze Programming 2 10-12-2008 11:01 AM
Database on Linux...connection refused zen Red Hat 1 02-04-2007 04:35 AM
LXer: DB2 Express: Another nail in the free database coffin? LXer Syndicated Linux News 0 02-10-2006 09:46 PM
LXer: DB2- the secret database LXer Syndicated Linux News 0 01-18-2006 09:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration