05.11.2015 Views

Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 1 ■ DEVELOPING SUCCESSFUL ORACLE APPLICATIONS 9<br />

How (<strong>and</strong> How Not) to Develop <strong>Database</strong><br />

Applications<br />

So far, I’ve described the importance of underst<strong>and</strong>ing the database in a fairly anecdotal<br />

manner. In the remainder of this chapter, I’ll take a more empirical approach, discussing<br />

specifically why knowledge of the database <strong>and</strong> its workings will definitely go a long way<br />

toward a successful implementation (without having to write the application twice!). Some<br />

problems are simple to fix as long as you underst<strong>and</strong> how to find them. Others require drastic<br />

rewrites. One of the goals of this book is to help you avoid problems in the first place.<br />

■Note In the following sections, I discuss certain core <strong>Oracle</strong> features without delving into exactly what<br />

these features are <strong>and</strong> all of the ramifications of using them. I will refer you either to a subsequent chapter<br />

in this book or to the relevant <strong>Oracle</strong> documentation for more information.<br />

Underst<strong>and</strong>ing <strong>Oracle</strong> Architecture<br />

Recently, I was working with a customer running a large production application. This application<br />

had been “ported” from SQL Server to <strong>Oracle</strong>. I enclose the term “ported” in quotes<br />

simply because most ports I see are of the “what is the minimal change we can make to have<br />

our SQL Server code compile <strong>and</strong> execute on <strong>Oracle</strong>” variety. To port an application from one<br />

database to another is a major undertaking. The algorithms should be examined in detail to<br />

see if they work correctly in the target database; features such as concurrency controls <strong>and</strong><br />

locking mechanisms work differently in different databases, <strong>and</strong> this in turn affects the way<br />

the application will function in different databases. The algorithms should also be looked at to<br />

see if there is a sensible way to implement them in the target database. The applications that<br />

result from a minimal “port” are, frankly, the ones I see most often because they are the ones<br />

that need the most help. Of course, the opposite is equally true: taking an <strong>Oracle</strong> application<br />

<strong>and</strong> just plopping it on top of SQL Server with as few changes as possible will result in a problematic<br />

<strong>and</strong> poorly performing application.<br />

In any event, the goal of this “port” was to scale up the application to support a larger<br />

installed base of users. However, the customer wanted to achieve this aim with as little work as<br />

humanly possible. So, the customer kept the architecture basically the same in the client <strong>and</strong><br />

database layers, the data was moved over from SQL Server to <strong>Oracle</strong>, <strong>and</strong> as few code changes<br />

as possible were made. The decision to impose on <strong>Oracle</strong> the same application design as was<br />

used on SQL Server had grave consequences. The two most critical ramifications of this decision<br />

were as follows:<br />

• The connection architecture to the database was the same in <strong>Oracle</strong> as it was in<br />

SQL Server.<br />

• The developers used literal (nonbound) SQL.<br />

These two ramifications resulted in a system that could not support the required user<br />

load (the database server simply ran out of available memory), <strong>and</strong> abysmal performance for<br />

the set of users that could log in <strong>and</strong> use the application.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!