Unix Technical Forum

Some Lateral thinking Required - Hard-Coded instance workaround

This is a discussion on Some Lateral thinking Required - Hard-Coded instance workaround within the Oracle Database forums, part of the Database Server Software category; --> Hi, I'm trying to resolve a problem. I currently have a java application utilising an oracle instance called orany1. ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-25-2008, 03:48 AM
Johne_uk
 
Posts: n/a
Default Some Lateral thinking Required - Hard-Coded instance workaround

Hi,

I'm trying to resolve a problem. I currently have a java application
utilising an oracle instance called orany1. The developers made the
mistake of hard-coding all the sql references to the tables with the
instance name i. table_name@orany1. The application connects to the
instance as the user that owns the application schema.

However, I now need to move the application schema to another instance
called orany2. This will be a short-term measure as the application
will shorlty be replaced. The developers are apprehensive about
changing the @orany1 references in the java code and have asked me to
look into a workaround.

I need to try and find a way to connect to the orany2 instance and for
the table references to orany1 to actually read from the orany2 tables.
I've tried using synonyms but his was unsuccessful.

What about changing the service name in tnsnames.ora on the application
web server? The server name will be orany1 and the sid will be orany2.
I guess I can test this when I return to work.

Thanks for any assistance in advance.

regards
John

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-25-2008, 03:48 AM
stevedhoward@gmail.com
 
Posts: n/a
Default Re: Some Lateral thinking Required - Hard-Coded instance workaround

Hi John,

My assumption is they are using the OCI driver. If this is the case,
then changing the tnsnames file will fix the issue, as it uses the
tnanmes file for resolution. If they are using the thin driver, then
it won't, as the connection string contains the hostort:sid, not an
alias as OCI uses.

How did you do the synonyms? As ugly as this sounds, you should be
able to use a database link with a snynoym. If you are connecting to
the user in orany1 who owns the tables, you will probably have to drop
all of the tables in orany1, create the database link and synonyms to
orany2, and you should be OK...and then you should shoot your
developers, or at least point them in the direction of JNDI or a simple
properties file.

Regards,

Steve

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-25-2008, 03:48 AM
DA Morgan
 
Posts: n/a
Default Re: Some Lateral thinking Required - Hard-Coded instance workaround

Johne_uk wrote:
> Hi,
>
> I'm trying to resolve a problem. I currently have a java application
> utilising an oracle instance called orany1. The developers made the
> mistake of hard-coding all the sql references to the tables with the
> instance name i. table_name@orany1. The application connects to the
> instance as the user that owns the application schema.
>
> However, I now need to move the application schema to another instance
> called orany2. This will be a short-term measure as the application
> will shorlty be replaced. The developers are apprehensive about
> changing the @orany1 references in the java code and have asked me to
> look into a workaround.
>
> I need to try and find a way to connect to the orany2 instance and for
> the table references to orany1 to actually read from the orany2 tables.
> I've tried using synonyms but his was unsuccessful.
>
> What about changing the service name in tnsnames.ora on the application
> web server? The server name will be orany1 and the sid will be orany2.
> I guess I can test this when I return to work.
>
> Thanks for any assistance in advance.
>
> regards
> John


I'd make the developers change the reference to one that is not
hard-coded to teach them a lesson about bad behaviour having
consequences. This will not be the only application they do this
in and not the only time you will have to move an app.

BTW: Exactly how was this moved from test to prod?
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-25-2008, 03:48 AM
William Robertson
 
Posts: n/a
Default Re: Some Lateral thinking Required - Hard-Coded instance workaround

DA Morgan wrote:
> Johne_uk wrote:
> > Hi,
> >
> > I'm trying to resolve a problem. I currently have a java application
> > utilising an oracle instance called orany1. The developers made the
> > mistake of hard-coding all the sql references to the tables with the
> > instance name i. table_name@orany1. The application connects to the
> > instance as the user that owns the application schema.
> >
> > However, I now need to move the application schema to another instance
> > called orany2. This will be a short-term measure as the application
> > will shorlty be replaced. The developers are apprehensive about
> > changing the @orany1 references in the java code and have asked me to
> > look into a workaround.
> >
> > I need to try and find a way to connect to the orany2 instance and for
> > the table references to orany1 to actually read from the orany2 tables.
> > I've tried using synonyms but his was unsuccessful.
> >
> > What about changing the service name in tnsnames.ora on the application
> > web server? The server name will be orany1 and the sid will be orany2.
> > I guess I can test this when I return to work.
> >
> > Thanks for any assistance in advance.
> >
> > regards
> > John

>
> I'd make the developers change the reference to one that is not
> hard-coded to teach them a lesson about bad behaviour having
> consequences. This will not be the only application they do this
> in and not the only time you will have to move an app.
>
> BTW: Exactly how was this moved from test to prod?
> --
> Daniel A. Morgan
> http://www.psoug.org
> damorgan@x.washington.edu
> (replace x with u to respond)


Maybe they were too Agile for a test system.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-25-2008, 03:48 AM
Johne_uk
 
Posts: n/a
Default Re: Some Lateral thinking Required - Hard-Coded instance workaround

Thanks for the replies guys.

I've just found out that the app uses a connection string (no tnsnames)
so that rules out using tnsnames.The orany1 database is going to be
scrapped and rebuilt again in the future so the option of connecting to
orany2 and using db link / synonyms to point to orany1 cannot be used
(good idea though). Our development is done offshore and we would be
charged for these changes which is not worth it for the short time we
need to relocate the app. I agree its bad practise and I believe none
of other others apps have hard-coded references.

I did trying connecting directly to orany2 and creating synonyms that
reference table@orany2 for any reference to table@orany1 in the code
but it refuses to work.

Thanx again
John

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-25-2008, 03:48 AM
Jim Kennedy
 
Posts: n/a
Default Re: Some Lateral thinking Required - Hard-Coded instance workaround


"Johne_uk" <edgarj@tiscali.co.uk> wrote in message
news:1145294842.841056.47990@i39g2000cwa.googlegro ups.com...
> Thanks for the replies guys.
>
> I've just found out that the app uses a connection string (no tnsnames)
> so that rules out using tnsnames.The orany1 database is going to be
> scrapped and rebuilt again in the future so the option of connecting to
> orany2 and using db link / synonyms to point to orany1 cannot be used
> (good idea though). Our development is done offshore and we would be
> charged for these changes which is not worth it for the short time we
> need to relocate the app. I agree its bad practise and I believe none
> of other others apps have hard-coded references.
>
> I did trying connecting directly to orany2 and creating synonyms that
> reference table@orany2 for any reference to table@orany1 in the code
> but it refuses to work.
>
> Thanx again
> John
>

Which gives a good reason why off shoring is not a bright idea. But I am
sure you already knew that. Clearly these aren't talented or seasoned
application developers. All that money that was "saved" by off shoring
comes back to haunt one.
Jim


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-25-2008, 03:48 AM
HansF
 
Posts: n/a
Default Re: Some Lateral thinking Required - Hard-Coded instance workaround

On Mon, 17 Apr 2006 18:48:04 -0700, Jim Kennedy wrote:

>>

> Which gives a good reason why off shoring is not a bright idea. But I am
> sure you already knew that. Clearly these aren't talented or seasoned
> application developers. All that money that was "saved" by off shoring
> comes back to haunt one.


With all due respect - one can get the same lack of talent without going
offshore.

Or worse - one can get seasoned talent in other environments who know
even less in the target environment than the off shore groups.

I can't count the times I've followed 'SQL experts' who were actually
'SQLServer' experts with no knowledge of Oracle. The code, while probably
excellent for SQL Server, often has [many and significant] opportunities
for improvement in Oracle.

--
Hans Forbrich
Canada-wide Oracle training and consulting
mailto: Fuzzy.GreyBeard_at_gmail.com
*** Top posting [replies] guarantees I won't respond. ***
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-25-2008, 03:48 AM
Jim Kennedy
 
Posts: n/a
Default Re: Some Lateral thinking Required - Hard-Coded instance workaround


"HansF" <News.Hans@telus.net> wrote in message
newsan.2006.04.18.01.37.20.699481@telus.net...
> On Mon, 17 Apr 2006 18:48:04 -0700, Jim Kennedy wrote:
>
> >>

> > Which gives a good reason why off shoring is not a bright idea. But I

am
> > sure you already knew that. Clearly these aren't talented or seasoned
> > application developers. All that money that was "saved" by off shoring
> > comes back to haunt one.

>
> With all due respect - one can get the same lack of talent without going
> offshore.
>
> Or worse - one can get seasoned talent in other environments who know
> even less in the target environment than the off shore groups.
>
> I can't count the times I've followed 'SQL experts' who were actually
> 'SQLServer' experts with no knowledge of Oracle. The code, while probably
> excellent for SQL Server, often has [many and significant] opportunities
> for improvement in Oracle.
>
> --
> Hans Forbrich
> Canada-wide Oracle training and consulting
> mailto: Fuzzy.GreyBeard_at_gmail.com
> *** Top posting [replies] guarantees I won't respond. ***


Absolutely true. I've just been hearing a lot of off shore complaints vis a
vis this type of thing. But you are very correct.
Jim


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-25-2008, 03:49 AM
hpuxrac
 
Posts: n/a
Default Re: Some Lateral thinking Required - Hard-Coded instance workaround

HansF wrote:
> I can't count the times I've followed 'SQL experts' who were actually
> 'SQLServer' experts with no knowledge of Oracle. The code, while probably
> excellent for SQL Server, often has [many and significant] opportunities
> for improvement in Oracle.


Is the emphasis on "while probably"?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-25-2008, 03:49 AM
DA Morgan
 
Posts: n/a
Default Re: Some Lateral thinking Required - Hard-Coded instance workaround

Johne_uk wrote:
> Thanks for the replies guys.
>
> I've just found out that the app uses a connection string (no tnsnames)
> so that rules out using tnsnames.The orany1 database is going to be
> scrapped and rebuilt again in the future so the option of connecting to
> orany2 and using db link / synonyms to point to orany1 cannot be used
> (good idea though). Our development is done offshore and we would be
> charged for these changes which is not worth it for the short time we
> need to relocate the app. I agree its bad practise and I believe none
> of other others apps have hard-coded references.
>
> I did trying connecting directly to orany2 and creating synonyms that
> reference table@orany2 for any reference to table@orany1 in the code
> but it refuses to work.
>
> Thanx again
> John


Charged? I would tell the off-shore hackers that they delivered a
defective product and that if they don't make good there are plenty
of other two-bit hackers to choose from. In short ... fix it now and
fix it for free or you are fired. They'll fix it. Then find another
someone else to work with in the future. One can only wonder at the
number of other bad-practices they wrote into their app.
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:25 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com