Hi All, Can someone help this novice with a shamm Shell / Perl script to be executed at the prompt. I have a MySql db with TABLE=TEST FIELD=LIST RECORDs= 1pc49 6qh79 sbe59 etc.
I need a script that will connect to the db and append each record to a text file till end of database. there may be simpler ways to do this, but i need a script to do this as I have further processing to do. the script can be directly executed from promtp as ./script_name
Any pointers will also help.
Thx in advance. Poonam
________________________________________________________________________ Everything you always wanted to know about cars and bikes,now at: http://in.autos.yahoo.com/cricket/tracker.html
On Sat, Jun 01, 2002 at 10:26:42AM +0100, Poonam P wrote:
I need a script that will connect to the db and append each record to a text file till end of database. there may be simpler ways to do this, but i need a script to do this as I have further processing to do. the script can be directly executed from promtp as ./script_name
For perl script to connect to database you need a DBD (Database Driver) for that particular data base. Pearl has 2-layers between script and database. DBI, DBD layars. To provide uniform interface to all the databases DBI(Data base Interface) is defined. So you need to write code according to perl::DBI. And you don't need to change it if the database changes.
And when you get the DBD for your database use the script.
Don't know about Shell Scripts.
regards
On Sat, 1 Jun 2002, Poonam P wrote:
I have a MySql db with TABLE=TEST FIELD=LIST RECORDs= 1pc49 6qh79 sbe59 etc.
I need a script that will connect to the db and append each record to a text file till end of database.
for perl, man DBI. There's an example that retrieves records from a database. You then just need to append it to the text file in any number of ways.
The simplest would be to print it to stdout, and redirect your script's output.