Ibm Data Server DB2 Bedienungsanleitung Seite 279

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 298
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 278
Appendix A. Sample applications 265
# Creating dsn from command line arguments.
dsn = "HOSTNAME=" + argv[0] + \
";PORT=" + argv[1] + \
";DATABASE=" + argv[2] + \
";PROTOCOL=TCPIP" + \
";UID=" + argv[3] + \
";PWD=" + argv[4]
print "Trying to establish connection..."
conn = ibm_db.connect( dsn, "", "" )
print "Is connection active? : ", ibm_db.active(conn)
print "Closing connection..."
ibm_db.close(conn)
print "Connection closed."
if __name__ == "__main__":
main(sys.argv[1:])
A.5 Perl
Example A-5 shows the application used to demonstrate the deployment of the
DB2 Perl application.
Example: A-5 Sample Perl application
# A sample perl application.
# Use this program to test connection to a database.
# Database connectivity information is read as command line arguments.
# Give arguments in the following order:
# hostname port_number database_name user password
#
# Run the application as following:
# perl itso_perlapp.pl hostname port_number database_name user password
#
use DBI;
# Varifying the number of command line arguments.
if ($#ARGV != 4){
print " ERROR: incorrect command line arguments.\n Use hostname port_number
database_name user_name password\n";
exit 1;
}
Seitenansicht 278
1 2 ... 274 275 276 277 278 279 280 281 282 283 284 ... 297 298

Kommentare zu diesen Handbüchern

Keine Kommentare