use strict; use warnings; use DBI; # Credentials my $user = "!NEDVFCollections"; my $password = "XXXXXX"; # Use the password from your DSN config my $url = "jdbc:teradata://172.28.130.20/"; my $dsn = "dbi:JDBC:hostname=localhost;port=12345;url=$url"; # Adjust port to match your Java proxy # JDBC connection properties my $conn_attrs = { 'USER' => $user, 'PASSWORD' => $password, 'LOGMECH' => 'LDAP', 'DBS_PORT' => '1025', 'TMODE' => 'tera' }; # Connect my $dbh = DBI->connect( $dsn, undef, undef, { RaiseError => 1, jdbc_properties => $conn_attrs, } ) or die "Connection failed: $DBI::errstr"; print "Connected to Teradata!\n"; # Example query — update to your actual table/schema my $sql = "SELECT date,user;"; my $sth = $dbh->prepare($sql); $sth->execute(); # Print column names my @columns = @{$sth->{NAME_lc}}; print join(" | ", @columns), "\n"; # Print each row while (my @row = $sth->fetchrow_array) { my @safe_row = map { defined($_) ? $_ : '' } @row; print join(" | ", @safe_row), "\n"; } $sth->finish(); $dbh->disconnect();