Home
TeamSite
db2 connection
agammehta
Hi,
I've teamsite 6.5 runing. I'm trying to connect my DCT to DB2 but am unsuccessful. I search forum and couldn't find how would I install DBD:
B2 module on teamsite.
Thanks,
Find more posts tagged with
Comments
jbonifaci
How are you trying to connect? An inline? A callServer? a cgicallout? DataDeploy?
Installing the module really has nothing to do with TeamSite. It should be as straight forward as installing any other perl module.
~Jeff
agammehta
It's an inline.
This is what I'm trying to do
----------------------------------------
use DBI;
use DBD:
B2;
use DBD:
B2::Constants;
$dsn = 'dbi
B2:db_name';
$uid = '';
$pwd = '';
%conattr =
(
AutoCommit => 1, # Turn Autocommit On
db2_info_applname => 'Maps Module', # Identify this appl
);
# Connect to our database
$dbh = DBI->connect( $dsn, $uid, $pwd, \%conattr ) || die "$DBI::errstr";
-------------------------------------------------------------------------------------------------
I'm trying to connect to DB2 database.
But doesn't look like it is connecting.
Thanks,
iwovGraduate
Assuming the DBD:
B2 modules are installed and is working properly, it might have to do with some required env variables which may not be defined when you run the script as inline. Try running it from commandline/shell, see if it works or gives any errors?
agammehta
It doesn't seem to be working. I went to command/shell it gave me unrecognized internal or external command. I don't think DBD:
B2 module is installed. Any idea how to install it ?
iwovGraduate
Search for it on cpan.org.
You on Windows or Solaris?
or Linux?
agammehta
I'm on windows.
-------------------------------------
1.3) Install the DBI module
Make sure the Perl where you want to install DBI is in the path. The
'which perl' command should return this 64-bit Perl.
If you do not have the latest DBI module, you can download the module
by clicking on the Download link at
http://search.cpan.org/~timb/DBI/
.
The latest version at the time of this writing is DBI-1.43.
Once you have downloaded DBI-1.43.tar.gz, you can install it via the
following commands:
gzip -d DBI-1.43.tar.gz
tar -xf DBI-1.43.tar
cd DBI-1.43
perl Makefile.PL
make
make test
make install
--------------------------------------------
Tried this but this gives me error.
iwovGraduate
"unrecognized internal or external command" does not seem like a perl error for a missing module. Its looks like a Windows error you get when you try to execute a command which does not exist.
Are you invoking any command from your perl script? (back-tick perhaps?)
agammehta
No I'm not .. This is the only thing I' m trying to connect to is DB2.. that's all..
iwovGraduate
In that case you should get an error something like -
Can't locate DBD/DB2.pm in
@INC
(
@INC
contains:......
Since you are getting the unrecognized internal or external command it seems like something else is worng with your script. You might want to try fixing that first.
iwovGraduate
First, I think DBI should already be installed.
Second, what is the error? (My crystal ball is not working today!)
Instlling Perl DB modules on Windows can get very tricky. Search the forums for it and you will find a lot of posts. You'll have to find the right version of DBD:
B2 for your perl version, DBI version, OS, etc. Also you'll need to compile it, so you will need the make tools.
Hope that helps
agammehta
Yes you are right It gives me "Can't locate DBD/DB2/Constants.pm in
@INC"
when i use Constants.
jbonifaci
What happens when you compile the perl script with iwperl? What happens when you run it? Copy and paste the exact error message(s) you are getting.
iwovGraduate
It does not look like you are using anything from Constants.pm. If so, just comment it out.
agammehta
Reason it gave me errors that's the reason I had to comment out my code where it used Constants.
I really appreciate you all helping me..
agammehta
How do i find what version of DBD Module is my teamsite runing ?
Adam Stoller
Try something like this:
iwperl -MDBD:
B2 -le 'print $DBD:
B2::VERSION;'
(note: if you're on Windows - I believe you need to use double-quotes ("..") instead of single-quotes ('...') which work on Unix)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
agammehta
Fish thanks for your answer. But unfortunately i can't run this command. I'm on windows. I went to teamsite server and try runing this command in command prompt it gave me error "cannot recognize this command".
agammehta
Discard my previous post. When I ran iwperl i got this error
Can't locate DBD/DB2.pm in
@INC
(
@INC
contains: E:/iw-home/iw-perl/lib E:/iw-home/iw-perl/site/lib E:\iw-home\iw-perl\vendor\lib .).
BEGIN failed--compilation aborted
I think DBD is not installed on teamsite. How would I go and install this module ?
Adam Stoller
If your TeamSite server has access to the internet - and you have compilation tools on there (like MSSDK) - run 'cpan' from the IWHOME/iw-perl/bin directory and type:
install DBD:
B2
Note - if this is the first time running it - you will have to go through a lot of prompts while it tried to figure out your configuration information.
If you don't have access to the internet from your TeamSite server - you'll have to download the stuff from cpan.org yourself and then bring it over to your TS server - you'll still need the compilation tools.
Also - I'm not sure about DB2 - but for Oracle, one needs to have the client software installed on the server where you will be using the DBD - and sometimes you need some additional libraries and/or header files from the server-side installation - you'll need to read the documentation that comes with DBD:
B2 very carefully.
It's not usually fun or trivial - but it can be done.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
briggek8717
I believe Ghoti is right in that you need some part of the DB2 Client installed on the server or you won't have the driver to connect to the DB2 database.