C# parses Oracle's tnsnames.ora into array?

Hello,

I found many solution and scripts on-line, but none worked will or was to armature!

I'm looking for a script where it takes the tnsnames.ora file and parse it into "array" or whatever

that I can easy use it with combo-box to show the names and when the user select the name the system le's say ping the IP or the host

I need the name,host,ports,SID,service, what ever I can get

cheers
Data-BaseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
0
Data-BaseAuthor Commented:
thanks,

it look nice (I saw it before) but for some reason it stops round here

private ArrayList ParseText(string text)
    {

      ArrayList list = new ArrayList();

      string pattern =
        @"(?<name>[A-Z\-_]+\.WORLD)|" +
        @"(PROTOCOL = (?<protocol>[A-Z]+))|" +
        @"(HOST = (?<host>[A-Z0-9._]+))|" +
        @"(PORT = (?<port>[0-9]+))|" +
        @"(SID = (?<sid>[A-Za-z0-9.\-_]+))|" +
        @"(SERVICE_NAME = (?<service>[A-Z\-._]+))";

      TNSEntry entry = null;

      foreach (Match m in Regex.Matches(text, pattern))
      {

        string name = m.Groups["name"].Value;
        string protocol = m.Groups["protocol"].Value;
        string host = m.Groups["host"].Value;
        string port = m.Groups["port"].Value;
        string service = m.Groups["service"].Value;
        string sid = m.Groups["sid"].Value;


not sure why

cheers
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>but for some reason it stops round here

with error(s)? which one(s)?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Data-BaseAuthor Commented:
the thing does not show any error, but it return nothing at all !!!!

I just added MessageBox.Show("Hello!") as a brake point and then I found out that the message box does not show in this area !!!!!
0
Data-BaseAuthor Commented:
I think the problem is within the (regular expression), I redone it but using another method by analyzing the output of the tnsping :-)


I will work farther on other solutions :-)

cheers
0
Data-BaseAuthor Commented:
I solved the issue, I needed to re write the regular expressions :-)

Thank you all
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.