Generic script for Querying a DB


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Generic script for Querying a DB
# 1  
Old 06-13-2011
Generic script for Querying a DB

I have a few databases that i need to get some basic output from... so I'll be returning 1 or 2 records from a variety of different databases and the input queries will always differ.

What im looking for is a generic script that I can use across of the databases. Theory being i have:

mainscript.sh
configfile.cfg

In the config file is things such as db user and pw and type and a list of queries to run.

The mainscript will then go down the config file, connect to the db... run the queries 1 by 1 and echo the output. Obviously the amount of queries and types of databases will vary.

Anyone know of anything already in existance or can think of a funky way of doing this ?!

Any help at all is massively appreciated.
# 2  
Old 06-13-2011
Are the databases all oracle? all sybase? ?

What are the table names? column names? Are they all the same across databases?
# 3  
Old 06-13-2011
It will be both oracle and sybase.... And table names and column names etc will differ. Thats why I want to be able to pass it any query I want and whatever is returned I can output.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Generic script to load file details(ls -ltr) in to a database.

All, I am trying to create a report on the duration of an ETL load from the file arrival to the final dump in to a database for SLA's. Does anyone have any guidance or ideas on how metadata can be extracted; information of a file: like file name, created timestamp, count of records and load... (1 Reply)
Discussion started by: pradeepp
1 Replies

2. Shell Programming and Scripting

Generic script to recursively cd into directories and git pull

Hi all, I'm trying to write a script to recursively cd into my Git projects and pull them, and will later expand it to build my projects as well. I'm having a bit of trouble with my current script, as I want to supply a command line argument to tell it which branch to check out. I can hard... (2 Replies)
Discussion started by: Cows
2 Replies

3. Shell Programming and Scripting

Required help on a Generic File-watcher script

Hi All, Good morning... I have prepared a shell script which will monitor files in a certain folder and if available, SCP it to a destination path. Now the challenge I'm facing is my script is currently SCP-ing to only a single destination path. Wherever different destination path is in... (1 Reply)
Discussion started by: saps19
1 Replies

4. Shell Programming and Scripting

generic sftp script creation

I am trying to work out if it is possible to create a generic scrip which will allow sftp to be run for connecting to a host machine based on a parameter and to retrieve files based on a batch file. The batch file bit I am fine with, I can make that work. The are I'm not so sure about is how to... (1 Reply)
Discussion started by: mike_p
1 Replies

5. Shell Programming and Scripting

ksh script to create a generic csv file from different source formats

Hi all, I have a requirement to create a "superset" file out of a number of different sources with some different and some same columns. We intend to have a manually updateable SuperSetCols.csv which would look like "ColA","ColB","ColC","ColD","ColE","ColF","ColG" so someday we may add... (3 Replies)
Discussion started by: Leedor
3 Replies

6. Shell Programming and Scripting

Generic Shell Script to Archive a file

Would appreciate if any one can paste a generic schell script to archive a file with date stamp by passing the file with fullpath as parameter For Eg. /apps/scripts/Archive_File.sh /data_home/project_home/file.txt this should place the file in the following directory ... (8 Replies)
Discussion started by: mak1600
8 Replies

7. HP-UX

Querying HP VA array

Hello, all... I've got an older HP-UX 11i machine hooked up to an HP VA array. I've never worked with VA arrays, so I was wondering if anyone could point me in the direction of some documentation on querying and manipulating VAs (HP VAs for Dummies or something). I'm used to EMC arrays, so... (2 Replies)
Discussion started by: kknigga
2 Replies

8. Shell Programming and Scripting

Connecting and Querying DB2 database from Unix Script?

I am trying to develop a script that can connect to a DB2 database mainframe and Query the database and display the results. I've been researching, but I have yet to find a definitive solution where I can enter in the Mainframe DB2 address db2:// and query the database and return the results. If... (2 Replies)
Discussion started by: developncode
2 Replies

9. Shell Programming and Scripting

How to transfer files (By using generic script) when using sftp

I have written generic script to transfer files from one machine to other machine(By passing the command line arguments like server name, user name ,location of the files, file names etc) but when i am using sftp, what are the things I have to specify in the code Is it necessary to specify... (0 Replies)
Discussion started by: gsri
0 Replies
Login or Register to Ask a Question