Configuring Net8
As mentioned earlier,
we need to install a layer of network software on our web server that allows
us to communicate with Oracle. By selecting the Client
installation, the Oracle Installer will have installed Net8, which we now have
to configure.
Net8 supports standard network protocols,
such as TCP/IP, to connect to Oracle8 servers through the use of user-friendly
aliases called service
names. A service name is simply a name used to refer
to an Oracle server much as we use URLs in preference for hard-to-remember IP
addresses.
You have a number of ways in which to
store these lists of service names:
Domain Name System (DNS)
Local client configuration files
Oracle Name Server
Non-Oracle name server
Net8 uses Oracle
Protocol Adaptors to map the following industry-standard
network protocols into a standard that it can recognize internally :
|
TCP/IP
|
Widely-used Internet
network protocol
|
|
SPX
|
Another commonly
used network protocol
|
|
Named Pipes
|
Microsoft's networking
protocol specific to PC-based LANs
|
|
Bequeath
|
Used for local Windows
95 and 98 Personal Oracle8 installations
|
|
Logical Unit Type
|
Part of IBM's peer-to-peer
SNA network
|
Oracle8 comes with two utilities to configure
Net8: Net8
Easy Config , to edit our list of service names, and
Net8
Assistant, an advanced utility that allows us to configure
service names, network listeners, Oracle Names Servers and local configuration
files. Configuration using Net8 Assistant is primarily a DBA role so we won't
cover it here. We will be using the Net8 Easy Config application to configure
our client.
There are a number of ways to store the
list of service names with the two most commonly used methods being:
Host
Naming – Uses
existing DNS-based or a centrally maintained HOSTS
file for name resolution. By simply using the host's network name, no client
configuration is required .
Local
Naming – Uses
a local configuration file, TNSNAMES.ORA,
to resolve names.
Host
Naming
does not require any client configuration so we will take a look at Local Naming
using the Net8 Easy Config program. Net8 Easy Config edits a file called TNSNAMES.ORA
in the installation_folder\Net80\Admin
folder, which can be edited manually using Notepad. In many Oracle sites it
is a common practice to simply copy the TNSNAMES.ORA
file from the Oracle server machine onto the client.
TNS stands for Transparent
Network Substrate (TNS). This is a non- proprietary
low-level interface that manages the opening and closing of sessions and the
sending or receiving of requests .
The screens that make up the Oracle8 and
Oracle8i Net8 Easy Config (Net8 Configuration Assistant in Oracle8i) applications
do differ somewhat so we'll work through both versions
to configure connecting to an Oracle8 and Oracle8i server.
If you are configuring an Oracle8 client
then start the Oracle Net8 Easy Config and select Add
New Service. Our DBA has called the Oracle8 server
Oracle8_Dev,
so we'll type that name in – you'll have to use the name of your own Oracle8
server. You may find that this is the name of the actual server, provided that
it is only running one instance of Oracle.
You may see a dialog box warning
you that Net8 Easy Config has found a number of comments in the configuration
file TNSNAMES.ORA.
It is generally safe to ignore this warning message.
In the case of our Oracle8i database,
we have a server called Oracle8i_Dev
so we'll use that for the name. Before you can enter the Oracle8i service name,
choose the Local
Net Service Name configuration option, click Next
and then choose the Add
item to add a new service name before pressing Next
again. Finally you must tell the Oracle8i Configuration Assistant that you want
to access an Oracle8i database. Clicking Next
will take you to the Service Name screen:
The next step is to choose the type of
network protocol used to communicate with the server. Typically this will most
likely be TCP/IP:
The host name is the resolved name used
to refer to the server, which in our case is the same name given to this service
name – for ease. It is possible to install the Oracle server software to
listen on a different TCP/IP port number. By default, port number 1521
is used for Oracle installations, in much the same way that port number 80 is
used for HTTP requests . Unless your DBA has used
a different port number for additional security, select the default option:
There is one additional step to complete
before testing an Oracle8 connection: you have to type in the name of the database
System Identifier, or SID
to connect to. It is possible to run more than one instance
of Oracle on the same server by giving each instance a unique SID by which it
can be identified. If there is only one instance installed, then the Oracle
server installation will default to calling it ORCL,
which your DBA can confirm :
If you do have a number of
SIDs per server then it might be a good idea to use the SID as the name for
each service.
To test the new service name, you must
enter a valid user name and password when using Oracle8. Typically you can enter
the scott/tiger
username/password combination provided that the pre-configured scott
database has been installed. The Oracle8i version actually defaults to using
scott/tiger
for you .
If you've entered the correct host name
and username/password then you should receive a message saying that the connection
test was successful. If you receive the error message ORA-12545:
connect failed because target host or object does not exist,
you need to recheck the values of your host name, port number and SID. You should
also confirm that Oracle is actually running on the host specified.
The message ORA-01017:
invalid username/password; logon denied is a lot more
encouraging; it means that you successfully communicated with the Oracle server,
but you entered the wrong username or password.
ORA-12545 and ORA-01017 are the common
error messages that you are likely to come across,
but you may receive any of the following messages as well:
|
ORA-12154:
"TNS:could
not resolve service name"
|
Net8 could not find
the service name specified in your TNSNAMES.ORA
file.
Make sure that the TNSNAMES.ORA
file actually exists and that you do not have multiple copies of the TNSNAMES.ORA
file.
Make sure that you do not have duplicate copies
of the SQLNET.ORA
file.
When using domain names ensure that your SQLNET.ORA
file contains a NAMES.DEFAULT_DOMAIN
value.
|
|
ORA-12198:
"TNS:could
not find path to destination"
and
ORA-12203:
"TNS:unable
to connect to destination"
|
The client could
not find the required database.
Is the service name spelled correctly?
Is TNSNAMES.ORA
file in the correct folder?
Check that the service name ADDRESS
parameter in the connect descriptor of your TNSNAMES.ORA
file is correct.
Get your DBA to check that the Oracle Listener
on the remote server has started and is running.
|
|
ORA-12224:
"TNS:no
listener"
|
Could not connect
because the listener is not running.
Does the destination address match one of the
addresses used by the listener.
Are you running the correct version of Net8
or SQL*Net?
|
Now that we've covered some of the differences between Oracle8
and Oracle8i, from now on we'll refer to them both collectively as Oracle8.
When we come across a distinction between the two, we'll highlight it.
Much like SQL Server's user
spaces, Oracle groups database objects, such as tables,
indexes and procedures, into what is called a schema
. A schema maps to an actual login name. So, in the case
of the scott
login name you will find a whole host of database objects under the scott account.
scott
is the sample database schema created by the Oracle Installer when you first
install the Oracle server. Typically, a new default Oracle installation will
have the following logins created:
|
Username
|
Password
|
Password
|
|
scott
|
tiger
|
Sample login.
|
|
sys
|
change_on_
install
|
Database administrator.
Can perform all operations such as stopping and starting the database.
|
|
system
|
manager
|
Operations user that
can perform operational tasks such as database backups.
|
We've gone through the process of installing Oracle's client networking software,
Net8, then added and tested a new Net8 service name to connect to an Oracle8
server called Oracle8_dev and an Oracle8i server called Oracle8i_dev. Now it's
time to look at how we connect to an Oracle database through ASP.