Hi, I installed oracle 11g..and downloaded ojdbc5.jar driver..
when using this jar in netbeans to add the driver to connect to data base it is asking TNS name..
may i know what th eTNS name is?
my db domain is email@example.com/1521..
Tns name is the name of the entry in tnsnames.ora file which is kept in $ORACLE_HOME/network/admin
Some JDBC drivers connect with a connection string, some can use a TNS name.
(ADDRESS = (PROTOCOL = TCP)(HOST = myserver )(PORT = 1521))
(SERVER = DEDICATED)
(SERVICE_NAME = mydb)
a tns name is a name which is resolved to access a database :
myname is resolved on
- a host: linux1
- a TCP port: 1521 (where the listener is listening on)
- a database service which is know by the listener : mySID
It's a simple way to resolve a name to an oracle database instance on the network.
What is a TNS? It is an alias.
Like a hostname is an alias for an IP address, a TNS is an alias for an OCI (Oracle Call Interface) connection string. This string identifies the database server and database instance to connect to. It also can include load balancing parameters, request a specific type of connection, connection to a specific database service, etc.
The file +/etc/hosts+ (on Unix) or c:\windows\system32\drivers\etc\hosts (on Windows) is used to store the list of hostname (aliases) for IP addresses.
Similarly, Oracle has a file called tnsnames.ora that contains TNS aliases with the corresponding connection strings. This is usually in the +%ORACLE_HOME%\network\admin+ directory. You can also set the environment variable called TNS_ADMIN and point it to any user directory you want to use that contains your tnsnames.ora file.