Path: news.easynews.com!easynews!news.he.net!news-hog.berkeley.edu!ucberkeley!newsfeed.stanford.edu!postnews1.google.com!not-for-mail
From: rs_arwar@hotmail.com (Rauf Sarwar)
Newsgroups: comp.databases.oracle.server
Subject: Re: Any APIs?
Date: 7 Jul 2002 10:01:19 -0700
Organization: http://groups.google.com/
Lines: 62
Message-ID: <92eeeff0.0207070901.1df6339d@posting.google.com>
References: <01c2242d$4688e4a0$8c79158b@mhw09108> <3D27DA75.F85F0E6F@ureach.com> <ag8oo2$m60$1@lust.ihug.co.nz>
NNTP-Posting-Host: 207.67.54.37
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1026061279 15123 127.0.0.1 (7 Jul 2002 17:01:19 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 7 Jul 2002 17:01:19 GMT
Xref: easynews comp.databases.oracle.server:153313
X-Received-Date: Sun, 07 Jul 2002 09:58:38 MST (news.easynews.com)

"Howard J. Rogers" <dba@hjrdba.com> wrote in message news:<ag8oo2$m60$1@lust.ihug.co.nz>...
> "Karen" <abvk@ureach.com> wrote in message
> news:3D27DA75.F85F0E6F@ureach.com...
> > No API.   Even if such API existed it would be clumsy.  There is a lot
> > of clauses in these files, and an API would have to have calls to encode
> > them.
> >
> > Besides, Oracle is trying to get rid of the files, make this automatic.
> >
> 
> 
> Whoa! You'll have to run that one pass me again. Oracle are "trying to get
> rid" of tnsnames.ora and listener.ora??
> 
> I don't think so.
> 
> They may be trying to get rid of static SID declarations in the
> listener.ora. But that's about it. Service names need resolving. There will
> *always* be a need therefore for a resolving mechanism. TNSNAMES is just a
> resolving mechanism. There are others (names server, etc). But tnsnames is
> basic, functional and ain't going nowhere soon.
> 
> Likewise... the listener will always be with us, and will always need
> configuring if the defaults aren't appropriate to your needs.
> 
> Regards
> HJR
> 
> 
> > NetAssistant can generate files but provides limited functionality.
> >
> > Janardhan wrote:
> >
> > > Does Oracle Provide any API to modify TNSNAMES.ORA and LISTENER.ORA?
> >


Net8 assistant is pretty much the best way to do it. Idea is to use
something which is already there...why re-invent the wheel.

However, if you are curious like me and want to kick around with the
idea then one way would be to successfully parse the tnsnames.ora
file. Once parsed you can change the parameters in individual connect
descriptors and save the file. I don't know what kind of effort would
there be. Since there is no public API provided by Oracle to parse a
tnsnames.ora file, I built a parser in java which parses the
tnsnames.ora file and have few functions to work with like,

1) Returns a list of all service_names/aliases in the file.
2) Returns full connect descriptor from "=(DESCRIPTION..." to last
closing "...)" parethesis given an alias/service_name. This is what
you can use and further parse the connect descriptor.
3) Builds the url and returns a java Connection object (oci8/oci7 or
thin) given only an alias/service_name. etc

If you want to play around with it, email me and I can send it to you
with documentation. It's a freeware so you can do whatever you like
with it. It took me approx 25 hours to program it. Tested on version
7.3.x to 8.1.x. and requires java 1.2.1 and above.

Regards
//Rauf Sarwar
