DBD-DB2

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


## Testing Your Installation

> Set `DB2_USER` and `DB2_PASSWD` as environment variables. Configuration can also be provided in `tests/connection.pl`.

### With Connection Configuration:

1. **Edit `tests/connection.pl`:**
   ```perl
   $USERID="your_db2_username";
   $PASSWORD="your_db2_password";
   $PORT=50000;
   $HOSTNAME="your_db_server";
   $DATABASE="your_database_name";
   $PROTOCOL="TCPIP";
   ```

2. **Run test suite:**
   ```bash
   perl run-tests.pl
   ```

### Quick Manual Test:

Create `test_db2.pl`:
```perl
#!/usr/bin/perl
use strict;
use warnings;
use DBI;

my $dbh = DBI->connect('dbi:DB2:database=SAMPLE', 'userid', 'password')
    or die "Connection failed: $DBI::errstr";

print "Connected successfully!\n";

my $sth = $dbh->prepare("SELECT * FROM SYSCAT.TABLES FETCH FIRST 5 ROWS ONLY");
$sth->execute() or die "Query failed: $DBI::errstr";

while (my $row = $sth->fetchrow_hashref()) {
    print "Table: ", $row->{TABNAME}, "\n";
}

$sth->finish();
$dbh->disconnect();
```

Run with:
```bash
perl test_db2.pl
```

## Troubleshooting

| Issue | Solution |
|-------|----------|
| "Can't find module DBD::DB2" | Ensure DBI is installed first: `cpanm install DBI` |
| "DB2_HOME not set" | Set environment variable pointing to DB2 CLI driver installation |
| Compilation errors with sqlext.h | Use pre-compiled Windows binaries instead of building from source |
| Permission denied during install | Run with `sudo` or use `PREFIX=~/lib/perl5` for user-level installation |
| Test connection fails | Verify credentials in `tests/connection.pl` and ensure DB2 server is running |

#### For More Information:

- **CAVEATS** - Platform-specific solutions and workarounds
- **TESTING_GUIDE.md** - Comprehensive testing procedures
- **TEST_GAP_ANALYSIS.md** - Test coverage details

## Support & Resources

### IBM Support
- **Technical Support:** IBM DB2 service agreements
- **DB2 Documentation:** [IBM DB2 Info Center](http://publib.boulder.ibm.com/infocenter/db2help/index.jsp)
- **DB2 Perl Resources:** [IBM DB2 Perl Page](http://www.software.ibm.com/data/db2/perl)

### Community - DBI Mailing Lists

| List | Purpose |
|------|---------|
| dbi-announce@perl.org | Announcements |
| dbi-dev@perl.org | Developer discussions |
| dbi-users@perl.org | User help & questions |

**Subscribe:** Send email to `<listname>-subscribe@perl.org` or visit [lists.perl.org](http://lists.perl.org/)

### GitHub Repository
- **Project:** [GitHub: perl_DBD-DB2](https://github.com/ibmdb/perl_DBD-DB2)
- **Report Issues:** Use GitHub Issues feature

## Documentation

| File | Content |
|------|---------|
| CAVEATS | Important platform-specific information and workarounds |
| DB2.pod | Example Perl scripts for using DBD::DB2 |

## License

DBD::DB2 is licensed under the [Apache License 2.0](LICENSE). Third-party components
retain their respective licenses, and Db2 client libraries are subject to their
own license terms.

---

**Last Updated:** February 2026

For latest information, visit: [GitHub Repository](https://github.com/ibmdb/perl_DBD-DB2)



( run in 0.570 second using v1.01-cache-2.11-cpan-3f962061493 )