Sorry, I don't know anything about PHP except that is supposed to be
somewhat Java-like. My main language these days is Java but I don't know PHP
at all.

For what it's worth, I checked my V7.2 DB2 manuals just now to see if PHP is
mentioned in the Application Development Guide. I found chapters on COBOL, C
and C++, Perl, Fortran, Java, and REXX but nothing on PHP.

I also checked the V8.1 DB2 manuals for Windows/Linux platforms and found
very little *except* for this little nugget, which is probably exactly what
you want:

a.. PHP. PHP can be used as a method to access DB2 from web-based
applications. PHP is a server-side, HTML-embedded, cross-platform scripting
language. It supports DB2 access using the Unified-ODBC access method, in
which the user-level PHP communicates to DB2 using ODBC calls. Unlike
standard ODBC, with the Unified-ODBC method, communication is directly to
the DB2 CLI layer, not through the ODBC layer. For more information about
using PHP with DB2, search the DB2 support site:
   www.ibm.com/software/data/db2/udb/winos2unix/support
I followed the suggested link and did a search with the search term:
PHP && DB2

There were many hits but the most useful looking one was this:
http://www-106.ibm.com/developerworks/db2/library/techarticle/scott/0614_scott.html

The other good place to ask DB2 questions is the Usenet newsgroup
comp.databases.ibm-db2. The Toronto Lab, which develops DB2 for the Wintel
platforms monitors this newsgroup and often answers questions there.

Good luck!

Rhino

----- Original Message ----- 
From: "James Marcinek" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 04, 2004 9:32 AM
Subject: Re: Scripting


> Rhino,
>
> I know this is an off topic; however I see that you have DB2 experience.
> Most of the information I have a question you might be able to answer. Are
> you using PHP with MySQL? If so, have you tried to use PHP with DB2? I'd
> like to know what functions you call to connect or anything that could
> help?  I'm new to the MySQL arena as well.
>
> Thanks,
>
> James
>
> > Todd,
> >
> > I'm also pretty new to MySQL and Linux but I have years of DB2
experience
> > on
> > various platforms.
> >
> > I've bash scripts very useful and cron them when I have something that I
> > want to automate, such as a daily backup of my databases. Here are some
> > examples of bash scripts that I use with MySQL.
> >
> > This example, which is in file RI.sql, creates two related tables in the
> > MySQL 'tmp' database, populates them, and displays the results. NOTE:
The
> > 'Another Mistake' row will not be successfully inserted into the 'emp'
> > table
> > because it has an invalid foreign key; there is no row for dept 'X99' in
> > the
> > 'dept' table.
> >
> > ---
> >
> > use tmp;
> >
> > drop table if exists dept;
> > create table dept(
> > deptno char(3) not null,
> > deptname varchar(36) not null,
> > mgrno char(6),
> > primary key(deptno)
> > ) Type=InnoDB;
> >
> > drop table if exists emp;
> > create table emp(
> > empno char(6) not null,
> > firstnme char(12) not null,
> > midinit char(1),
> > lastname char(15) not null,
> > workdept char(3) not null,
> > salary dec(9,2) not null,
> > primary key(empno),
> > index(workdept),
> > foreign key(workdept) references dept(deptno) on delete restrict
> > ) Type=InnoDB;
> >
> > insert into dept values
> > ('A00', 'Administration', '000010'),
> > ('D11', 'Manufacturing', '000020'),
> > ('E21', 'Education', '000030');
> >
> > insert into emp values ('000010', 'Christine', 'I',
> > 'Haas','A00',50000.00);
> > insert into emp values ('000020', 'George', 'W', 'Bush', 'D11',
30000.00);
> > insert into emp values ('000030', 'Another', ' ', 'Mistake', 'X99',
> > 15000.00);
> > insert into emp values ('000040', 'John', ' ', 'Kerry', 'E21',
35000.00);
> >
> > select * from dept;
> >
> > select * from emp;
> >
> > ---
> >
> > You can run the preceding script from the mysql prompt by preceding its
> > name
> > with '\.'. For example:
> >
> > mysql> \. RI.sql
> >
> >
> > This script, called backup2.bash, is what I use to back up my databases
> > each
> > night. It includes a comment showing the crontab entry I use to run it.
> > NOTE: We are using a Perl package called 'sendEmai'l instead of the
> > traditional 'sendmail' program.
> >
> > ---
> > #!/bin/bash
> >
> > #This script makes a separate database-level backup of each of the
current
> > MySQL databases and
> > #deletes backups older than a certain number of days.
> > #This script is normally invoked via a cron job so that it runs once per
> > day
> > in the middle of the night.
> > #The crontab entry looks like this:
> > #0 3 * * * sh /home/rhino/MySQL/backup2.bash >
> > /home/rhino/MySQL/backup2.out
> > 2>&1; cat /home/rhino/MySQL/backup2.out | sendEmail -f
[EMAIL PROTECTED] -t
> > [EMAIL PROTECTED] -u "Daily Backup Report"
> >
> > USERID="foo"; #The userid to use for creating the backup
> > PASSWORD="foopass"; #The password to use for creating the backup
> > BACKUP_TIMESTAMP=`/bin/date +%Y%m%d"-"%H%M%S`; #The timestamp
> > (YYYYMMDD-HHMMSS) of the backup
> > BACKUP_PATH="/home/rhino/MySQL/backup"; #The directory into which the
> > backup
> > will be written
> > NUMBER_OF_DAILY_BACKUPS_TO_KEEP=7; #The number of generations of backups
> > to
> > keep
> >
> > echo "** REPORT BEGINS **";
> > echo
> > echo "Program Name:" $0
> > report_date=`/bin/date`
> > echo "Report Date:" $report_date;
> > echo
> >
> > #Display the non-secret values used in this run.
> > echo "Backup Values:";
> > echo "  Backup timestamp is" $BACKUP_TIMESTAMP;
> > echo "  Backup path is" $BACKUP_PATH;
> > echo "  Number of daily backups to keep ="
> > $NUMBER_OF_DAILY_BACKUPS_TO_KEEP;
> >
> > #For each database currently in MySQL, take a database-level backup,
then
> > list any backups older than a certain number of day
> > for ONE_DBNAME in `echo show databases | mysql -s -u
$USERID -p$PASSWORD`
> > do
> >    echo
> >    echo "Backing up database" $ONE_DBNAME;
> >    /usr/bin/mysqldump --opt --verbose -u${USERID} -p${PASSWORD}
> > ${ONE_DBNAME} -r ${BACKUP_PATH}"/"${ONE_DBNAME}"."${BACKUP_TI
> >    echo ">> Deleting these old backups for this database..."
> >    /usr/bin/find ${BACKUP_PATH} -mtime
> > +$NUMBER_OF_DAILY_BACKUPS_TO_KEEP -name $ONE_DBNAME'*' -print; #display
> > old
> > backups (i
> >    /usr/bin/find ${BACKUP_PATH} -mtime
> > +$NUMBER_OF_DAILY_BACKUPS_TO_KEEP -name $ONE_DBNAME'*' -exec rm '{}'
';';
> > #delete old
> > done
> >
> > echo
> > echo "** REPORT ENDS **";
> > ---
> >
> > If you want to take a backup manually with this script (and omit the
email
> > being sent to you), you can do this from the mysql prompt via:
> > mysql> \. /home/rhino/MySQL/backup2.bash > /home/rhino/MySQL/backup2.out
> > 2>&1
> >
> > I think the biggest obstacle you're going to face in writing bash
scripts
> > is
> > the lack of good tutorials on it. There are umpteen bash references that
> > show you generic syntax and tell you the terminology used by bash but
> > darned
> > few decent tutorials to show you how to write bash scripts. Some people
> > can
> > do anything they want with only a reference but I'm one of those people
> > who
> > need examples to really understand something so I've had real challenges
> > learning bash since the references are extremely skimpy on concrete
> > examples.
> >
> > Good luck!
> >
> > Rhino
> >
> > ----- Original Message -----
> > From: "HACKATHORN, TODD (SWBT)" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, March 04, 2004 8:57 AM
> > Subject: Scripting
> >
> >
> >> Hello,
> >> I am new to Linux, and mySQL.  I am currently a MsSQL Server 2000 and
VB
> >> programmer, but trying to break away from that side.  I have my
database
> > set
> >> up and working great, but I am really struggling on how to perform
> > scheduled
> >> updates, and data imports.  Can anyone please point me to a good
> >> resource
> > to
> >> learn how to build a script, that can import data from an ODBC
> >> connection,
> >> and then maybe run multiple queries in the data one at a time.  I don't
> > know
> >> what language I want to use because I don't know enough about it.  Once
> >> I
> >> find a way to do what I need, I will learn that language.  I think
there
> >> might be a way to use php as cron'd scripts, but I don't know.  Also I
> >> looked at perl, or just bash in linux.  I am used to being able to do
> >> anything I needed to with DTS packages and stored procedures.  I had
ask
> >> a
> >> similar question a while back, and still can't get going with this.  So
> > far
> >> the graphical packages for updates are the only thing I miss from SQL
> >> Server.
> >>
> >> Thanks in advance for any help.
> >>
> >> Todd Hackathorn
> >>
> >>
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:
> > http://lists.mysql.com/[EMAIL PROTECTED]
> >
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to