- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Looking for some basic cgi scripts for mysql n...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2004 12:29 PM
12-25-2004 12:29 PM
I have actually managed to pull some sql off a google search and created the database on the sql database (4.0.x from software.hp.com).
I have the CGI module installed. I need a couple of simple perl scripts that I can modify for my own purposes to perform the following functions:
1) Add a record to the database.
2) remove a record from the database.
3) pull data out of the database (which I will display for my users to edit).
I seem to be finding complex examples and I need something basic so I can program and learn.
Critera: I will take your script and test it. If I can make it perform its function without major modification its a bunny.
I've also been seeing some strange behavior when I put my cqi scripts on my play hp9000 box. Normal perl statements do not work. I think the perl I'm pointing to is very old and needs an upgrade. Here is the ouptut from the perl -v statement.
--------
[8206#] /usr/local/bin/perl5 -v
This is perl, v5.8.3 built for PA-RISC2.0
Copyright 1987-2003, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
[8207#] swlist -l product | grep -i perl
PHKL_26104 1.0 VX_FREEZE timeout does not work properly
Perl5 D.5.8.0.C Perl for HP-UX
perl 5.8.3 perl
perl2html 0.8 perl2html
---------------
It sure seems like I'm pointing at relatively recent binaries.
If thats true, I'd like an explanation as to why this code works on Linux and not HP-UX back end websites.
-----begin sample code--------
# unless (open(INFILE, "/home/webusers/tehillimsongs/data/text")) {
# die (print "cannot open input file text\n");
# }
ll /home/webusers/tehillimsongs/data/text
-r-xr-xr-x 1 root web 677 Nov 16 21:32 /home/webusers/tehillimsongs/data/text
----
The above code works great on Linux and will not work on hpux.
A bunny for the explanation on that one.
Before anyone recommends it, I'm going to check software.hp.com for a current verson of perl and get it installed and re-test the script. No bunny for that suggestion, I just had that idea.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2004 12:33 PM
12-25-2004 12:33 PM
Re: Looking for some basic cgi scripts for mysql needed
software.hp.com's latest perl release for pa-risc is:
HP-UX 11i PA-RISC version 5.8.2
So how the heck did 5.8.3 get on my system? Obviously I installed it.
I DID NOT install anything from Merijn's website.
Is 5.8.3 stable?
I truly am at a loss as to what to do now.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2004 01:19 PM
12-25-2004 01:19 PM
Re: Looking for some basic cgi scripts for mysql needed
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2005 08:37 PM
01-02-2005 08:37 PM
Solution- The MySQL stuff I used on HP-UX is too old to serve as reference, but I did not hit any trouble by then
- I never used CGI, on any platfor, yet
--8<---
my $txtfile = "/home/webusers/tehillimsongs/data/text";
-f $txtfile && -s _ && open my $fh, "< $txtfile" or die "invalid text file '$txtfile': $!\n";
whil;e (<$fh>) {
chomp;
# ...
}
-->8---
--8<---
use strict;
use warnings;
use DBI;
# Connect to MySQL database
my %attr = (
RaiseError => 1,
PrintError => 1,
ChopBlanks => 1,
ShowErrorStatement => 1,
);
my $db = exists $ENV{MYSQLDB} ? $ENV{MYSQLDB} : "test";
$dbh = DBI->connect ("DBI:mysql:database=$db", $ENV{LOGNAME}, undef, \%attr) or croak "connect: $!";
# Select from database
my ($code, $desc);
my $sth = $dbh->prepare ("select code, description from table where code > ?");
$sth->bind_columns (\$code, \$desc);
$sth->execute (4);
while ($sth->fetch) {
printf "%6d %s\n", $code, $desc;
}
# Update the database
my $upd = $dbh->prepare ("update table set description = ? where code = ?");
$upd->execute ("Foo", 4);
$dbh->commit;
# insert into the database
my $ins = $dbh->prepare ("insert into table values (?, ?)";
$ins->execute (4, "Foo");
$ins->commit;
# delete from database
my $del = $dbh->prepare ("delete table where code = ?");
$del->execute (4);
$dbh->commit;
$sth->finish;
$upd->finish;
$del->finish;
$ins->finish;
$dbh->disconnect;
-->8---
Enjoy, Have FUN! (And a prosperous 2005) H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2005 05:28 AM
01-03-2005 05:28 AM
Re: Looking for some basic cgi scripts for mysql needed
I will give this stuff a try in my test environment.
Hopefully I can integrate my perl based mail scripts with a database write to save the information. Once I get started I should be fine.
There are bunnies to be had with more working code.
Start off 2005 with a SEP awarded bunny.
:-)... Yeah team.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com