How can we hardcode TNS_ADMIN?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can we hardcode TNS_ADMIN?
# 1  
Old 05-04-2011
How can we hardcode TNS_ADMIN?

How can we hardcode TNS_ADMIN?

When i try to connect to db with the code below..i get TNS issue. So wpndering if i can hardcode TNS..
HTML Code:
 
<html>
<head>
<title>xxxxxxxxxxxxxx</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%
  ### Load modules, connect to database
  require 'cgi'
  require 'dbi'
  $dbh = ''
  begin
  $dbh = DBI.connect("DBI:Oracle:dbname", "username", "password")
 
# 2  
Old 05-05-2011
Have you looked at "SetEnv"?

HTTPD.CONF Example:
Code:
SetEnv MYVAR Hello

# 3  
Old 05-05-2011
I tried the code beloe.Getting Internal server error.

<
Code:
<html>
<head>
<title>xxxxxxxxxxxxxx</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%
  ### Load modules, connect to database
  require 'cgi'
  require 'dbi'
  $dbh = ''
  SetEnv TNS_ADMIN '/opt/oracle/network/admin'
  begin
  $dbh = DBI.connect("DBI:Oracle:dbname", "username", "password")>

Can you please check if there is any syntax issue?

Last edited by pludi; 05-05-2011 at 05:47 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Logon to multiple hosts using ssh hardcode password

Hi im trying to write a script to logon to list of servers with same userID. I have no option/plan to implement ssh-keygen sharing between the systems, so i have written script creating 2 files, file1 holds list of hosts host1 host2 host3 file2 has following script for i in `cat file1`... (1 Reply)
Discussion started by: dreamaix
1 Replies

2. UNIX for Dummies Questions & Answers

Problem with TNS_ADMIN in .profile

Hi! In my .profile I have a line that says export TNS_ADMIN=$HOME I received the .profile file from a colleague who uses it to access SQL*Plus from a UNIX server. When I try the same method he uses I get ORA-12154: TNS:could not resolve the connect identifier specifiedwhich makes me think... (8 Replies)
Discussion started by: Mike Welch
8 Replies

3. UNIX for Advanced & Expert Users

Change in script to hardcode in a query

HI, In a script i am using a query ${SQLPLUS_SETTINGS} select c.CYCLE_CODE ||'|'|| NEXT_CYCLE_INST ||'|'|| CYCLE_YEAR ||'|'|| to_char(trunc(CYCLE_CLOSE_DATE +1),'DD-MON-YY YY')||'|'|| to_char(ADD_MONTHS(CYCLE_CLOSE_DATE,1),'DD-MON-YYYY') ||'|'|| CYCLE_MONTH FROM PM1_CYCLE_STATE C,... (2 Replies)
Discussion started by: madfox
2 Replies

4. Shell Programming and Scripting

mysqldump script without hardcode password

OS: Linux ambglx02 2.6.16.60-0.21-default #1 Tue May 6 12:41:02 UTC 2008 i686 i686 i386 GNU/Linux Shell: bash Currently I have a mysqldump script to backup my mysql database, the command is as below: /opt/novell/mysql/bin/mysqldump --add-drop-table -u root -p -h mydb > /home/john/mydb.sql ... (5 Replies)
Discussion started by: bulkbiz
5 Replies

5. Solaris

i wanto hardcode password for a username to ssh to a server using script

Dear all i want to ssh to a server via running a shell script with a username and i want to hard code the password for that particular username can u help me please Thank u Naree (8 Replies)
Discussion started by: naree
8 Replies
Login or Register to Ask a Question