HowTo: Perl


Prerequisites


All the files required to run the examples are contained in the directory demo/FirstSteps/Perl.


Accessing SQL using the SAP::DBTech::sapdb module

Hello, SAP DB
HelloSAPDB.pl shows
  • how to connect to the database
  • how to execute SQL
  • how to fetch results
  • execute it as
    perl HelloSAPDB.pl <sqluser> <password> <dbname> <host>
    The command line arguments are optional, the defaults will access the installed demo database


Accessing SQL using DBI

These exmaples require DBI to be installed. The file /usr/sapdb/misc/SAP_DB.pm must be copied into the DBD directory of the Perl installation.
Hello, DBI @ SAP DB
HelloDbiAtSAPDB.pl shows
  • how to connect to the database
  • how to execute SQL
  • how to fetch results
  • execute it as
    perl HelloDbiAtSAPDB.pl <sqluser> <password> <dbname> <host>
    The command line arguments are optional, the defaults will access the installed demo database


Accessing the DB Manager using the SAP::DBTech::dbm module

Database state
StateSAPDB.pl shows
  • how to connect to the Database Manager
  • how to execute simple commands using the dbmcli syntax
  • how to parse results
  • execute it as
    Perl StateSAPDB.py <dbmuser> <password> <dbname> <host>
    The command line arguments are optional, the defaults will access the installed demo database