DB connection


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers DB connection
# 1  
Old 03-08-2013
DB connection

hi Im unable to find how this script in conencting to DB and which DB and job is scheduled in TWS to run this script.

Any sugggestion where to look for or how to get information.

please find below part of script for DB conenction.


Code:
##### SET VARIABLES ##################

rundate=`date +%H%M%b%d%Y`
LOGFILE=/logs/NDM/RSLAUTO.$rundate
BAN_CONF_STATUS=/logs/NDM/BANSTSAUTO.$rundate.$$
BAN_DETAILS=/logs/NDM/BAN_NAME_AUTO.$rundate.$$
homedir=/usr/local/ifs/resell
unsentlogdir=/usr/local/ifs/resell/unsent/logs
rsllogdir=/usr/local/ifs/resell/logs
codelist="FTP NDM CD"
echo "This Log is for rundate=$rundate"  | tee -a $LOGFILE
echo "--------------------------------------------------"  | tee -a $LOGFILE
echo " " | tee -a $LOGFILE


  ************    Special Code following Database password encryption     ***********

  DBCODE=CUSTMC
  DBMKT=${new_market:-$MARKET}
  RUN_MODE=F

  . setmarket_sh $DBMKT

status=`sqlplus -s $OP_CONNECT_STRING@$OPERATIONAL_DB_NAME << !

        set head off
        set line 999
        set echo on
        set feed on

      select username, password, db_instance db_instance_node from dbconfig
      where db_connect_code=(select db_connect_code from jobdbconnect
      where job_name='$DBCODE' and market='$DBMKT' and run_mode='$RUN_MODE');
!`
echo $status

      echo $status | grep "no rows selected" > /dev/null 2>&1
      if [ $? -eq 0 ]
        then
          echo "You have specified a connect code that does not exists" | tee -a $LOGFILE
          exit 1
      fi

      echo $status | grep "ORA-" > /dev/null 2>&1
      if [ $? -eq 0 ]
        then
          echo "An oracle error has occurred when trying to get db connection from op db" | tee -a $LOGFILE
          echo "$CODE_RESULTS" | tee -a $LOGFILE
          exit 2


Last edited by Corona688; 03-08-2013 at 04:17 PM..
# 2  
Old 03-08-2013
Please use code tags if you are posting any code fragments or data samples.

You can get the DB connection string by putting an echo statement right before the sqlplus block.
Code:
echo "$OP_CONNECT_STRING@$OPERATIONAL_DB_NAME"

Since this script is getting called from a TWS job, I guess it must be sourcing another script right before this one to set these variables.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remote connection

How can we connect to remote computers with a bash script.? (1 Reply)
Discussion started by: diw10
1 Replies

2. UNIX for Advanced & Expert Users

How keep running a program n an another computer via a connection ssh when the connection is closed?

Hi everybody, I am running a program on a supercomputer via my personal computer through a ssh connection. My program take more than a day to run, so when I left work with my PC I stop the connection with the supercomputer and the program stop. I am wondering if someone know how I can manage... (2 Replies)
Discussion started by: TomTomGre
2 Replies

3. AIX

IP connection

Hi, I have a server AIX 5.3 Few people have the root password and somebody used the root login to erase a file (command rm in the .sh_history of root). :mad: I would like to know if a file exist with what ip address has been connected. I want to find the guilty!!! :D Thanks guys (2 Replies)
Discussion started by: Castelior
2 Replies

4. Shell Programming and Scripting

db connection

Hi, I'm trying to write a script which will run a select on db. #!/usr/bin/ksh SQL_INPUT_FILE=file_name.sql SQL_OUTPUT_FILE=output.txt MANPATH=/usr/share/man:/opt/SUNWspro/man:/usr/local/man... (2 Replies)
Discussion started by: ozum
2 Replies

5. Solaris

PC-X connection

Hi all, I have just installed SunOS 10 at the first PC and exceed (pc-x server) at the second. I'm trying to connect to the first pc via exceed softvare. After entering login and pass, the exceed window immidiate close without any errors (if CDE or JDS has been chosen). Via exceed working just... (0 Replies)
Discussion started by: Marauder62
0 Replies

6. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

7. UNIX for Advanced & Expert Users

Connection reset by peer..closing connection

Hello I'm facing the above problem while doing a performance run. I've a script which I'm launching from my windows desktop using mozilla. The script will invoke backend action on a Solaris host which in turn feeds the records to a driver located on a linux box(Cent OS). What's happening is... (1 Reply)
Discussion started by: subramanyab
1 Replies

8. UNIX for Dummies Questions & Answers

ssh_exchange_identification: Connection closed by remote host Connection closed

Hi Everyone, Good day. Scenario: 2 unix servers -- A (SunOS) and B (AIX) I have an ftp script to sftp 30 files from A to B which happen almost instantaneously i.e 30 sftp's happen at the same time. Some of these sftp's fail with the following error: ssh_exchange_identification: Connection... (1 Reply)
Discussion started by: jeevan_fimare
1 Replies

9. IP Networking

HOw to start a connection?

Hi, I understand assignment qns are not allowed. However, I need major help.. please teach me how to write a tcp/ip programme using C, wad are the websites that i can refer to? wad are the codes required for it? I have never done tcp/ip configurations before, and never learnt C before,... (13 Replies)
Discussion started by: microuniz
13 Replies

10. Cybersecurity

FTP Connection

I just started a new job and inherited a Fedora core 3 server. I wanted to open the ftp ports and I wanted to verify this code before I mess things up. From my reading the two lines below should allow ftp access can anyone confirm my attempt. iptables -A INPUT -p tcp - sport 21 -m state - state... (0 Replies)
Discussion started by: mungaz
0 Replies
Login or Register to Ask a Question