Home » RDBMS Server » Networking and Gateways » Connect Remotely Database (Oracle 9i database)
Connect Remotely Database [message #465476] Wed, 14 July 2010 05:24 Go to next message
usmanelahi
Messages: 54
Registered: July 2007
Location: Karachi
Member
Hello Gurus,

i have a inventory system and trying to connect remote database one by one throught two static ips. If first ip is not ping then go to 2nd ip only when open the login.fmx page

following examples are my tnsnames.ora

IP1.WORLD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 117.65.48.12)(PORT = 1521))
(CONNECT_DATA = (SID = ORCL))
)

IP2.WORLD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 117.65.48.13)(PORT = 1521))
(CONNECT_DATA = (SID = ORCL))
)



i am not understand what i write the code on-logon trigger

please help me if you can do it
Re: Connect Remotely Database [message #465497 is a reply to message #465476] Wed, 14 July 2010 06:46 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Check the LOGON built-in, perhaps it'll help.

How could you do that: create the ON-LOGON trigger and connect to the first database:
-- ON-LOGON trigger
logon('user_name@ip1', 'pass_word', false);
Note the FALSE value of the "logon screen on error" parameter - it will make it possible to connect to another database (eventually) without displaying a message to end user.

If it fails, error will be raised - handle it in the ON-ERROR trigger:
-- ON-ERROR trigger
logon('user_name@ip2', 'pass_word', true);

See how it works, adjust if necessary.
Re: Connect Remotely Database [message #465507 is a reply to message #465476] Wed, 14 July 2010 07:58 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
Could you do it more simply by using Oracle Net's fault tolerance? I would normally include load balancing too. No need for anything in your application, just one tnsnames entry:
IP.WORLD =
(DESCRIPTION =
(address_list=
(failover=on)
(load_balance=on)
(ADDRESS = (PROTOCOL = TCP)(HOST = 117.65.48.12)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 117.65.48.13)(PORT = 1521))
)
(CONNECT_DATA = (SID = ORCL))
)
Re: Connect Remotely Database [message #465513 is a reply to message #465507] Wed, 14 July 2010 08:18 Go to previous messageGo to next message
usmanelahi
Messages: 54
Registered: July 2007
Location: Karachi
Member
thank you very much for post this simple code i will test this code tomorrow hope it will work fine thankyou once again
Re: Connect Remotely Database [message #465549 is a reply to message #465513] Wed, 14 July 2010 12:17 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Sounds very interesting and - above all - useful, John! It was something new for me; thank you!
Re: Connect Remotely Database [message #465567 is a reply to message #465549] Wed, 14 July 2010 16:12 Go to previous messageGo to next message
babuknb
Messages: 1736
Registered: December 2005
Location: NJ
Senior Member

Thanks John ! Something new today learned from you Smile

Babu
Re: Connect Remotely Database [message #465644 is a reply to message #465507] Thu, 15 July 2010 01:14 Go to previous messageGo to next message
usmanelahi
Messages: 54
Registered: July 2007
Location: Karachi
Member
I have check the code from Oracle9i tnsnames.ora error are attached and if i ping from developer6i tnsnames.ora file then error show failed to resolve name..



  • Attachment: oracle9i.JPG
    (Size: 33.48KB, Downloaded 1207 times)
Re: Connect Remotely Database [message #465648 is a reply to message #465644] Thu, 15 July 2010 01:23 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So post your tnsnames.ora, you have a syntax/parenthesis missing error.

Regards
Michel
Re: Connect Remotely Database [message #467115 is a reply to message #465648] Thu, 22 July 2010 05:04 Go to previous message
usmanelahi
Messages: 54
Registered: July 2007
Location: Karachi
Member
yes its working i remove the systex (address_list=

thank you very much great job
Previous Topic: Database Connection
Next Topic: delay in oracle
Goto Forum:
  


Current Time: Fri Mar 29 02:37:05 CDT 2024