Skip to Main Content
This is a BETA environment
This environment is only for testing and may be reset multiple times during the testing period. We will be frequently upgrading this BETA environment, so check back often for changes. Please assist us by providing feedback via the bug icon to the left of your profile avatar. For the current active community, visit https://community.oracle.com/tech/developers/.

Using 10g SQL Plus from a batch file

746290Jan 13 2010 — edited Jan 13 2010
I installed the Oracle Database 10g Express Client and configured my ODBC and tnsnames.ora settings, and I think I have it all right, because when I open the SQL Command Line I can connect to the database just fine using:

connect <username>/<password>@<database>

However, when I try to log in through a non-SQL command line or batch file using the syntax:

sqlplus <username>/<password>@<database>

I get the error "ORA-12154: TNS:could not resolve the connect identifier specified." That syntax used to work for me with 9.2. Does the functionality still exist in 10.2?

Update #1:
----------------
The sqlplus login works from a normal command widow if I first CD C:\XEClient\bin. I still can't get it to work from a batch file, even when I specify the path. Does this mean the batch file command can't find my tnsnames.ora? If so, what environment variable do I need to set? I already have the client directory in the Path and ORACLE_HOME variables.


Update #2:
----------------
I started randomly trying every Oracle environment variable I could find a reference to, and found that setting TNS_ADMIN to the C:\XEClient\bin directory worked.

I don't need any responses to this post, so it can be deleted by an admin.

Edited by: user11241849 on Jan 13, 2010 12:05 PM
Comments
Post Details
Added on Jan 13 2010
0 comments
1,573 views