TeamSite 6.5 SP1
Windows 2003
As a preliminary test, I'm trying to populate a select list with information pulled from a Sybase database via an inline perl command. I've verified via the command line that the perl command will connect and execute the query properly when it is stand-alone. However, when I call the script from my DCT, I receive an error message that my DBI->connect call did not work. Below I have posted the portion of the DCT which makes the inline call and the corresponding .ipl script. Thanks in advance for any thoughts on this.
-Derek
Sorry if the formatting is off...
// Item within DCT
<item name="DBI Select" pathid="dbi_select">
<label>DBI Select</label>
<select required="f">
<inline command="d:\Interwoven\TeamSite\iw-perl\bin\iwperl.exe d:\Interwoven\TeamSite\local\bin\test_dbi.ipl" />
</select>
</item>
// test_dbi.ipl file
#!D:\Interwoven\TeamSite\iw-perl\bin\iwperl.exe
use strict;
use DBI;
use Log::Log4perl;
my $query; # DB select statement to association table
my $name; # the product name selected from the table
my
@row; # the array that contains the values
my
@row1; # the array that contains the column key (ISBN)
my
@row2; # the array that contains the column value (name)
my $dsn; # the data source
my $db_user_name; # the database username
my $db_password; # the database password
my $table_name; # the table name
my $column_value; # the column value (name)
$dsn = "stage3_bt";
$db_user_name ="user_name";
$db_password="user_pw";
$table_name="table_name";
$column_value="column_value";
# Initialize the log module
Log::Log4perl->init("d:/Interwoven/TeamSite/local/bin/log4j_wrapper.conf");
my $logger = Log::Log4perl->get_logger();
print "<substitution>";
# Connect to the database
$logger->info("Connecting to database...");
unless (my $dbh = DBI->connect("dbi

DBC:$dsn", "$db_user_name", "$db_password"))
{
$logger->info("Unable to connect to DB");
my $errorMessage = "Unable to connect to DB.";
print " <option selected='t' value='' label='$errorMessage'/>";
}
else
{
# OK, connected
$query = "SELECT ".$column_value." FROM ".$table_name;
# Prepare and execute the statement
$logger->info("Preparing query...");
unless (my $sth = $dbh->prepare("$query"))
{
$logger->info("Unable to prepare query");
my $errorMessage = "Unable to prepare query";
print " <option selected='t' value='' label='$errorMessage'/>";
}
else
{
$logger->info("Query prepared: ", $query);
$logger->info("Executing query...");
unless ($sth->execute())
{
$logger->info("Unable to execute query");
my $errorMessage = "Unable to execute query";
print " <option selected='t' value='' label='$errorMessage'/>";
}
else
{
while (my ($name, $id) = $sth->fetchrow_array())
{
print " <option selected='f' value='$name' label='$id'/>";
}
}
}
# disconnect database
$dbh->disconnect || die "Error Closing the Database\n";
}
print "</substitution>";