36
www.PowerBuilderJournal.com P OWER B UILDER V ERSION 9.0 U.S. $15.00 (CANADA $16.00) PowerBuilderJournal.com Focus: Secure Your Passwords Berndt Hamboeck Use cryptography to provide functionality in your apps 6 PBDJ Feature: The PowerBuilder Bill Green Integrated Development Environment Understanding the IDE 12 Book Excerpt: Dynamically Creating Bob Hendry DataWindow Objects It’s easier than you think d 16 Nonstandard Data Model: rGlynn Naughton Hierarchical Data Reduce coding changes 20 Portals & Portlets: Sybase Enterprise Berndt Hamboeck Portal Evaluation Version Provides a single, secure, browser-based interface PART 1 24 Components: NVOs and Jerry Neppl NVCs What’s the difference? 28 From Sybase: Got Code? Jessica Bronesky Want Code? Come to the source 30 Enterprise Application Studio APRIL 2003 - Volume: 10 Issue: 4 RETAILERS PLEASE DISPLAY UNTIL JUNE 30, 2003 $15.00US $16.00CAN Education: A Process or a Pill by Bob Hendry pg. 4 From the Co-editors PB9 En Route by John D. Olson pg. 3 Industry Announcements by Bruce Armstrong pg. 34 NVC nvo nvo NVC nvo nvo MULTI-PACK ORDER SUBSCRIBE TODAY and get up to 3 FREE CDs! SEE DETAILS ON PAGES 32 & 33 SAVE UP TO $400 (WHILE SUPPLIES LAST)

POWERBUILDER V 9 - SYS-CON · PDF filePOWERBUILDER DEVELOPER’S JOURNAL (ISSN#1078-1889) is published monthly (12 times a year) for $149 by SYS-CON Publications, Inc.,135 Chestnut

  • Upload
    haphuc

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

www.PowerBuilderJournal.com

POWERBUILDER VERSION 9.0U.S. $15.00 (CANADA $16.00)PowerBuilderJournal.com

Focus: Secure Your Passwords Berndt Hamboeck Use cryptography to provide functionality in your apps 6

PBDJ Feature: The PowerBuilder Bill Green

Integrated Development Environment Understanding the IDE 12

Book Excerpt: Dynamically Creating Bob Hendry

DataWindow Objects It’s easier than you think d 16

Nonstandard Data Model: rGlynn Naughton

Hierarchical Data Reduce coding changes 20

Portals & Portlets: Sybase Enterprise Berndt Hamboeck

Portal Evaluation Version Provides a single, secure, browser-based interface PART 1 24

Components: NVOs and Jerry Neppl

NVCs What’s the difference? 28

From Sybase: Got Code? Jessica Bronesky

Want Code? Come to the source 30

Enterprise Application Studio APRIL 2003 - Volume: 10 Issue: 4

RETAILERS PLEASE DISPLAY UNTIL JUNE 30, 2003

$15.00US $16.00CAN

Education: A Process or a Pill

by Bob Hendry pg. 4

From the Co-editors PB9 En Route

by John D. Olson pg. 3

Industry Announcementsby Bruce Armstrong pg. 34

0 09281 03424 7

0 4

NVC

nvonvo

NVC

nvo nvo

MULTI-PACK ORDER

SUBSCRIBE TODAYand get up to 3 FREE CDs!

SEE DETAILS ON PAGES 32 & 33

SAVE UP TO $400(WHILE SUPPLIES LAST)

2 www.POWERBUILDERJOURNAL.comPBDJ volume10 issue4W W W. S Y S - C O N . C O M

Amyuni Technologies, Inc.www.amyuni.com

3www.POWERBUILDERJOURNAL.com PBDJ volume10 issue4

E D I T O R I A L A D V I S O R Y B O A R DBRUCE ARMSTRONG, MICHAEL BARLOTTA, ANDY BLUM,

RICHARD BROOKS, KOUROS GORGANI, BAHADIR KARUV, PH.D.,BERNIE METZGER, JOHN OLSON, SEAN RHODY

COEDITOR-IN-CHIEF: JOHN OLSONCOEDITOR-IN-CHIEF: BOB HENDRYEXECUTIVE EDITOR: NANCY VALENTINEASSOCIATE EDITOR: JAMIE MATUSOW ASSOCIATE EDITOR: GAIL SCHULTZ ASSOCIATE EDITOR: JEAN CASSIDYASSOCIATE EDITOR: JENNIFER STILLEY

ONLINE EDITOR: LIN GOETZTECHNICAL EDITOR: BERNIE METZGER

NEWS EDITOR: BRUCE ARMSTRONGDATAWINDOWS EDITOR: RICHARD BROOKS

W R I T E R S I N T H I S I S S U EBRUCE ARMSTRONG, JESSICA BRONESKY, BILL GREEN, BERNDT HAMBOECK,

BOB HENDRY, GLYNN NAUGHTON, JERRY NEPPL, JOHN D. OLSON

S U B S C R I P T I O N SFOR SUBSCRIPTIONS AND REQUESTS FOR BULK ORDERS,

PLEASE SEND YOUR LETTERS TO SUBSCRIPTION DEPARTMENT

SUBSCRIPTION HOTLINE: 888 303-5282COVER PRICE: $15/ISSUE

DOMESTIC: $149/YR. (12 ISSUES) CANADA/MEXICO: $169/YR.OVERSEAS: BASIC SUBSCRIPTION PRICE PLUS AIRMAIL POSTAGE

(U.S. BANKS OR MONEY ORDERS). BACK ISSUES: $12 U.S., $15 ALL OTHERS

PRESIDENT AND CEO: FUAT A. KIRCAALIVICE PRESIDENT, BUSINESS DEVELOPMENT: GRISHA DAVIDA

SENIOR VP, SALES & MARKETING: CARMEN GONZALEZPRODUCTION CONSULTANT: JIM MORGAN

VICE PRESIDENT, SALES & MARKETING: MILES SILVERMANACCOUNTS RECEIVABLE KERRI VON ACHEN

FINANCIAL ANALYST: JOAN LAROSEACCOUNTS PAYABLE: BETTY WHITE

ADVERTISING DIRECTOR: ROBYN FORMAADVERTISING ACCOUNT MANAGER: MEGAN RING-MUSSA

ASSOCIATE SALES MANAGER: CARRIE GEBERTASSOCIATE SALES MANAGER: ALISA CATALANOASSOCIATE SALES MANAGER: KRISTIN KUHNLE

PRESIDENT, EVENTS: GRISHA DAVIDACONFERENCE MANAGER: MICHAEL LYNCH

ART DIRECTOR: ALEX BOTEROASSOCIATE ART DIRECTOR: LOUIS F. CUFFARIASSOCIATE ART DIRECTOR: RICHARD SILVERBERGASSISTANT ART DIRECTOR: TAMI BEATTY

VICE PRESIDENT, INFORMATION SYSTEMS: ROBERT DIAMONDWEB DESIGNER: STEPHEN KILMURRAYWEB DESIGNER: CHRISTOPHER CROCE

SENIOR CUSTOMER CARE/CIRCULATION SPECIALIST: NIKI PANAGOPOULOS JDJ STORE: RACHEL MCGOURAN

E D I T O R I A L O F F I C E SSYS-CON MEDIA

135 CHESTNUT RIDGE ROAD, MONTVALE, NJ 07645TELEPHONE: 201 802-3000 FAX: 201 782-9600

[email protected]

POWERBUILDER DEVELOPER’S JOURNAL (ISSN#1078-1889) is published monthly (12 times a year) for $149 by

SYS-CON Publications, Inc.,135 Chestnut Ridge Rd., Montvale, NJ 07645 Periodicals Postage rates are paid at

Montvale, NJ 07645 and additional mailing offices.POSTMASTER: Send address changes to:

POWERBUILDER DEVELOPER’S JOURNAL, SYS-CON Publications, Inc.,135 Chestnut Ridge Rd., Montvale, NJ 07645

© C O P Y R I G H TCopyright © 2003 by SYS-CON Publications, Inc. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or by anymeans, electronic or mechanical, including photocopy or any information storage andretrieval system, without written permission. For promotional reprints, contact reprint coordinator Carrie Gebert. SYS-CON Publications, Inc., reserves the right to revise,republish and authorize its readers to use the articles submitted for publication.

All brand and product names used on these pages are trade names,service marks or trademarks of their respective companies.

SYS-CON Publications, Inc., is not affiliated with the companies or products covered in PowerBuilder Developer’s Journal.

JOHN D. OLSON, EDITOR-IN-CHIEF

F R O M T H E C O - E D I T O R

[email protected] BIO

John D. Olson is principal of Developower, Inc., a consulting company specializing in software solutions using Sybasedevelopment tools. A CPD professional and charter member of TeamSybase, he is a coauthor of SYS-CON’s Secrets

of the PowerBuilder Masters books, and co-editor and author of two upcoming PB9 books.

PB9 En RoutePBNI tears down the barriers

The availability of PowerBuilder 9 was announced March 4 and the release was made avail-able March 24. If you have an upgrade subscription or have prepurchased a copy, thenyou’ve probably already received it by the time you read this. I have the beta version, but

haven’t yet received the official final copy, though I’m currently watching my mailbox in hope-ful anticipation of an imminent delivery. When I receive it, I’ll put it to good use right away. Idon’t know what you’re doing with PowerBuilder, but for what I’m doing, the new PB9 featuresare great!

Allow me to put on my client/server hat and tell you what I like about PB9. PBNI! The sec-ond best thing is PBNI, and third, PBNI! In my opinion, for client/server development thePowerBuilder Native Interface is the single biggest advancement to PowerBuilder since theNVO was introduced with version 4 back in 1994. Until PB9, PowerBuilder could call functionsin external DLLs, but that functionality was limited by issues such as the inability to executecallbacks. That severely restricted the interoperability of PB with C/C++ and meant the exter-nal functions could be called, but as resources without full two-way communication capabil-ities.

To achieve interaction with externals, OLE was used, but it has its own limitations. In a sim-ilar way, other languages were unable to fully interact with PB objects because they could onlycall PB via OLE. There was no ability to directly call PB objects in the same way a function ina C DLL would call a function in another C DLL. Of course, that meant it was impossible for aC++ class to be inherited from a PB class. Those inadequate capabilities severely limited theuse of PowerBuilder in hybrid systems, which most systems are.

With PB9 and PBNI the gates are flung wide open. The limitations and restrictions men-tioned above have been eliminated. Here’s what Roy Kiesler, the expert on PBNI, has to sayabout it in the book PowerBuilder: Advanced Client/Server Development, edited by BruceArmstrong and Millard Brown: “Since its inception, PBNI has gained remarkable popularitywithin Sybase; PowerBuilder 9.0 ships with many new features, three of which – EJB client,Web services client, and the PBDOM XML parser – are PBNI implementations. Those, howev-er, are merely the tip of an iceberg; the promise of PBNI can lead PowerBuilder programmersto new frontiers like Microsoft .NET, and has the potential to establish PowerBuilder as a newcomponent model, alongside Microsoft’s COM and Borland’s VCL.”

PBNI is a C++ type programming interface modeled after the Java Native Interface (JNI),and allows other languages to interact with PB like they do with C++. So PB now has the inter-operability power of C++! Certainly this is a great addition to client/server development, butWeb/n-tier developers also have a lot to gain, as is obvious since the EJB client, Web servicesclient, and PBDOM XML parser are all based on PBNI.

Bruce Armstrong says, “This has the potential to do for PowerBuilder what VBX controls didfor Visual Basic.”

PBNI tears down the few barriers that have kept PowerBuilder from being fully integratedas an open tool in hybrid systems. It brings PowerBuilder into the mainstream and puts it onan equal technical footing with C/C++, while increasing its 4GL advantage over the othertools. As with NVOs, the full capabilities of PBNI and the way it will be used won’t be fullyknown until developers start using it. Maybe it will result in a whole new generation of appli-cation architectures, like the implementation of NVOs did. ▼

4

F R O M T H E C O - E D I T O R

Being an inquisitive teacher I’malways searching the Web lookingfor educational offerings. For thepast 10 years I’ve made my living

teaching at a university.When class is not in session, I take my

show on the road and visit trainingrooms throughout corporate America.

Like most paranoid teachers, I’malways making sure my course materialis relevant and fresh; don’t want to beteaching classes such as “XML andPunch Cards” or “The UNIVAC and You,”so I visit other schools and training cen-ters to see what they’re up to. Over thepast year, I have found an alarmingtrend in how courses are marketed.

One morning I was on the Web look-ing at all the XML offerings at varioustraining centers. After about an hour, aclear pattern started to emerge. I call it“tier” marketing. Some training centerswere marketing the same courses pack-aged as “good,” “better,” and “best” ver-sions. Of course, the “best” courses weremore expensive but, wow, do you getmore material – or so they say. I calledone training center and asked for a moredetailed syllabus of their “best” XMLtraining course. Five minutes later Ireceived an e-mail that contained somany topics I almost fell off my chair. Bymy estimation, covering all those topicswould take weeks, not 40 hours.

Shocked, I called the center back formore info. I was told that all topics areexplained “thoroughly and comprehen-sively” and that the course was “acceler-ated and not for the faint of heart.” Heranswers flew in the face of logic – but arewhat potential students want to hear.

‘Be an Expert in One Week!’Come on. How can anyone be an

expert in anything in one week? I juststarted taking piano lessons. So far I’m

six weeks into it and still have to practicewhile my family is out of earshot. I’mbad, really bad. However, that doesn’tmean I won’t be good some day. Withinstruction and practice (yes, I saidpractice) I could be playing CarnegieHall some day – okay, maybe a VFW hall.

Courses are starting to be marketedlike amusement park thrill rides. The“good” class is the merry-go-round,while the “best” class is the roller coast-er – very clever marketing. Which ridedo you want to go on?

This approach is doomed from thestart. I can only imagine the folks whofork out thousands to sit in a class wait-ing for the magic to happen. Maybe theinstructor passes out a pill on the firstday (stay away from the Kool-Aid)? Withsuch unrealistic expectations, give yourmoney to a faith healer or a televisionevangelist.

The problem is that more realistictraining centers and schools have tocompete with this. More and moreteachers and curriculum developers arepressured to fit more material into lesstime. That’s what people are paying for.After all, who wants to buy “SevenMinute Abs” when you can buy “SixMinute Abs”? It’s become almost absurd.

Corporate vs Academic Training

Once you decide on a realistic course,be aware of the differences between theformat of a corporate training centerand an academic institution. A corpo-rate training course usually takes placeduring regular business hours. Thecourse material is usually a binderrather than a book, and the course ispretty much scripted from start to fin-ish. After completion of the course, youwill receive a “certificate” rather than agrade.

On the other hand, academic institu-tions meet on a schedule that includesevenings and weekends. The coursematerial is usually a book complement-ed with class handouts. Since there istime between classes, the course con-tent can be modified to fit the studentbody. At the end of the course you’regiven a grade.

Which one suits you? It depends. Inmost cases, if your employer will reim-burse the cost of the course, you gowhere they tell you. If the location is upto you, use the following guidelines.

If you’re a quick learner and need lit-tle or no time to absorb contentbetween classes, corporate training isfor you. On the flip side, if you need timeto absorb the lessons and like a timecushion between classes – go back tocollege. Keep in mind that corporatetraining is usually more expensive thana college course.

Is one better than the other? Not real-ly. Corporate training centers probablydon’t want you to know that many oftheir instructors trade their suit for apair of jeans and a T-shirt at 5:00, thendrive off to a local community college toteach the same course.

Final ThoughtsWhere is the magic in training?

Believe it or not, it’s in you the student.Take all the variables that go into learn-ing a skill: teacher, course material, fac-ulty, and curriculum. To the surprise ofmany, chances of success or failure restsquarely on the shoulders of the stu-dent. All other factors are the supportinginfrastructure in the learning world.Taking a class at a training center orlocal university is a great self-invest-ment. Keep in mind that knowledge isinstruction and practice over a period oftime. Education is a process, not a pill.▼

[email protected]

PBDJ volume10 issue4 www.POWERBUILDERJOURNAL.com

WRITTEN BYBOB HENDRY

AUTHOR BIOBob Hendry is a PowerBuilder instructor for Envision Software Systems and a frequent speaker at national and international PowerBuilder conferences. He specializes in

PFC development and has written two books on the subject, including Programming with the PFC 6.0.

Education: A Process or a Pill

5www.POWERBUILDERJOURNAL.com PBDJ volume10 issue4

Sybase, Incwww.sybase.com/powerbuilder

www.POWERBUILDERJOURNAL.com6 PBDJ volume10 issue4

As architects of enterprise systems, we

know that security should always be a

concern when we transfer or store

sensitive data. In the past, you might

have cut corners because you assumed the

corporate LAN provided some implicit level

of protection. You might have rationalized

that because only people with access to the

LAN could see data being transferred across

the wire – and surely no one at your compa-

ny would try to steal sensitive data – your

data was secure. Likewise, your internal

applications might not have been passing

sensitive information and you leveraged

password protection on the operating system.

Although corporate LANs, corporate WANs,and intranets might provide adequate securityfor some applications, many applications arenow deployed across wide-area public networkssuch as the Internet. The danger is that alongwith the ease of accessibility to these public net-works comes, potentially, lots of prying eyes.Protecting sensitive data in this environmentisn’t an option – it’s a requirement. If you exposesomeone’s password or credit card informationto an unauthorized source, you could incurlegal action and lose customers and business.

The solution is for us to use cryptography.Cryptography, the science of information secu-

rity, can address many ofthe issues associated withapplications that handle sen-sitive data. Namely, it canprevent unauthorized persons from reading thedata. There are many topics related to cryptog-raphy – enough to fill several books.

In this article, I’ll examine three useful cryp-tographic techniques: hashing, encryption,and decryption. I’ll discuss how each tech-nique can improve application security andhow to implement each technique inPowerBuilder.

The Simple Password ModelThe simple password model illustrates the

fundamental concepts behind password-based security. A password entered by a user iscompared with a password stored on a systemor in an executable file. If the passwordsmatch, a secured operation is permitted.

Implementing the most popular approachto secured functionality – requiring the user toenter a password and enabling functionalityonly if the password is valid – is straightfor-ward in PowerBuilder. I called this functionof_comparepwd, and it takes an argumentthat’s the password entered by the user.Depending on the value of the parameter, wecould enable different functionality in ourapplication (see Listing 1).

Although it’s obviously a poor approachfrom a security perspective and very easy to

break (you might have used the IDA Pro disas-sembler already to look at string referencesfrom dlls or executables, but here evenNotepad [see Figure 1] would be enough tobreak the “security”), you might have seen thisapproach in older applications like sharewareor demo software; you also might have seenthat passwords have been read from a file ordatabase (a scenario common in applicationsthat support multiple users, such as databasesor e-mail clients) and have been sent back tothe client.

This brings us to the next problem: trans-mitting a password in clear text. Eaves-dropping on a TCP/IP network can be carriedout very easily and effectively against protocolsthat transmit passwords in the clear. To defeatthis simple sniffing attack (sometimes I use myiPaq with CENiffer running and check aroundour network to see if there’s anything wrongwith our security in-house), we have to look atsomething different.

The Crypto APIThe Microsoft Crypto API (CAPI) is a core OS

service that’s been shipping with Windowssince Windows 95 OSR2. It’s the API used byMicrosoft to develop applications using cryp-

F O C U S

WRITTEN BY BERNDT HAMBOECK

7PBDJ volume10 issue4www.POWERBUILDERJOURNAL.com

tography, and any third party can use it onWindows for free. The documentation andlibraries for CAPI are available as part of theMicrosoft Developer Network (MSDN) as wellas on their Web site: http://msdn.microsoft.com/librar y/default .asp?url=/l ibrar y/en-us/security/security/cryptography_functions.asp.

Among the benefits to CAPI are:• Algorithm independence: An application

can change cryptographic algorithms with-out having to rewrite the code.

• Device independence: Applications writtento CAPI can use software- or hardware-based crypto tokens without having torewrite code.

• Single store for certificates and softwarekeys: This allows a user to use the same cer-tificate and keys in a variety of applicationswithout forcing the user to export and importthem between applications or toolkits.

• Built-in support for revocation checkingand complex certificate chain building: Allthe logic is built into the API; applicationsneed only request revocation services orchain building and the OS does the work.

The Microsoft Crypto API can be accessedas a C language API, which makes it easy for usto access it. We simply have to declare the con-stants and external functions we’d like to use(see Listing 2).

START HASHING YOUR DATAOne of the first things we have to under-

stand if we want to use the crypto API is hash-ing. A hash is simply a “summary,” or “tag,”that’s generated from a digital document (abinary string) using a mathematical rule oralgorithm. It’s designed so that a small changein the document would produce a big changein the hash. As an example I created a hash fortwo different strings:

Hash for the String ‚ testhash1‘:

5616C9510E126363E8859F6B1D8E1334

Hash for the String ‚ testhash2‘:

F20C24485F0D57FAE87253C45E34846C

Keep in mind that you could create a hashvalue from a string or document, but that youcannot get back (in a reasonable amount oftime) the string or document from a hashvalue. A hash is often smaller than the originalstring (an exception is a small word like theone we used in our example) and, as we cansee, it’s generally unreadable by humans.Hashes are also used to check the integrity offiles and documents, and are also often used indigital signature algorithms. We could use thehashed value to compare it against the valuethe user entered (which is hashed through thesame algorithm). You might think of writingyour own hashing algorithm, but before youstart consider what a good hashing algorithmshould provide:• A small change in the document should pro-

duce a large change in the hash; notice inour previous example where a tiny changein the string produced two totally differenthashes.

• Hashes should not be predictable. In otherwords, I should not be able to guess thatchanging the binary string will have a spe-cific effect on the hash.

• Hashes should not collide, and it should becomputationally difficult to find collisions.In other words, two binary strings shouldhave an infinitesimal chance of having thesame hash, and it should be virtually impos-sible to find a document that has the samehash as a known document.

• Hashing should be fast. Even if we enhanceour application to use hashing, there should-n’t be a negative impact on our application.

Why not use something that already exists?There are already some good hashing algo-rithms out there: MD2, SHA, SHA-1, and MD5are well known (just to name a few). We’llprobably move to SHA-1, which is the US. gov-ernment–approved hashing algorithm, overthe next year or two.

At first we call the CryptAcquireContext func-tion, which is used to acquire a handle to a par-ticular key container within a particular crypto-graphic service provider (CSP) (see Listing 3).This returned handle is used in calls toCryptoAPI functions that use the selected CSP.

The CryptCreateHash function initiates thehashing of a stream of data. We pass as a para-meter the hashing algorithm we’d like to use.In Listing 3 we use MD5, but feel free to giveanother algorithm a try. For example, youmight use SHA-1. The function creates a han-dle to a CSP hash object and returns it to thecalling application. This handle is used in callsto CryptHashData to hash session keys andother streams of data.

The CryptGetHashParam function retrievesdata that governs the operations of a hashobject. We use it to read back the hash value. Atthe end we convert the hashed password to ahex string, which we display in theMessageBox. We could use this string to verifyan entered password.

REMOTE AUTHENTICATIONThe two examples you’ve seen so far involve

local management and verification of pass-words. This is fine, if only your application is

involved in checking the password, but this isnot often the case in the enterprise. Think of abigger application where a lot of differentback-end systems are involved, every one hav-ing its own authentication. Even if we move tomore EAServer development in our enterprisewhere we integrate a lot of different back-endsystems, we have to authenticate ourselvesagainst the EAServer components. Even if weuse the hashed password approach I describedearlier, the remote password model suffersfrom several new security flaws, unless youcan somehow guarantee the security of theconnection between the local and remote sys-tems. These flaws are that it transmits thepassword and the username to the remoteobject in plain text, and/or it returns theauthentication result in plain text.

Let’s think a bit differently. How would it beif clients could authenticate without sending apassword? I think it’s certainly hard to steal apassword that’s never transmitted, isn’t it?

How do you go about verifying a passwordwithout seeing it?

ENCRYPT/DECRYPT YOUR DATATo tell you the truth, this is nothing new. The

approach we’ll be looking at is the same oneWindows uses to authenticate users ondomains, or Sybase Enterprise Portal uses toauthenticate its users. The CryptDeriveKeyfunction from the cryptographic API generatescryptographic session keys derived from abase data. This function guarantees that whenthe same cryptographic service provider andalgorithms are used, the keys generated fromthe same base data are identical. The base datacan be a password or any other (random) userdata. This means that if we use this functionwith exactly the same base data, we would getexactly the same hashed value on the serverside and the client side. On the server side thishashed value could be stored in a database, apassword file, or any other system (LDAP).

If a user enters a password, we generate thehashed version and then both the local andremote systems would have exactly the samehashed version of the password.

Now we need a way to compare the twopasswords without actually sending the pass-word between the two systems: the client gen-erates a random block of data that it encryptsusing a key derived from the hashed password(see Figure 2). The client sends the random

FIGURE 1 Password sniffing using Notepad

8 PBDJ volume10 issue4 www.POWERBUILDERJOURNAL.com

block, along with user identification, to theremote verification computer. That machineretrieves the known hashed password for thespecified user and encrypts the random blockof data (the same random data that the clientused) using a key derived from that hashedpassword. It then sends the encrypted databack to the client application.

The client application now has two encrypt-ed blocks of data. If the two passwords (the onethe client entered and the one that was storedon the server) match, the two encrypted datablocks will match as well, meaning the pass-word is correct and the operation can proceed.Keep in mind that the used random data has tobe the same on both the client and the serverside. You could use EAServer to generate thisrandom set of data and, just before you starthashing, get this value from a component.

The source code to encrypt a string wouldlook like:

ls_encrypted = lnv_crypt.EncryptData("my

sensitive data" , "SecretKey")

where ls_encrypted is the encrypted data wewould pass to the server.

To decrypt a string on the remote computerwe would use:

ls_decrypted =

lnv_crypt.DecryptData(is_crypted ,

"SecretKey")

where ls_decrypted holds the original date.The functions could be implemented in one

function (see Listing 4). The only difference is,if we want to encrypt or decrypt:

of_encryptdecrypt(String data, String pass-

word, boolean encrypt)

Unless you’re using an application thatrequires a lot of bandwidth, most computerscan easily handle encrypting all data trans-ferred over the network without causing major

performance problems. If you’re using a high-bandwidth application, you might want toconsider purchasing a crypto accelerator cardfor your machine to allow it to encrypt all of itsdata, for example.

You can download a complete user objectfor PowerBuilder where all the encrypt anddecrypt functions are implemented fromw w w. s y s - c o n . c o m / p b d j / s o u rc e c . c f m ,www.rgagnon.com/pbdetails/pb-0170.html,or from www.pocketpb.com.

ConclusionIn its simplest form, password protec-

tion is highly insecure because it intro-duces fairly easy ways for unauthorizedusers to obtain valid passwords.Cryptography is the extra ingredient youneed to secure functionality in your appli-cations. We’ve seen how to add basic pass-word protection to PowerBuilder applica-tions and how to use Microsoft’s CryptoAPI to make that protection secure,whether you implement local or remotepassword authentication.

The challenge/response password modelimproves security dramatically by eliminat-ing the need to transmit the password in anyform between the local and remote systems.Instead, your program uses the password toderive an encryption key that’s used toencrypt a random block of data. If both theclient and server obtain the same resultwhen encrypting the random data with thepassword they have, the passwords mustmatch.▼

AUTHOR BIOBerndt Hamboeck is a senior consultant for BHITCON. He’s a CSI,SCAPC8, EASAC, and SCJP2 and started his Sybase developmentusing PB5.

FIGURE 2 Password comparison

[email protected]

Boolean lb_PasswordValid

Choose Case as_passwordCase "Password1"lb_PasswordValid = TRUE

Case "Password2"lb_PasswordValid = TRUE

Case elselb_PasswordValid = FALSE

End Choose

IF lb_PasswordValid THEN/* enable functionality */ELSEMessageBox("Error", "Invalid Password")END IF

return lb_PasswordValid

Function ulong CryptAcquireContext &(Ref ulong phProv, &String pszContainer, &String pszProvider, &ulong dwProvType, &ulong dwFlags) Library "advapi32.dll" Alias For

"CryptAcquireContextA"

Function ulong CryptGetProvParam &(ulong hProv, &ulong dwParam, &Ref Blob pbData, &Ref ulong pdwDataLen, &ulong dwFlags) Library "advapi32.dll" Alias For

"CryptGetProvParam"

Function ulong CryptCreateHash &(ulong hProv, &ulong Algid, &ulong hKey, &ulong dwFlags, &Ref ulong phHash) Library "advapi32.dll" Alias For

"CryptCreateHash"

Function ulong CryptHashData &(ulong hHash, &ref String pbData, &ulong dwDataLen, &ulong dwFlags) Library "advapi32.dll" Alias For

"CryptHashData"

Function ulong CryptDeriveKey &(ulong hProv, &ulong Algid, &ulong hBaseData, &ulong dwFlags, &Ref ulong phKey) Library "advapi32.dll" Alias For

"CryptDeriveKey"

Function ulong CryptDestroyHash &(ulong hHash) Library "advapi32.dll" Alias For

Listing 2

Listing 1

9PBDJ volume10 issue4www.POWERBUILDERJOURNAL.com

Sybase, Incwww.sybase.com/pbextension

www.POWERBUILDERJOURNAL.comPBDJ volume10 issue410

"CryptDestroyHash"

Function ulong CryptEncrypt &(ulong hKey, &ulong hHash, &ulong Final, &ulong dwFlags, &Ref string pbData, &Ref ulong pdwDataLen, &ulong dwBufLen) Library "advapi32.dll" Alias For

"CryptEncrypt"

Function ulong CryptDestroyKey &(ulong hKey) Library "advapi32.dll" Alias For"CryptDestroyKey"

Function ulong CryptReleaseContext &(ulong hProv, &ulong dwFlags) Library "advapi32.dll" Alias For

"CryptReleaseContext"

Function ulong CryptDecrypt &(ulong hKey, &ulong hHash, &ulong Final, &ulong dwFlags, &Ref String pbData, &Ref ulong pdwDataLen) Library "advapi32.dll" Alias For

"CryptDecrypt"

Function Long CryptGetHashParam &( uLong hhash, &

uLong dwParam, &ref Blob pbData, &

ref uLong dwDataLength, &uLong dwFlags) Library "advapi32.dll" Alias for"CryptGetHashParam"

string Password = "testpwd"

Blob lblb_hashuLong lul_bloblen

lblb_hash = Blob(Space(20))lul_bloblen = Len(lblb_hash)

String ls_hashedChar lc_hash[]Long ll_fromString ls_HexHashData

ulong hCryptProvulong lLengthString sTempulong hHashulong hKeyuLong lenLong ret

string ls_ret

// Get handle to CSPIf CryptAcquireContext(hCryptProv, KEY_CONTAINER,SERVICE_PROVIDER, PROV_RSA_FULL, CRYPT_NEWKEYSET) = 0 Then

If CryptAcquireContext(hCryptProv, KEY_CONTAINER, SER-VICE_PROVIDER, PROV_RSA_FULL, 0) = 0 ThenMessageBox("DEBUG", "Error during CryptAcquireContext for

a new key container." + "~r~n" + &"A container with this name probably already exists.")RETURN ""End If

End If

// Create a hash object.ret = CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, hHash)If ret = 0 Then

MessageBox("DEBUG", "Error during CryptCreateHash!")End If

// Hash the password.len = Len(Password)ret = CryptHashData(hHash, Password, len, 0)If ret = 0 Then

MessageBox("DEBUG", "Error during CryptHashData.")End If

// And convert the hash into hex for ease of// viewing and comparison in this particular example.

// Create a hash object.If CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, hHash) = 0Then

MessageBox("DEBUG", "Error during CryptCreateHash!")End If

// Hash the password.len = Len(Password)If CryptHashData(hHash, Password, len, 0) = 0 Then

MessageBox("DEBUG", "Error during CryptHashData.")End If

// Get the hash valueIF CryptGetHashParam(hhash, HP_HASHVAL, lblb_hash,lul_bloblen, 0) = 0 THEN

MessageBox("DEBUG", "Error during CryptGetHashParam.")End If

ls_hashed = Left(String(lblb_hash), lul_bloblen)

for ll_from = 1 to Long(lul_bloblen)lc_hash[ll_from] = Mid(ls_hashed, ll_from,1)ls_HexHashData += f_convert_char_to_hex(lc_hash[ll_from])next

MessageBox("DEBUG: Hashvalue ", ls_HexHashData)

RETURN ls_ret

ulong hCryptProvulong lLengthString sTempulong hHashulong hKeyuLong len

string ls_ret

// Get handle to CSPIf CryptAcquireContext(hCryptProv, KEY_CONTAINER,SERVICE_PROVIDER, PROV_RSA_FULL, CRYPT_NEWKEYSET) = 0 Then

If CryptAcquireContext(hCryptProv, KEY_CONTAINER, SER-VICE_PROVIDER, PROV_RSA_FULL, 0) = 0 ThenMessageBox("DEBUG", "Error during CryptAcquireContext for

a new key container." + "~r~n" + &"A container with this name probably already exists.")RETURN ""End If

End If// --------------------------------------------------------------------// The data will be encrypted with a session key derivedfrom the// password. The session key will be recreated when thedata is decrypted// only if the password used to create the key is avail-able.// --------------------------------------------------------------------

// Create a hash object.If CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, hHash) = 0Then

MessageBox("DEBUG", "Error during CryptCreateHash!")End If

// Hash the password.len = Len(Password)If CryptHashData(hHash, Password, len, 0) = 0 Then

MessageBox("DEBUG", "Error during CryptHashData.")End If

// Derive a session key from the hash object.If CryptDeriveKey(hCryptProv, ENCRYPT_ALGORITHM, hHash, 0,hKey) = 0 Then

MessageBox("DEBUG", "Error during CryptDeriveKey!")End If

// Do the worksTemp = DatalLength = Len(Data)

If Encrypt Then// Encrypt data.If CryptEncrypt(hKey, 0, 1, 0, sTemp, lLength, lLength)

= 0 ThenMessageBox("DEBUG", "Error during CryptEncrypt.")End If

Else// Decrypt data.If CryptDecrypt(hKey, 0, 1, 0, sTemp, lLength) = 0 ThenMessageBox("DEBUG", "Error during CryptDecrypt.")End If

End If

// This is what we return.ls_ret = Mid(sTemp, 1, lLength)

// Destroy session key.If hKey <> 0 Then

CryptDestroyKey(hKey)End If

// Destroy hash object.If hHash <> 0 Then

CryptDestroyHash(hHash)End If

// Release provider handle.If hCryptProv <> 0 Then

CryptReleaseContext(hCryptProv, 0)End If

RETURN ls_ret

Listing 4

Listing 3

11www.POWERBUILDERJOURNAL.com PBDJ volume10 issue4

Sybase www.sybase.com/powerbuilder

12 www.POWERBUILDERJOURNAL.comPBDJ volume10 issue4

For the new book PowerBuilder: AdvancedClient/Server Development, Bill Green hascontributed a chapter dedicated to thePB9 IDE.The IDE has not changed much

from PB8 so he not only covers the new features but also describes important historical details about the IDE and providestips on the best ways to use it.The followingis a small portion of the chapter that I thinkyou’ll find educational.

In this chapter I highlight the changes in theIDE from version 8 to 9, and also dig into theIDE and detail some of the productivityimprovements that are available, but not gen-erally used.

The IDE is a powerful development tool as itputs all kinds of information at your fingertips,but sometimes the amount of informationexceeds its value and becomes clutter thatresults in developers trimming the IDE capa-bilities to an inferior level. When you’re donewith this chapter, you should be able to takeadvantage of the many capabilities that arehidden just beneath the surface.

IDE HistoryPowerBuilder helped coin the term

Integrated Development Environment (IDE).An IDE means you don’t have to go outside theenvironment to perform tasks related to thetool’s function. As an example, if you wrotesome Java code using Notepad, you wouldhave to switch to something else to compilethe Java code. An IDE integrates the compilerand it’s a function of the tool to compile thecode written using that tool. When developing

client/server applications with PowerBuilder,you don’t have to go outside the PowerBuilderenvironment to compile, set up data access,etc. It’s not that you can’t go outside the tool,rather you don’t have to.

PowerBuilder’s IDE did not have any majorchanges through PB6. Sure there were somechanges in menu options, menu icons, andadditional tools and capabilities, but the IDEremained pretty static, except for the debug-ger, which underwent a major facelift withPB6. In PB6, the debugger incorporatedchanges that allowed developers to see moredata at one time. Distinct sets of data were sep-arated into views that could be combined intoa viewing area using a tabbed metaphor. Thisgave developers quick access to all the infor-mation available to the debugger. It was alsovery flexible, allowing developers to set up thedebugger appearance any way they saw fit. Thecombination of maximum flexibility and max-imum data at the same time was quite revolu-tionary then.

THE PB6 DEBUGGERMany things were going on at the time PB6

was released. The PB6 debugger was receivingpositive feedback regarding the data and flexi-bility it provided. Another product, PowerSite,was also getting some good press with its inter-face, which was similar in style and concept.There was also some demand to add Web-building capabilities to PowerBuilder and sur-rounding all of that was the requirement for thePowerBuilder IDE to change from a modal, sin-gle-threaded development environment. PB7was intended to resolve these requirements. It

began with the molding of the developmentenvironment to match the debugger environ-ment – display maximum data with maximumflexibility. The main purposes were threefold:1. Eliminate modal dialogs.2. Give developers access to as much data as

they want.3. Establish a highly customizable develop-

ment environment.

Another targeted feature was building a founda-tion for combined IDEs. At the time, several differ-ent IDEs were available to perform different tasks,such as HTML and Java development. Each prod-uct had its own IDE, and each IDE had its own set offeatures. The problem was that having multiple“Integrated Development Environments” defeatedthe purpose, so the effort was made to standardizean IDE feature set that would be common to thethree in order to move toward having one truly“integrated” development environment. What wehave today is the result of that effort: developers cantruly develop PowerBuilder, HTML, or Java code (atleast JSP code) within the one environment.

The incorporation of common IDE featuresbegan in PB7 and the IDE began to take on its cur-rent form. The modal windows were replaced witha flexible docked window display. This approachmeant that developers could view multiple sets ofdata relating to the object/context they were work-ing in, but it also meant that the more data youwanted to see at one time, the less you could see ofany particular set of data; there was simply a limit-ed amount of screen real estate to go around. TheIDE and the debugger now supported the samefeature set, and the end result was that developerseither liked it or hated it.

WRITTEN BY BILL GREENwith an introduction and conclusion by John Olson

UNDERSTANDING THE IDE

The PowerBuilder Integrated Development

Environment

The PowerBuilder Integrated Development

Environment

B O O K E X C E R P T

13PBDJ volume10 issue4www.POWERBUILDERJOURNAL.com

POWERBUILDER 7 IDE DISPLAY FOR WINDOW OBJECTS

A lot of things were now easily accessible tothe developer, but it still wasn’t quite what wasneeded. In addition, developers were still lim-ited to working on a single application, andusing, viewing, or modifying code resident inanother application required a manual switch-ing effort to gain access. Everything stillworked at the application level rather than at aproject level. In addition, the IDE still only didPowerBuilder code and the command-lineaccess to items such as deployment projectswas rudimentary.

PowerBuilder 8 was the next step forward inthe IDE’s technology. The main elements broughtinto the PB8 environment were workspaces andtargets, support for non-PowerBuilder code, andenhanced Source Code Control integration. Let’squickly cover the highlights.

Source Code Control, or SCC integration, wasimproved to the point that the SCC implemen-tation in PowerBuilder 8 was now identical tothat of other development products. Instead ofmultiple copies of PowerBuilder Libraries(PBLs) in both the SCC Repository location andthe developer’s workspace, the PBLs residedonly on the developer’s workspace. The SCCRepository contained only the objects withinthe applications and in a flat-file format. Thisopened the door for more extended use of stan-dard SCC features such as branching and build-ing configuration management. This was a bigstep forward, but was still missing some impor-tant SCC capabilities from within PowerBuilder,such as the ability to rebuild the developerworkspace based on the SCC Repository, orintelligently manage a nightly build process.

Workspaces and targets introducedPowerBuilder developers to the concept ofworking on more than one application at atime, and even more than one type of applica-tion at a time. An application that comprised aWeb site, some components for a middle-tierapplication server, and some standardclient/server executables could now easily beconfigured in a developer’s workspace givingthe developer instant access to all the objects.

No more switching applications! A developer’sworkspace was now truly a workspace andcould now comprise as many targets as wereneeded (a target being a deployment target).

This setup of workspace and targets was rep-resented graphically as a TreeView within the IDEand called the System Tree. The System Tree wasthen further enhanced to incorporate features ofthe object browser, so developers could now drilldown through the System Tree from workspaceto target to PBL to object-to-object methods,events, or properties. Figure 1 shows a typicalPB8 display including the System Tree, ClipWindow, Error Window, and development area.

The PB8 IDEObviously, screen real estate was even more

of an issue now. As it turns out, the loss of realestate to the System Tree seemed to have apositive rather than a negative effect. Becausea lot of data was now available from the SystemTree, some of the other views were no longerconsidered that critical and developers oftenmodified the default layouts to provide morereal estate rather than less.

PowerBuilder 9 has continued the process,and while it does not incorporate majorchanges to the IDE, it does address some addi-tional needs, including enhanced SCC integra-tion and the addition of some new targets,such as the JSP target. These features do notaffect the IDE specifically.

Let’s take a closer look at the IDE and its var-ious components and see where all the ele-ments are and how you can take advantage ofthe IDE’s flexibility to enhance your productiv-ity rather than detract from it.

Workspaces and TargetsAs previously mentioned, PB8 introduced

the concept of workspaces and targets to thePowerBuilder developer. Simply put, a work-

space is a collective area where you can main-tain and manipulate several targets. For exam-ple, a PowerBuilder application, a Web site, ora collection of EAServer components might beconsidered targets, but if they all pertain to thesame overall system, they can be combinedwithin a single workspace, giving developers amore coherent and complete picture of theirsystem.

WorkspacesThe workspace concept eliminated the sin-

gle application limitation. Developers can havemultiple application targets within their work-space and direct access to all objects across alltargets within the given workspace. Applicationswitching is now a thing of the past.

At the workspace level there are a set of com-mands available to the developer. To access theWorkspace Menu, position your pointer to theworkspace, click the right-mouse button(RMB), and a set of options is presented.

WORKSPACE MENUThe menu options are context-sensitive, so

some options are enabled or disabled depend-ing on the situation. For example, SCC optionsare not shown if you’re not using some sort ofSCC. Let’s look at the menu options availableand see what each one means.

NewThis command advances you to the Create

New Workspace capabilities withinPowerBuilder. The workspace file is a simpletext file and is fairly irrelevant by itself. Whereyou place the workspace file, however, canhave an impact on your development environ-ment. All paths within the workspace, be theytarget paths, PBL paths, or other files, arestored relative to the workspace location, so it’srecommended that the workspace be locatedat the root level of the System DevelopmentEnvironment. I’ve gone so far as to redesignmy system structure, in terms of the directo-ries and subdirectories I have where the codeis stored, to more comfortably support theworkspace I’m working in. My development

FIGURE 1 The PB8 IDE

This article is based on PowerBuilder: AdvancedClient/Server Development by various authors(ISBN 0672325004), published by Sams Publishing.Also look for PowerBuilder 9 Internet andDistributed Application Development.

FIGURE 2 Sample application layout showing multiple targets

14 PBDJ volume10 issue4 www.POWERBUILDERJOURNAL.com

environment structure looks something likeFigure 2.• Sample Development Environment

The structure is pretty simple – the top level(work environment) is the root. Beneath thatis a company identifier – I am a consultantand work with several clients, therefore thisseparation is needed – followed by an appli-cation identifier, then a version structurecontaining the elements of the application.My workspace is set up at the root level as itencompasses all the applications. Each tar-get is created at the application/develop-ment level. Note that there may be multipletargets within an application as there may bea client/server application, middle-tier com-ponents, and/or Web components. Theremay also be several versions of the sameapplication, and I give each of these a target.I can then assemble a workspace to includehowever many targets and versions of tar-gets that I need to accomplish any giventask.

Add TargetThis menu option allows you to add an exist-

ing target to your one, perhaps one that’salready been created. The target file is also atext file and is identified by a .PBT extension.

Open WorkspaceThis option allows you to open another

workspace, replacing the workspace you cur-rently have open. This indicates that you canonly be working in one workspace at a time.Another thing to remember is that you haveaccess to all objects within your workspace,but you also don’t have access to objects out-side your workspace.

Incremental BuildWe all know what an incremental build is –

the process of regenerating any objects thathave changed since the last build, includingreferenced objects. At the workspace level, thismeans that each target within the workspacewill execute an incremental build instructionin sequence.

Full BuildLike the incremental build, the full build at

the workspace level will simply execute a fullbuild instruction for each target in the work-space, consecutively. This is an excellentoption for performing a full rebuild on every-thing in your workspace prior to shipping thecode to your QA group.

DeployThe deploy option is a new feature added in

PB8. It allows you to execute all project objectsin your workspace in the sequence you’vedefined. The sequence is defined by thesequence of targets and the sequence of pro-jects within targets. At the target level, as we’llsee later, you can modify the sequence of theprojects to be executed. In this manner, youcan control exactly how the objects in yourworkspace should be deployed, for example:1. Deploy a component to EAServer.2. Create proxies for the component in

EAServer.3. Deploy another component using the gener-

ated proxy.4. Create proxies for that component.5. Deploy a client/server executable that calls

the components in EAServer using the prox-ies generated.

In this manner, you have complete controlover the deployment sequence and can deployeverything in the workspace with a singlemouse click.

DebugThe debug option at the workspace level will

run the debugger on the currently selected exe-cution target. If a target is not currently select-ed, it will offer a dialog window where you canset the target to debug.

RunLikewise, the Run command will run the

currently selected target. Note that both theRun and Debug options will only work if thetarget is a component that can be run, forexample, a GUI application. Also note that theCurrent Run/Debug target is not necessarilythe target you currently have open. More onthis later in the Targets section.

CloseThis will close the current workspace.

ShowThis option allows you to specify which

types of objects can be shown, such as targets,PBLs, and applications.

PropertiesThis option provides access to workspace

properties. Upon selection, a dialog window isopened that provides access to three areas ofworkspace properties: the Target SequenceList, a Deployment Preview presentation, andSource Code Control setup options.

THE WORKSPACE PROPERTIES DIALOGUnder targets, you’ll see a list of the targets

in the workspace. The sequence of targets canbe altered here using the up/down arrows. Thecheckbox indicates whether the target isincluded in deployment instructions.

The Deploy Preview tab, shown in Figure 3,displays the targets in selected sequence, andfor each target the projects that will bedeployed. This is the screen where you can seeexactly when and how every deployment pro-ject in your workspace will be deployed.

THE DEPLOY PREVIEW DIALOGIn the Source Code Control tab, you can set

various options for Source Code Control man-agement. The first option is the type of SCCyou’re using and the options here will generallyinclude PBNative and whatever third-party SCCproviders you have installed. The UserID speci-fies your identifier ID as it relates to Source CodeControl. The Project option is expandable andthe expanded options will vary by SCC Provider,but its main purpose is to establish where theSCC Repository is located. The Local RootDirectory points to where your workspaceobject can be found. Then, several options allowyou to control how you want SCC to operate.

Source Code Control OptionsTARGETS

A target is defined as the type of deploymentyou are planning for a particular set of data, forexample, if you have a set of code you plan todeploy as a PowerBuilder executable, whichwould be considered a PowerBuilder target.Similarly, a collection of Web components des-ignated for building a Web site would be con-sidered a Web target. It’s simply a way to sepa-rate the different deployment characteristics ofyour overall application. PowerBuilder nowsupports multiple targets within a workspaceso you could have a complete system includingmultiple PB executables, EAServer compo-nents, and Web components all within thesame workspace. This simplifies both the devel-opment and maintenance efforts required.

To quickly view which targets you can cre-ate, choose the menu option File | New andthen the Targets tab. This will depict the vari-ous types of targets available (see Figure 4).

PowerBuilder TargetsThe target options are as follows:

ApplicationThe Application target creates a new appli-

cation in a PBL. It does not create any addi-tional PB objects.

Template ApplicationFor more sophisticated application genera-

tion, the template application allows you tocreate the prerequisite elements for one ofthree types of applications:1. SDI: Single Document Interface applications

are based on a single controlling window.

FIGURE 3 Workshop properties – deployment options

15PBDJ volume10 issue4

2. MDI: Multiple Document Interface applica-tions are based on a Frame Window andSheet Windows. This option will generate aworking MDI application and includes somebasic objects for Menus, Sheet Windows, aFrame Window, and some utility dialogs.

3. PFC: This option will generate a basic PFCApplication.

Existing ApplicationThis will allow you to create a target based

on an existing application. This is the optionyou’ll use when migrating an application froma previous version.

Other Target OptionsThe remaining options will allow you to cre-

ate other specialized targets such as anEAServer Component target or, new in PB9, aJSP target.

Targets also have their own set of functionsthat are enabled by a right-mouse click. Notethat different types of targets will have differentoptions, but we’ll focus on the PowerBuildertargets for now.

TARGET OPTIONS FOR POWERBUILDER TARGETSNew…

This option takes you to the New Target

panel discussed earlier so you can create a newtarget in your workspace.

SearchThis option allows you to perform a search

across all objects within the target.

Incremental BuildLike the workspace option, the incremental

build option allows you to incrementallyrebuild all objects within the specified target.

Full BuildLike the incremental build, the full build at

the target level will simply execute a full buildinstruction for all objects in the target consec-utively. This is an excellent option for perform-ing a full rebuild on everything in your work-space prior to shipping the code to your QAgroup.

MigrateThis menu option allows you to migrate a

single target. While, generally, migration isdone when creating a target, and PowerBuildertakes care of informing you when a migrationis needed/will happen, it’s useful to know thatyou can perform the migration yourself whennecessary.

DeployThe deploy option is a new feature added in

PB8. This option allows you to execute all pro-ject objects in your target in the sequence youhave defined. The sequence is defined as thesequence of projects within targets. At the tar-get level, you can modify the sequence of theprojects to be executed.

DebugThe debug option at the target level will run

the debugger on the currently selected execu-tion target. If a target is not currently selected,

it will offer a dialog window where you can setthe target to debug.

RunLikewise, the Run command will run the

currently selected target. Note that both theRun and Debug options will work only if thetarget is a component that can be run, forexample, a GUI application. Also note that theCurrent Run/Debug target is not necessarilythe target you currently have open.

Remove TargetThis will remove the currently selected target

from the workspace. It does not delete any files.

ShowThis option allows you to specify what types

of objects can be shown, such as targets, PBLs,applications, etc.

PropertiesThis option provides access to target proper-

ties. Upon selection, a dialog window is openedthat provides access to a dialog window withtwo tabs (for a PowerBuilder target). The first ofthese is your application library list and thesecond is the deployment sequence. Figure 5shows the library list options. It’s interesting tonote that the library list is now located hereinstead of in the application object.

THE TARGET PROPERTIES DIALOG SHOWING THEAPPLICATION LIBRARY LIST

The second portion of this window is theDeploy tab. This tab allows you to control whichprojects within the target should be run and inwhat sequence. Any changes here will affect thedeployment sequence of both the target, whendeploying just the target, and the workspace.

Target Deployment OptionsThis may not seem a big deal in a typical

client/server application, but it can be a majorcontributor in multitarget settings such as anEAServer component-based development effort.

ConclusionThere are a lot of features in the PowerBuilder IDE

that often go unused and sometimes even undiscov-ered. In Bill’s chapter he points out those featuresand describes how to use them. The IDE is some-thing you really need to explore in order to exploit itscapabilities. The chapter will give you a head startinto understanding the IDE, its philosophies andalso some of its idiosyncrasies. With this under-standing, you will be better prepared to take advan-tage of an environment that is actually full of possi-bilities, and positioned well for future expansion.▼

AUTHOR BIOBill Green is a member of TeamSybase and coauthor of severalPowerBuilder books including the forthcoming PowerBuilder 9 series ofbooks.

FIGURE 4 New target options

FIGURE 5 Target properties – library list

[email protected]

www.POWERBUILDERJOURNAL.com

WRITTEN BYBOB HENDRY

16 www.POWERBUILDERJOURNAL.comPBDJ volume10 issue4

B O O K E X C E R P T

Dynamically Creating DataWindow ObjectsIt’s easier than you think

Objects can be added to your DataWindow programmatically via a Modifystatement. In my opinion, the dynamic creation of objects within aDataWindow has been a highly underused feature.

Dynamically creating (or destroying)objects within a DataWindow has manyadvantages such as:• Dynamically changing the content • If a printed DataWindow varies in

appearance from its visual presentation

The syntax for creating objects withinDataWindows can be daunting; no won-der it’s not used that often. Before I gointo more detail, it’s important to knowhow objects are contained in aDataWindow in the first place. Once youunderstand this, you will find thatdynamically creating objects is easy.

The Naked DataWindowBACKGROUND

It should come as no surprise that aDataWindow is really just a collection ofobjects, each with its own properties.When a programmer is creating aDataWindow via the DataWindow painter,he or she is actually just using a graphicalIDE to create and set the properties of theobjects that make up the DataWindow.Actually, the naked DataWindow is notgraphical at all but exists in text format. It’sjust that most programmers tend to create

and edit DataWindows via the Data-Window Painter.

Prior to PowerBuilder 8, if you wantedto take a peek at what a DataWindowlooked like in its text format, it wouldhave to be exported via the librarypainter, then opened up within a texteditor. At that point, changes could bemade and the text file could be import-ed back into PowerBuilder. As the filewas being imported, PowerBuilderwould regenerate it, making sure yourhack was syntactically correct.

Since PowerBuilder 8, Sybase hasallowed programmers to directly modifyobjects via a Source Editor, effectivelyputting an end to the enjoyable, unsup-ported DataWindow source hacking days.By viewing the source code of an existingDataWindow, you’ll appreciate the syntaxof creating objects dynamically. A basicunderstanding of the DataWindow syntaxcan help a lot. Let’s start with theDataWindow illustrated in Figure 1.

Understanding the SyntaxIf this simple DataWindow is opened

up in the Source Editor, you’ll see all theobjects that it’s comprised of. The com-plete syntax is extremely lengthy andcannot be listed in its entirety here. Atfirst glance, the syntax looks foreboding,but after further inspection, it becomesmore familiar. If you think about it, itlooks almost identical to the syntax forthe Describe and Modify function.That’s because it is the syntax forDescribe and Modify.

The source code can be broken downinto six categories:1. Version information2. DataWindow properties3. Band properties4. Source definition5. Object definitions6. DataWindow HTML/XML properties

VERSION INFORMATIONLet’s take a closer look at our Naked

DataWindow:

release 9;

The first line of the syntax comprisesonly one statement indicating thePowerBuilder release with which thisDataWindow object was constructed.This line will contain only major releasenumbers (you won’t see 9.01). Therelease number is important as it tellsthe DataWindow Engine how to handlethe rest of the syntax. Obviously, morerecent DataWindow versions containadded features. If you’re in PowerBuilder8 and try to open a DataWindow that wasbuilt in PowerBuilder 9, PowerBuildergives the error message “DataWindowSyntax has incorrect release number.”On the other hand, a more recent versionof PowerBuilder will happily import aDataWindow created in an earlierrelease. When an earlier version of aDataWindow is saved or regenerated, it’smigrated to the current version.

If you’re resourceful, the DataWindowmay be migrated backward by changingits release number. It may take a bit oftrial and error to remove any of thesource code that may not be understoodby previous DataWindow Engines.

DATAWINDOW PROPERTIES

datawindow(units=0 timer_interval=0

color=12632256 processing=0 HTMLDW=no

print.printername="" print.document-

name="" print.orientation = 0

print.margin.left = 110 print.mar-

gin.right = 110 print.margin.top = 96

print.margin.bottom = 96

print.paper.source = 0

print.paper.size = 0 print.canusede-

faultprinter=yes print.prompt=noFIGURE 1 Simple tabular DataWindow

Millionsof Linux UsersOne Magazine

SAVE 30%OFF!

REGULAR ANNUAL COVER PRICE $71.76

YOU PAY ONLY

$499912 ISSUES/YR

*OFFER SUBJECT TO CHANGE WITHOUT NOTICE

SUBSCRIBETODAY!

WWW.SYS-CON.COMOR CALL

1-888-303-5282

The World’s Leading i-Technology Publisher

Linux Businessand Technology

There is no escaping the penetration of Linux into the corporate world. Traditional models are being turned

on their head as the open-for-everyone Linux bandwagon rolls forward.

Linux is an operating system that is traditionally held in the highest esteem by the hardcore or geek

developers of the world. With its roots firmly seeded in the open-source model, Linux is very much born from

the “if it’s broke, then fix it yourself” attitude.

Major corporations including IBM, Oracle, Sun, and Dell have all committed significant resources and

money to ensure their strategy for the future involves Linux. Linux has arrived at the

boardroom.

Yet until now, no title has existed that explicitly addresses this new hunger for information from the

corporate arena. Linux Business & Technology is aimed squarely at providing this group with the knowledge

and background that will allow them to make decisions to utilize the Linux operating system.

Look for all the strategic information required to better inform the community on how powerful an alternative Linux can be. Linux Business & Technology will not

feature low-level code snippets but will focus instead on the higher logistical level, providing advice on hardware, to software, through to the recruiting of trained

personnel required to successfully deploy a Linux-based solution. Each month will see a different focus, allowing a detailed analysis of all the components that

make up the greater Linux landscape.

FOR ADVERTISING INFORMATION:

CALL 201 802.3020 ORVISIT WWW.SYS-CON.COM

ALL BRAND AND PRODUCT NAMES USED ON THIS PAGE ARE TRADE NAMES, SERVICE MARKS, OR TRADEMARKS OF THEIR RESPECTIVE COMPAN

Regular features will include:

Advice on Linux Infrastructure Detailed Software Reviews Migration Advice Hardware Advice CEO Guest Editorials Recruiting/Certification Advice Latest News That Matters Case Studies

June 3–5...............LONDONJune 24–26 .........BERLINSeptember ..HONG KONGOctober ..........CALIFORNIA

www.sys-con.comPremieringJune 2003

at

www.POWERBUILDERJOURNAL.com18 PBDJ volume10 issue4

print.buttons=no print.preview.but-

tons=no print.cliptext=no print.over-

rideprintjob=no print.collate=yes

hidegrayline=no )

After the PowerBuilder release num-ber comes the DataWindow properties,such as the color and print information.Note the new DataWindow features for9.0, such as hidegrayline, in the abovesource code. Another DataWindowproperty that’s worth pointing out is theprocessing property. This specifies theDataWindow’s Presentation Style:• 0 - (Default) Form, Group, Query,

Tabular, N-UP, Label• 1 - Grid• 2 - Label• 3 - Graph• 4 - Crosstab• 5 - Composite• 7 – RichText

The next time you want to change thestyle of a DataWindow, there’s no need tore-create the entire DataWindow. Justchange the processing property in thesource code. Also at runtime, using dotnotation or Describe, the “processing”attribute can be used to determine theDataWindow style. You’re not allowed tochange the DataWindow PresentationStyle at runtime.

BAND PROPERTIES

header(height=256 color="536870912" )

summary(height=92 color="536870912" )

footer(height=0 color="536870912" )

detail(height=68 color="536870912"

height.autosize=yes)

The Band Properties section consistsof one statement for each band in theDataWindow. It describes the proper-ties of each band; for example, itsheight, color, and any expressions itmay have. Actually this section is notmandatory, as PowerBuilder will createthese four bands even if you don’t spec-ify that it do so. If the band propertiesare not supplied, they’ll be created witha height of zero. If your DataWindowcontains groups, they won’t be speci-fied here. Group “bands” inPowerBuilder are specified elsewherein the source code.

SOURCE DEFINITIONThe source code in Listing 1 has been

cosmetically aligned for readability pur-poses. It’s divided into two sections. Thefirst section describes the result set,specifically:• Data types

• Update characteristics• Database column names• Default values

The type property defines thePowerBuilder data type for the column.This property can be changed wheneverPowerBuilder fails to correctly deter-mine the data type of a database col-umn. This often happens whenPowerBuilder is working with less com-mon data types and time stamps.

The second portion of Listing 1 speci-fies the SQL source, including anyPowerBuilder-defined retrieval argu-ment. This section also describes theSQL that will generate the result set.

The SQL source is actually storedinternally in a generic PowerBuilderdialect called PBSELECT. This is how theSQL gets generated when the SQL state-ment is “Painted”. If you choose the“Convert to Syntax” option and type inthe SQL statement, PowerBuilder storesthe statement and standard SQL:

retrieve=" SELECT

~"employee~".~"emp_lname~",

~"employee~".~"emp_fname~",

~"employee~".~"salary~"

FROM ~"employee~"

WHERE ~"employee~".~"state~" =

'TX'

ORDER BY ~"employee~".~"emp_lname~"

ASC

" )

OBJECT DEFINITIONSThis section contains all the other

objects in the DataWindow. It containsimportant information as to which bandeach object belongs to. Objects such ascolumns, text objects, computed fields,and drawing objects are found here.Listing 2 provides the object definitionsfor a column, text, and line object.

Notice that the code in the listing isliterally a help file to see which proper-ties belong to which objects.

DATAWINDOW HTML/XML PROPERTIESThis final section contains all the

HTML/XML properties that are associat-ed with the DataWindow. Many of theseare new to PowerBuilder 9.0.

htmltable(border="1" )

htmlgen(clientevents="1" clientvalida-

tion="1" clientcomputedfields="1"

clientformatting="0" clientscript-

able="0" generatejavascript="1"

encodeselflinkargs="1" netscapelay-

ers="0" )

export.xml(headgroups="1" include-

whitespace="0" metadatatype=0

savemetadata=0 )

import.xml()

export.pdf(method=0 distill.custom-

postscript="0" xslfop.print="0" )

Creating Dynamic ObjectsGETTING THE SYNTAX

Now that you’ve seen a nakedDataWindow, it should be easy to createand destroy DataWindow objects. Why?Because you’ve already seen the syntax.For example, let’s say that when you printa DataWindow, you want to add a com-puted field containing the page number.To do this, create the computed file onthe DataWindow, then open it up in thesource editor. The source code for ournew computed field looks like Listing 3.

The DataWindow did us a favor andbuilt the syntax that we’re now going touse to build this object dynamically. Atthis point, copy and paste the sourcecode to a safe place, then delete theobject in the DataWindow painter.

ADDING THE CODEA logical place to put the code is the

DataWindow PrintStart Event. InPrintStart we can place the code to cre-ate our computed column. When theDataWindow is finished printing, we candestroy the object in PrintEnd.

Listing 4 provides code for thePrintStart Event, and Listing 5 providescode for the PrintEnd Event.

By using the create function withinModify, when printed the DataWindowwill contain a computed column con-taining the page number. The destroyfunction cleans it up. As you can see,what looked like a very cumbersomecreate syntax basically becomes a copy-and-paste job. The secret is to create theobject in the DataWindow painter, copythe source code it generated, delete theobject on the DataWindow, and pastethe code into a Modify statement in theevent of your choice.

SummaryCreating a dynamic DataWindow

looks like a daunting task. But as you cansee, if you know what a nakedDataWindow looks like, the job becomesmuch easier. ▼

AUTHOR BIOBob Hendry is a

PowerBuilder instructorfor Envision Software

Systems and a frequentspeaker at national

and internationalPowerBuilder

conferences. He specializes in PFC

development and haswritten two books onthe subject, includingProgramming with

the PFC 6.0

This article is based on PowerBuilder 9Client/Server Development by variousauthors (ISBN 0672325004), which willbe published by Sams Publishing. Alsolook for PowerBuilder 9 Internet andDistributed Application Development,coming soon.

[email protected]

LEARN WEB SERVICES. GET A NEW JOB !

Get Up to Speed with the Fourth Wave in Software Development

Only $69.99 for 1 year (12 issues)*

* Newsstand price $83.88 for 1 yearSubscribe online atwww.wsj2.com or call 888 303-5252*Offer subject to change without notice

SYS-CON Media, the world's leading i-technology publisher ofdeveloper magazines and journals, brings you the most

comprehensive coverage of Web services.

SUBSCRIBE TODAY TO THEWORLD’S LEADINGWEB SERVICES RESOURCE

• Real-World Web Services: XML’s Killer App!

• How to Use SOAP in the Enterprise

• Demystifying ebXML for success

• Authentication, Authorization, and Auditing

• BPM - Business Process Management

• Latest Information on Evolving Standards

• Vital technology insights from the nation’s leading Technologists

• Industry Case Studies and Success Stories

• Making the Most of .NET

• Web Services Security

• How to Develop and Market Your Web Services

• EAI and Application Integration Tips

• The Marketplace: Tools, Engines, and Servers

• Integrating XML in a Web Services Environment

• Wireless: Enable Your WAP Projects and BuildWireless Applications with Web Services!

• Real-World UDDI

• Swing-Compliant Web Services

• and much, much more!

The Best.NETCoverage Guaranteed!

19www.POWERBUILDERJOURNAL.com PBDJ volume10 issue4

table(column=(type=char(20) updatewhereclause=yesname=emp_lname dbname="employee.emp_lname" )column=(type=char(20) updatewhereclause=yesname=emp_fname dbname="employee.emp_fname")column=(type=decimal(3) updatewhereclause=yes name=salary dbname="employee.salary")

retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"employee~") COLUMN(NAME=~"employee.emp_lname~") COLUMN(NAME=~"employee.emp_fname~") COLUMN(NAME=~"employee.salary~")WHERE( EXP1 =~"~~~"employee~~~".~~~"state~~~"~" OP=~"=~" EXP2 =~"'TX'~" ) )ORDER(NAME=~"employee.emp_lname~" ASC=yes ) ")

text(band=header alignment="0" text="Emp Fname" bor-der="0" color="33554432" x="654" y="172" height="56"width="576" html.valueishtml="0" name=emp_fname_t visi-ble="1" font.face="Arial" font.height="-8"font.weight="700" font.family="2" font.pitch="2"font.charset="0" background.mode="1"background.color="536870912" )

column(band=detail id=1 alignment="0" tabsequence=32766border="0" color="33554432" x="73" y="4" height="60"width="576" format="[general]" html.valueishtml="0"name=emp_lname visible="1" edit.limit=20 edit.case=anyedit.autoselect=yes edit.autohscroll=yes edit.imemode=0font.face="Arial" font.height="-8" font.weight="400"font.family="2" font.pitch="2" font.charset="0" back-ground.mode="1" background.color="536870912" )

line(band=header x1="73" y1="248" x2="1559" y2="248"name=l_1 visible="1" pen.style="0" pen.width="5"pen.color="33554432" background.mode="2"background.color="1073741824" )

compute(band=header alignment="1" expression="'Page ' +page() + ' of ' + pageCount()"border="0" color="33554432"x="1157" y="24" height="88" width="466" format="[gener-al]" html.valueishtml="0" name=page_1 visible="1"font.face="Arial" font.height="-10" font.weight="400"font.family="2" font.pitch="2" font.charset="0" back-ground.mode="2" background.color="1073741824" )

dw_1.Modify("create compute(band=header alignment=~"1~"expression=~"'Page ' + page() + ' of ' +pageCount()~"border=~"0~" color=~"33554432~" x=~"1157~"y=~"24~" height=~"88~" width=~"466~" format=~"[general]~"html.valueishtml=~"0~" name=page_1 visible=~"1~"font.face=~"Arial~" font.height=~"-10~"font.weight=~"400~" font.family=~"2~" font.pitch=~"2~"font.charset=~"0~" background.mode=~"2~"background.color=~"1073741824~" )")

dw_1.Modify("destroy compute(band=header alignment=~"1~"expression=~"'Page ' + page() + ' of ' +pageCount()~"border=~"0~" color=~"33554432~" x=~"1157~"y=~"24~" height=~"88~" width=~"466~" format=~"[general]~"html.valueishtml=~"0~" name=page_1 visible=~"1~"font.face=~"Arial~" font.height=~"-10~"font.weight=~"400~" font.family=~"2~" font.pitch=~"2~"font.charset=~"0~" background.mode=~"2~"background.color=~"1073741824~" )")

Listing 5:

Listing 4:

Listing 3:

Listing 2:

Listing 1:

20 www.POWERBUILDERJOURNAL.comPBDJ volume10 issue4

WRITTEN BYGLYNN NAUGHTON

N O N S T A N D A R D D A T A M O D E L

Hierarchical DataReduce coding changes

Relational databases often store hierarchical data, and PowerBuilder applications often display this data in TreeView controls. The hierarchy is typically stored in a series of parent and child tables, with one table per leveI.

The problem with this approach isthat it’s too hard coded; changes to thehierarchy (for example, adding a newlevel between two existing levels)involve significant changes to the data-base and to TreeView controls. In thisarticle I’ll look at a more genericapproach that generates considerablyfewer modifications when a hierarchychanges, as well as making complexqueries against a hierarchy much sim-pler.

Geographical HierarchyI was part of a team that used this

approach while developing an applica-tion for high street bank. The bank had anetwork of branches organized hierar-chically. At the top was the bank andbeneath it were regions, then cities, and

then the branches. Figure 1 shows thehierarchy displayed in a TreeView.

Traditionally, you would store thishierarchy in a number of tables: BANK,REGION, CITY, and BRANCH, with eachchild table linked to its parent via a for-eign key. The code in your TreeView hasto determine which are the appropriatetables depending on the level the user iscurrently exploring. This approachworks adequately in the short term, butwhat if, in the future, the bank decides tointroduce a new level into the hierarchy,for example, a DISTRICT level betweenREGION and CITY? You need to redesignthe data model by adding a DISTRICTtable and replumbing the referentialintegrity between REGION and DIS-TRICT, and DISTRICT and BRANCH.Then you need to modify the code in theTreeView to accommodate the newstructure. This is a lot of work. How canyou store a hierarchy in a more genericway that considerably reduces theamount of database and applicationchanges when the hierarchy changes?

A Generic SolutionThe answer is to store the hierarchy

items in one table (we’ll call it ITEM inthis example) and the hierarchy struc-ture in another table linked to it(ITEM_HIERARCHY). ITEM_HIERAR-CHY is a self-referring table that relateschild items to their parent using a col-umn (parent_id) that refers back to thetable’s primary key (item_id). Listing 1shows the bank hierarchy represented insuch a table. The code in the TreeViewbecomes much simpler when writtenagainst this table. Previously, the SQL toretrieve the child items of an expandeditem depended on the expanded item’slevel (for example, the child items comefrom the REGION table if the expanded

item is at level 1 or the CITY table if it’s atlevel 2). Now, the SQL:

SELECT item_id, item_name

FROM item_hierarchy

WHERE parent_id = :parent_id

(where :parent_id is the primary key ofthe expanded item) retrieves the childitems irrespective of the expanded item’slevel.

It’s now much easier to alter the struc-ture of the hierarchy. Introducing a DIS-TRICT level between REGION and CITYis simply a matter of adding and updat-ing data in the ITEM and ITEM_HIER-ARCHY tables.

Storing Additional InformationThe ITEM table stores the bare mini-

mum of information about an item: itsname. This is often sufficient; for exam-ple, when an item is at a hierarchy level,that’s simply a way of grouping the itemson the level below. (For example, thebank might not be interested in regionsin their own right, but going straightfrom the bank level to the city level inthe TreeView would fill the display withtoo many items. For convenience, citiesare grouped into regions.) If, on theother hand, you need to store additionalinformation about an item, add an addi-tional table. For example, to store cities’populations, add a CITY_ATTRIBUTEtable with the following structure:

city_id population

5 2000000

6 3000000

The city_id column joins to theitem_id column in ITEM. Those readerswith data warehouse experience willnote that this data model vaguely resem-FIGURE 1 Bank hierarchy

21PBDJ volume10 issue4www.POWERBUILDERJOURNAL.com

bles a snowflake schema, withITEM_HIERARCHY as the “fact” tableand “dimensions” linked to it. Figure 2shows an example of such a schema.

Navigating the HierarchyWhat if you need to query the hierar-

chy? For example, the bank TreeViewhad an “Expand All” option that expand-ed a TreeView item and all its child itemsat all levels. Many items had enoughchild items to cause a delay between theuser expanding the item and all itsexpanded children appearing in theTreeView. To give the user a visual cuethat something was happening, weadded a progress bar. But to prime aprogress bar, you need to know thenumber that represents “task complete”(in this case the total number of childitems). Calculating this number usingthe ITEM_HIERARCHY table wouldinvolve “walking” the hierarchy. Oraclehas the CONNECT BY clause to do this,but other DBMSs do not.

However, you can greatly simplify tra-versal of the hierarchy by creatinganother table (we’ll call it HIERAR-CHY_ACCESS) that stores the hierarchyin a different format. Listing 2 shows theHIERARCHY_ACCESS table for the bankhierarchy. For example, this table tells usthat the Picadilly branch has three par-ents: Manchester at level 3, North Westat level 2, and High Street Bank at level 1.Using this table, a query such as “returnthe total number of child items beneathNorth West” is simple:

SELECT count (*)

FROM HIERARCHY_ACCESS

WHERE parent_id = 2

You can also answer more complicat-ed questions with simple and quick-exe-cuting queries written against this table.What if you want to identify all thebranches that are in the same region asLiverpool, or the number of cities thatare in the same region as the Portswoodbranch? Listing 3 shows the SQL forthese queries.

Maintaining the HIERARCHY_ACCESS Table

Clearly, the data in HIERARCHY_-ACCESS is derived from the data inHIERARCHY_ITEM. Synchronize thetwo tables using triggers. Whenever auser deletes an item from HIERAR-CHY_ITEM, the delete trigger simplycascades the delete down to HIERAR-CHY_ACCESS. The insert trigger isslightly more complex and is shown(written for SQL Server 2000) inListing 4.

Note: You can quickly check that thetables are in synch by running thequeries:

SELECT SUM (item_level - 1)

FROM item_hierarchy

and

SELECT COUNT (*)

FROM hierarchy_access

Because each item in the hierarchyhas (item_level - 1) parents, the twoqueries should always return the samenumber.

More Flexibility for the UserAs well as making a hierarchy easier

to maintain and change for developers,the generic hierarchy approach poten-tially gives users more flexibility. Forexample, I’ve written my own simplecontact management program using ageneric hierarchy. I did this because Iwas frustrated by the limitations of com-mercial programs. Often you add a con-tact to a category (for example, Friends,Colleagues) giving you a simple, fixedtwo-level hierarchy. But this is not howmy mind works. I like to be able to cre-ate a hierarchy with an arbitrary numberof levels, for example, Friends/Londonor Paris/Tradesmen/Plumbers. In theapplication TreeView I can add anynumber of groups before adding a con-tact.

In addition, the generic hierarchyallows an item to have more than oneparent. In my contact managementapplication I can include the same con-tact in several different places –Paris/Tradesmen/Plumbers or Trades-men/Paris/Plumbers, or Apartment/-Contacts. I find that this considerablyreduces “Where did I put that?” frustra-tion and allows me to avoid using theapplication’s search function, becauseI’ve covered all the possible pathsthrough the hierarchy that my untidymind is likely to take.

All of this is simply programmedagainst a generic hierarchy; it wouldclearly be impossible against a standardhierarchical data model.

SummaryThis article showed how to store a

hierarchy in a relational database in away that significantly reduces codingchanges when the configuration of thehierarchy changes, and makes complexqueries against the hierarchy simpleand quick to execute. The approach alsoallows for applications to provide richer,more flexible functionality to users. Thesolution involves a slightly nonstandarddata model, but the benefits of this overthe traditional hierarchical data modelare clear. ▼

AUTHOR BIOGlynn Naughton graduated in 1997 with a computing degree andworked in London for four years as aPowerBuilder analyst/programmer, where hewas involved in buildingseveral client/server applications. He now lives in [email protected]

FIGURE 2 Snowflake schema

“I like to be able to create ahierarchy with an arbitrary

number of levels, for example,Friends/London or

Paris/Tradesmen/Plumbers”

www.POWERBUILDERJOURNAL.com22 PBDJ volume10 issue4

ITEM table

item_id item_name ----------- -------------------------------------------------- 1 High Street Bank2 North West3 North East4 South East5 South West6 Manchester7 Liverpool8 Newcastle9 Sunderland10 London11 Southampton12 Bristol13 Picadilly14 Deansgate15 Cheetham Hill16 Portswood17 Shirley18 Highfield

ITEM_HIERARCHY table

item_id parent_id item_level ----------- ----------- ----------- 1 0 12 1 23 1 24 1 25 1 26 2 37 2 38 3 39 3 310 4 311 5 312 5 313 6 414 6 415 6 416 11 417 11 418 11 4

HIERARCHY_ACCESS table:

item_id item_level parent_id parent_level------- ---------- --------- ------------2 2 1 1 3 2 1 1 4 2 1 1 5 2 1 1 6 3 1 1 6 3 2 2 7 3 1 1 7 3 2 2 8 3 1 1 8 3 3 2 9 3 1 1 9 3 3 2 10 3 1 1 10 3 4 2 11 3 1 1 11 3 5 2 12 3 1 1 12 3 5 2 13 4 1 1 13 4 2 2 13 4 6 3 14 4 1 1 14 4 2 2 14 4 6 3 15 4 1 1 15 4 2 2 15 4 6 3 16 4 1 1 16 4 5 2 16 4 11 3 17 4 1 1 17 4 5 2 17 4 11 3 18 4 1 1 18 4 5 2 18 4 11 3

All branches in the same region as Liverpool:

select i.item_namefrom item i

,hierarchy_access hwhere i.item_id = h.item_idand h.item_level = 4 and h.parent_id =

(select parent_idfrom hierarchy_access h

,item iwhere i.item_id = h.item_idand h.parent_level = 2 and i.item_name = 'Liverpool'

)

Number of cities in same region as Portswood branch:

select count (*)from hierarchy_access hwhere h.item_level = 3 and h.parent_id =

(select h.parent_idfrom hierarchy_access h

,item i where i.item_id = h.item_idand i.item_name = 'Portswood' and h.parent_level = 2 --Region level

)

CREATE TRIGGER trg_hierarchy_insertON item_hierarchyFOR INSERT AS

DECLARE @ItemID integer,@ItemLevel integer,@ParentID integer

DECLARE hierarchy_cursor CURSOR FOR SELECT item_id

,item_level,parent_id

FROM inserted

OPEN hierarchy_cursor

FETCH NEXT FROM hierarchy_cursorINTO @ItemID

,@ItemLevel,@ParentID

WHILE @@FETCH_STATUS = 0BEGIN

WHILE @ParentID > 0BEGIN

INSERT INTO hierarchy_access SELECT @ItemID

,@ItemLevel,,@ParentID

,item_levelFROM item_hierarchyWHERE item_id = @ParentID

SELECT @ParentID = parent_idFROM item_hierarchyWHERE item_id = @ParentID

END

FETCH NEXT FROM hierarchy_cursorINTO @ItemID

,@ItemLevel,@ParentID

END

CLOSE hierarchy_cursorDEALLOCATE hierarchy_cursor

GO

Listing 4:

Listing 3:

Listing 2:

Listing 1:

1)2)3)

This one-day intensive workshop is designed for developers who wish to increase the efficiency and reliability of their code development.

The day will begin by looking at the various hints and tips you can utilize at the code

level to improve the quality and reduce the number of bugs you have to contend with.

The next part will look at Apache’s Ant and how you can use this freely

available tool for your own development, irrespective of your IDE.

Last, and most important, as the old saying goes: “You can never do enough

testing.” This session will look at JUnit and show you how to start building test

harnesses for your code so you can begin your testing strategy.

>PerformanceJava is a powerful language. While it offers a rich array of tools, the fundamentals mustn’t be overlooked. Improving your code at the core layer will result in great improvements in efficiency and produce (hopefully) less bugs. We’ll look at the do’s and don’ts of programming and learn many hints and tips that will accelerate your Java coding.

>Efficiency with AntApache’s Ant is a powerful scripting tool that enables developers to define and execute routine software development tasks using the simplicity and extensibility of XML. Ant provides a comprehensive mechanism formanaging software development projects, including compilation, deployment, testing, and execution. In addition, it is compatible with any IDE or operating system.

> Reliability with JUnitA critical measure of the success of software is whether or not it executes properly. Equally important, however, is whether that software does what it was intended to do. JUnit is an open-source testing frameworkthat provides a simple way for developers to define how their software should work. JUnit then provides test runners that process your intentions and verify that your code performs as intended. The result is software that not only works, but works in the correct way.

April:NEW YORKWASHINGTON, DC

May:BOSTONTORONTO

June:ATLANTARALEIGH

Coming to you...

SaturdaySessionsWe understand the pressures of work and how difficult it can be to get time off. That is why we have designed this workshop to be held in one day and, as a specialbonus, on the weekend, so no days off from work. Your boss will be happy!

W TM T SF S

PRODUCED BY

SPONSORED BY

Alan WilliamsonJDJ Editor-in-Chief

Performance > Efficiency > Reliability

What you will receive...

✓ INTENSIVE ONE-DAY SESSION

DETAILED COURSE NOTES AND ✓ EXCLUSIVE ONLINE RESOURCES

✓ JDJ CD ARCHIVE

ONLY$295 **JDJ subscribers($395 non-subscribers)

———————————————————*GROUP DISCOUNTSAVAILABLE

To Register

www.sys-con.com/education

Call 201 802-3058

ALL BRAND AND PRODUCT NAMES USED ON THIS PAGE ARE TRADE NAMES, SERVICE MARKS, OR TRADEMARKS OF THEIR RESPECTIVE COMPANIES.

PRESENTED BY

WRITTEN BYBERNDT HAMBOECK

P O R T A L S & P O R T L E T S

Sybase Enterprise Portal Evaluation VersionProvides a single, secure, browser-based interface

The Sybase Enterprise Portal is ideal for organizations that are looking for asolution that allows developers to integrate existing enterprise contentand applications as well as incorporate the tools that will enable them to

access, manage, share, and understand them better.

Parts 1 and 2 of this article will take aclose look at the Sybase EnterprisePortal. I’ll start by describing why youmight need an enterprise portal andthen examine the evaluation version ofthe Sybase EP.

We’ll look at:• The architecture of the Sybase

Enterprise Portal• Installing Enterprise Portal 5.01• Creating pages and using portlets

using the portal interface• Creating pages and portlets using the

portal studio• Using the security features in Sybase

EP• Using the search service• Creating applications for the enter-

prise portal

Why Do We Need a Portal?According to Sybase, “In this period of

economic uncertainty, corporations arelooking for solutions that will reducecosts and improve productivity. Theyalso need to take full advantage of theirinformation resources and maximizethe value of their IT investments. Onesuch solution is to Web-enable busi-ness-critical information and applica-tions and to consolidate them within aportal.”

By providing a unified view, portalsgive employees, partners, and cus-tomers immediate access to the infor-mation and services they need to per-form their jobs. By providing a unifiedview of information sources, enterpriseportals are seen as the “hub” of the con-vergence of multiple, complementaryinformation management solutions,including document and content man-

agement, information search andretrieval, knowledge management, teamcollaboration, workflow, and businessintelligence.

With an Enterprise Portal, you’re able to:• Integrate all types of enterprise data

and take control of heterogeneous ITenvironments.

• Take advantage of open standards toleverage existing investments.

• Convert unstructured informationinto usable knowledge.

• Provide content to users according totheir specific roles.

• Share information and collaborateacross the extended enterprise.

Essentially, the portal will be a secure,personalized, and centralized access

point to all enterprise content andapplications, as well as the tools usersneed to find, share, manage, publish,and analyze that content.

Why Sybase Enterprise Portal?Sybase offers a lot of tools for develop-

ers, and you can choose between differentdatabases to fit your needs. They offerenterprise and mobile development toolsas well as enterprise integration tools.These tools come together to help youprovide high-quality service and/or prod-ucts to clients at an affordable price (theEnterprise Portal gives both employeesand customers fast, secure access toinformation, which leads to better serviceand better products). As we’ll see in Part 2,Sybase Enterprise Portal is built around

www.POWERBUILDERJOURNAL.comPBDJ volume10 issue424

FIGURE 1 Enterprise Portal - Portal Studio

Part 1 of 2

www.POWERBUILDERJOURNAL.com 25PBDJ volume10 issue4

these market-proven products (EAServer,ASE, ASA, iAWS, and much more).

Sybase Enterprise Portal 5.01 enablesusers and developers to build portletswithout programming and deploying toleading application servers and offerspoint-and-click portal maintenancewith tools you might already know.

Sybase EP Evaluation VersionThe current version of Sybase EP is

5.01 (we’ll start to look at this version inthe next article, but there’s also an evalu-ation version). You can download it fromhttp://crm.sybase.com/sybase/www/eBD/EP5EvalDnld.jsp. It’s a zip file withabout 37MB.

This evaluation version is designed fora single machine install on Windows NTor 2000.

The following browsers are supported:IE 5.0, 5.5, and 6.0. There are known sta-bility issues with Netscape because of itssupport of JavaScript.

What’s included:• Tomcat version 4.04: Tomcat is the

servlet container that’s used in theofficial Reference Implementation forthe Java servlet and JavaServer Pagestechnologies developed by Sun.

• An access control database: Sybase EPprovides a page where you can registerfor the portal. Enter your first and lastname, username, password, and e-mail and, after submitting this infor-mation, you can log in to the portal byentering your username and pass-word. This information is matchedagainst the information found in theAccess Control Database (ACDB). Thedatabase used is Sybase AdaptiveServer Anywhere.

• The Portal Interface: An enterpriseportal that end users view and interactwith to access predefined content orto create their own. It consists of siteareas and tools that help you createand manage your pages.– Page tabs let you name your pages so

you can navigate between them. Thenumber of page tabs in a page groupvaries, depending on the length ofthe page tab names you choose. Ifyou run out of space, Portal Interfaceactivates the page groups feature.

– Page groups group your pages in setsof pages. This allows you to add morepages to your account than you canview in a single browser window.

– The toolbar, located below your pagetabs, contains some of the majorfunctions necessary to create andmanage your pages. Additionalfunctions display as icons above thepage tabs.

– Portlets display the content you’veselected from the Portal Interface orthe Web. Portlets are visual, dynamiccomponents that make up a Web pageresiding in the enterprise portal.Typically, when an end user requests apersonalized page, multiple portletsare invoked when that page is created.Take care when choosing a portalsince portlets rely on APIs to accessvarious types of information, such as auser profile. Until now, the lack of stan-dards has led portal server platformvendors to define proprietary APIs forlocal portal components and for invo-cation of remote components. Thiscreates interoperability problems forportal customers, application vendors,content providers, and portal softwarevendors. To overcome these problems,the Java Portlet API was defined by thebiggest enterprise portal vendors,including Sybase. It will cleanly sepa-rate portlets from the surroundingportal server infrastructure so that theportlets can run on different portalservers, just as servlets can run on dif-ferent application servers. The API is now specified (see JSR-168Portlet Specification at www.jcp.org/en/jsr/detail?id=168) and will be agreat enhancement for enterprise por-tals. Account access within the portal

interface is controlled by EnterpriseSecurity. We’ll see how this works inPart 2.

• Sybase Portal Studio: The applicationfor portal development and adminis-tration, Portal Studio allows develop-ers to build a variety of portlets, tem-plates, pages, and catalogs withouthaving to learn any portlet applicationinterfaces (API) (see Figure 1).Developers can create HTML, JSP,XML, database, and Web contentportlets without programming byusing step-by-step wizards or thePortal Studio’s Portlet Builder (seeFigure 2). Portal Studio is a Web appli-cation, so log in using InternetExplorer (or Netscape Communicatorin the Enterprise edition). It also pro-vides a collaborative environment fordevelopers and administrators byoffering workflow, versioning, a searchfilter, detail view, and roles-basedaccess.

All user access within Portal Studio toStudio objects and Portal Interface pagesand portlets is controlled through thePortal Studio Account Manager.

Developers create content in PortalStudio and deploy it for display to endusers in portlets in the Portal Interface.Administrators use both Portal Studioand Portal Interface to perform portaladministrative tasks. Pages and portletswithin a Portal Interface user accountare controlled by either an administratoror by the end user. Portlets created in thePortal Studio can be arranged into pagesthat are automatically added to portal

FIGURE 2 Portal Studio - editing HTML portlet

AUTHOR BIOBerndt Hamboeck is a

senior consultant forBHITCON. He’s a CSI,SCAPC8, EASAC, andSCJP2 and started hisSybase development

using PB5.

www.POWERBUILDERJOURNAL.comPBDJ volume10 issue426

user accounts or made available througha catalog of pages. Alternatively, insteadof selecting an entire page of portlets,portal users have the option to add indi-vidual portlets to their own accountfrom a portlet catalog. Last, users alsohave the ability to define their ownpages and portlets in Portal Interfacethat are not managed within the PortalStudio. Portal Interface and Portal Studioare completely integrated. Changesmade to portlets, catalogs, or pages fromPortal Studio are updated to PortalInterface.

InstallationWhen installing an Enterprise Portal

for the first time, I locked my door andturned off the phone for the entire day. Itshould just be the machine, some CDs,and me. Yes, I was afraid of doing the

installation, but I found that the installa-tion is so easy that it can’t really be calledan installation. However, decide foryourself if that’s true. The following is alist of the steps involved:1. Extract the file to your hard drive (let’s

say this is c:\).2. The evaluation version uses the name

demo.sybase.com. To make yourmachine recognize it, edit your hostsfile. You’ll find it at \winnt\sys-tem32\drivers\etc\hosts. Add a line:

127.0.0.1 demo.sybase.com

3. Go to the directory where youunzipped the files and run the file,startdb.bat. You’ll initially see a fewmessages with “Ping server failed –Database server not found.” This isokay, because the script pings the

database during startup. Wait untilyou see the message “Ping server suc-cessful.” The icon of the “SQL-ASA”database will appear in your taskbar.

4. Within the same directory, run the filestarttomcat.bat. A new window will belaunched and you’ll see several mes-sages starting with “Starting serviceTomcat-Standalone” and “Tomcatconnecting to our ASA database.” Waituntil you see the message “ApacheTomcat/4.0.4”, then minimize thiswindow.

5. To run the evaluation version of theSybase Enterprise Portal use thefollowing URL: http://demo.sybase.com:4040/onepage/index.jsp (seeFigure 3).

6. That’s it. Click on the “Join now” linkand register for the portal (see Figure 4).To run the evaluation version of theSybase Portal Studio use the followingURL: http://demo.sybase.com:4040/onepage/index.html.

Use the existing login account “opsu-per/0psuper”. (Note that the first char-acter of the password is a zero.)To stop the portal:• Close the window containing Tomcat.• Click on the ASA icon in the taskbar

and then on “Shutdown”.

To login again in future sessions, sim-ply perform steps 3 and 4 to start thedatabase and Tomcat, and launch theportal with steps 5 and 6. That’s it. Quiteeasy, isn’t it?

I suggest you get your hands on the EPlight version as soon as possible, installit, and build your first portlets. Nextmonth we’re going to install the “bigbrother,” the Sybase Enterprise Portal5.01, and then we can start building ourown portlets to provide company infor-mation to our employees or customersfrom a single point of entry.

ConclusionThe Sybase Enterprise Portal is aimed

at providing a single, secure browser-based interface to all corporate applica-tions and data. Its design and scopeappeal to companies because it removesthe heavy structure of complex, 32-bitapplications. Only the most frequentlyused functions of each application areexposed, giving users a single point toaccess their information, whether insideor outside the office. With an EnterprisePortal, professionals are then able to usetechnology in the way it was intended,and can quickly and efficiently get onwith their work. ▼

[email protected]

FIGURE 3 Enterprise Portal – Portal Interface

FIGURE 4 Self-registration page

W W W . J D J S T O R E . C O M

GUARANTEED LOWEST PRICES!

▲▲

▲▲

▲▲

▲▲

▲▲▲▲▲▲▲

▲▲

▲▲

▲▲

Web

Services journal

Readers’CHOICE AWARD

WSJWorld class

AWARD

SIMPLICITYSimplicity˙ Enterprise Lite

SYBASEPowerBuilder Enterprise v.8

Introducing PowerBuilder 8! The award-winning, indus-try-leading application development environment justgot better. Release 8 of PowerBuilder adds exciting newfeatures and capabilities that will make your develop-ment of Web, client/server, and distributed applications easier, faster, andmore cost-effective. New features focusing on improved productivity,tighter integration with EAServer, and Web application developmentmake this release indispensable to your development efforts.

ACCELTREEFULCRUM Professional Edition 1.1 - A Java

Code Assembler

“FULCRUM” is a Java development tool that uses a propri-etary concept of code templates that can be used as"building blocks" to construct efficient Java objects andapplications. Unlike code generators that impose their cod-ing techniques and run-time environments on the users, FUL-CRUM allow users to build their own coding standards in the templates andalso lets users switch to manual coding at any point in time.

$2,558.99

OFFER SUBJECT TO CHANGE WITHOUT NOTICE

Simplicity Enterprise Lite provides the ability tobuild server-side, enterprise class Web applica-tions. Using a palette of graphical modules, the developer links togethertheir desired functionality and interactively tests their application in oneseamless development environment. Application targets include Web sites,WAP-enabled mobile devices, n-tier application services, and enterpriseServlets.

$3,999.00$469.99

POINTBASEPointBase Embedded 4.4 - Windows Installer

PointBase® Embedded is a 100% Pure Java˙RDBMS ideal for embedding in your Java appli-cations, within the J2EE˙ and J2SE˙ platforms. PointBase Embedded utilizesa multi-threaded architecture allowing multiple connections from within thesame JVM. PointBase Embedded features also include small footprint archi-tecture, extensibility, referential integrity, near-zero administration, and a lowcost of ownership.

$353.00/N SOFTWARE

IP*Works! SSL Scripting Edition (1 cpu)

IP*Works! SSL adds SSL and Digital Certificate capabilitiesto the IP*Works! Internet Toolkit providing Secure WebBrowsing, Secure Client, Secure Server, Secure Mail,Digital Certificate Management Capabilities, and a lotmore. The current release consists of 15 components forsecure Internet connectivity.

$295.00

BORLANDJBuilder 7 SE NEW-USER 98/W2K/NT/LINUX/SOL

JBuilder˙ is the leading cross-platform environment forlearning Java˙ programming and personal applicationdevelopment. JBuilder 6 Personal includes an integratededitor, debugger, compiler, visual designers, wizards,and tutorials.

$389.99

SHOP ONLINE AT JDJSTORE.COM FOR BEST PRICES OR CALL YOUR ORDER IN AT 1-888-303-JAVA

Attention Java Vendors:To include your product in JDJStore.com, please contact [email protected]

GUARANTEED LOWEST PRICES!

Helping you enable intercompany collaboration on a global scale• Product Reviews• Case Studies• Tips, Tricks

and more!

Now in More

than 5,000

Bookstores Worldwide –

Subscribe NOW!

Go Online & SubscribeToday!*Only $149 for 1 year (12 issues) – regular price $180.

WebLogicDevelopersJournal.comSYS-CON Media, the world’s leading publisher of i-technology magazines for developers,software architects, and e-commerce professionals, brings you the most comprehensive coverage of WebLogic.

SPECIALOFFER!SAVE $31*OFFER SUBJECT TOCHANGE WITHOUT NOTICE

THE WORLD’S LEADING INDEPENDENT WEBLOGIC

DEVELOPER RESOURCE

28 www.POWERBUILDERJOURNAL.comPBDJ volume10 issue4

WRITTEN BYJERRY NEPPL

C O M P O N E N T S

NVOs and NVCsWhat’s the difference?

Adaptations…as software developers we thrive on adaptations. A large partof our present and future work is and will be simply morphing or adaptingour previous efforts or the efforts of others before us.

Sometimes we need to reassemblepieces when an application needs main-tenance and other times we bring piecesfrom our past and get to enjoy the creativethrill of new application development.

Many things in our environment con-stantly change. When PowerBuilder firstcame into being, many of the TLAs(three-letter acronyms) we constantlytoss around today didn’t even exist.While it’s important to utilize good prac-tices, it’s even more important to reeval-uate, improve, and refine the rules welive with everyday. When Sybase addedthe concept of a component to theworld of PowerBuilder, it was logicallyplaced in the realm of the nonvisualobject (NVO). While components areunmistakably NVOs, they are a specificNVO subclass and invariably requirespecial handling whenever they’re used.In order to have meaningful conversa-tion and clear usage practices regardingthese nonvisual components, they mustbe distinguishable from the ancestorNVO – thus the idea of an NVC.

Nonvisual ComponentNVCs should be viewed as separate

mini applications. The scope of NVCfunctionality can be greater than a sin-

gle application. Logic built into an NVCcan be shared across multiple applica-tions and utilized as part of a multi-phased transaction, even transactionsspanning multiple databases. Whenusing an NVC, the execution of logic istransparent to the caller.

NVCs are a great way to shareresources (see Figure 1); however,overuse can also cause problems. If aWeb application uses a large number ofNVCs, be sure the code is not doingintercomponent calls, such as checkingfor an empty string. To illustrate, ifthere’s a form that’s been submitted with30 different fields, you don’t want tomake 30 separate calls to a component.In this case, if you’re running clusteredapplication servers, you could even becalling between different boxes. In thissituation it would be better to use anNVO that’s locally instantiated. Be surethe NVC calls are warranted.

Nonvisual ObjectA nonvisual object is an object that

exists entirely within a single applica-tion scope. NVO classes contain busi-ness rules that are frequently reused.NVOs will always be an extremelyimportant tool for PowerBuilder devel-

opers. Their role is critical for makingrobust and adaptable applications, evenmini applications. When creating anNVO, keep the class size down; this willhelp your performance. It will take lesstime to load the NVO into memory anduse fewer resources while helping exe-cute the rest of your scripts.

Good candidate scripts for NVOs willbe utilitarian and widely reused bits ofcode that help you get basic tasks done,such as special string handling or dateand time functionality. You’ll also findthat time-tested code that’s not likely tochange and that enforces your everydaybusiness rules is a good choice.

If you have existing NVOs, why notuse them inside the components youcreate? Say you have a few killer NVOs,the only problem is they passDataStores; don’t be disappointedbecause the CORBA interface won’tallow you to pass DataStores. Theseexisting NVOs make great helper orinner classes and will give your compo-nents that extra piece of functionalityyou need to make an awesome compo-nent.

The Differences Between NVCs and NVOs

To begin there are extra events foundin NVCs, such as the activate and deacti-vate events, that add additional com-plexity not found in the NVO (see Table1). These added events make NVCs morepowerful and flexible.

Having activate and deactivate eventsimplies NVCs are meant to be pooled inmemory to save the overhead of creatingand destroying an NVC at every use.Conversely, NVOs are usually destroyed;these single-use objects indicate thatNVOs should only be allowed to take upresources when required. Keep in mindthat the single use may include many

JAGUAR

Intercomponent callnvo

NVC NVC

nvo nvo nvo

FIGURE 1 NVCs run as applications in Jaguar. NVOs are instantiated locally to an NVC.

29PBDJ volume10 issue4www.POWERBUILDERJOURNAL.com

method invocations, perhaps for avalidation routine, but when the rou-tine is finished with the NVO, itshould no longer be kept around; thedestructor will get called and theresources will be released.

Each object is used and called dif-ferently. NVCs use proxies and exe-cute remotely to the caller, whileNVOs are loaded into memory withinthe caller’s scope and execute locally.

The preparations required to useeach of the objects is quite different.

An NVO Create statement will pullinto memory the definition of theNVO created. Depending on thenature of the NVO, this may be a sig-nificant use of resources and is likelysomething you don’t want to leavehanging around in memory. Becauseyou would have to call the init() forany subsequent uses, be sure it’sready for the caller. Sometimes it’srequired to pass in the NVO’s parentor the transaction the NVO will par-ticipate in. NVOs will frequentlyrequire that you call one or moremethods to set the NVO to a readystate for method execution.

NVCs require the caller to use aremote interface definition, a proxy,and a connection to the server, whichreturns an IOR pointer. This pointergenerated by a transactionserver.cre-ateinstance() call is simply a string ofinstructions on where to send aremote call and how to package a callto the Object Request Broker (ORB).

NVCs are self-initializing; codeplaced in the activate and deactivateevents should complete the requiredsetup and cleanup for each use. Ifthere are memory-intensive objectslike DataStores, it’s more efficient toplace those in the activate and deacti-vate events. However, to ensure thereare no large result sets hangingaround in memory, call a reset onyour DataStores.

NVOs only have constructor anddestructor events. Frequently this willrequire an Initialization method toallow for the reuse of the object.Passing in a Parent object or a

Transaction object adds extra steps toyour code, important steps that youshouldn’t miss, depending on how theobject is designed.

Holding an instance of an NVCremote interface, a.k.a., an IOR point-er, will always be less costly from aresource point of view than holdingthe entire definition of an NVO.

NVOs require holding a Power-Object variable reference, and thelibrary holding the NVO source mustbe held in memory.

NVOs are internal to PowerBuilder.Even though you may use a particularNVO in many places within an appli-cation, it’s not meant for consump-tion outside of PowerBuilder.

NVCs can be published for theworld at large using CORBA-compli-ant data types, which means you can’texpose the same data types as theNVO.

An NVO’s logic and rules can bereused, but a copy for each applica-tion that uses that logic can eat up alot of resources. An NVC can share thesame instance across multiple appli-cations. Which one is better – sharingor the always-in memory cost –depends on your usage and needs.

While a component shares manyattributes with a standard NVO, thereare enough important differenceswhen we discuss and use regularNVOs and NVCs in development thata distinction should be made. A ser-vice object is different from a servicecomponent. Why waste any timeinferring by context how to handlethe initialization, storage, andcleanup of a given object? Spend thetime talking about the logic thatshould be involved.

If the points I attempted to makesound reasonable, whether or not youagree, keep it in mind for the nextconversation about NVOs and NVOsor rather NVOs and NVCs.

Give the new distinction a whirl; Ibelieve you will find it lends clarityand efficiency to your discussions.▼

AUTHOR BIOJerry Neppl,previously CEO of a small liquidation company, has been working for PowerTeam,Inc., in Minneapolis for the past year and a half,having fun and gettingpaid to play [email protected]

TABLE 1 The differences between NVOs and NVCs

NVO NVC

Events Constructor, Destructor Constructor, Destructor, Activate, and Deactivate

Designed for pooling No Yes

Execution related to caller Locally Remotely

Self-initializing No Yes

CORBA-compliant public No Yesinterface required

Meant for public consumption No Yes

Calling Sleek Geeks Everywhere!

Make sure you have your finger on the pulse of i-Technology...bookmark http://developer.sys-con.com today.

i-Technology

Newsi-Technology

Viewsi-Technology

Commenti-Technology

Debate

STEP UPto the mike

and be...

STEP UPto the mike

and be...

ATTN: Developers

HEARD!HEARD!

Go to http://developer.sys-con.com

©C

OP

YR

IGH

T 2

002,

SY

S-C

ON

ME

DIA

W

WW

.SY

S-C

ON

.CO

M

30 PBDJ volume10 issue4 www.POWERBUILDERJOURNAL.com

WRITTEN BYJESSICA BRONESKY

F R O M S Y B A S E

Got Code? Want Code?Come to the source

Are you tired of searching the Internet for utilities, snippets, andbits of code to show you how to do something or even to do itfor you?

AUTHOR BIOJessica Bronesky is the

manager of the SybaseDeveloper Network and

has managed many software development

projects. She holds a BAfrom Stanford. Unlike theother PBDJ authors, shehas not written any PB9

books or taught advancedPB classes. She’s cool

though, and that’s whatcounts. Her goal is tobring value to Sybasedevelopers, so let her

know how Sybase canimprove SDN.

Many Web sites provide some of this,but they’re spread all around the world.What if you could find everything in oneplace? You, the Sybase techies, have beenasking us to provide this site as well as amechanism that will enable developersaround the world to collaborate. Well,we’ve done it! In early April, Sybaselaunched a new resource expressly for itstechie community. SDN CodeXchange,from the Sybase Developer Network,allows for the free exchange of code sam-ples, utilities, scripts, and other tools.Content in CodeXchange is not support-ed by Sybase, but can come from anySybase user, customer, or employee – allof whom will benefit from the contribu-tions of others.

CodeXchange also hosts collaborativedevelopment projects where users canwork on a joint project involving a gen-eral technology or a specific aspect of aSybase product, including open source.Sybase is sponsoring CodeXchange sole-ly for the benefit of SDN members – it’sall technical stuff, for techies, by techies.Now it’s your turn to do your part. Weneed you to participate and contributesamples, utilities, and snippets. The suc-cess of this project depends on you!

How It WorksCodeXchange is organized around

projects, each of which contains specifictools like file sharing (for code samples)and Concurrent Versioning System(CVS) for larger pieces of code, utilities,or open-source projects that need totrack changes between versions. Project“communities” address specific prod-ucts such as PowerBuilder, ASE, andEAServer. Other communities focus onmore general technologies, such asSybase Open Source for ebXMLMessaging. In each project, Code-Xchange provides the following featuresto facilitate communication andinvolvement:• File sharing• Code revision control (CVS)• Mailing lists• Issue and bug tracking• Customizable project pages• Web-based, secure environment

Any SDN member can accessCodeXchange by signing on toMySybase or SDN from the Sybase.comsite. You can then browse or join exist-ing projects, and suggest new ones. Youcan download pieces of code you find ina particular project and, more impor-tant, submit code or tools that you’vecreated.

Need a utility that works with a newversion of PowerBuilder? Find one on

CodeXchange, download it, change it,and submit it back.

Have a code sample you think othersmight find useful? Submit it to theappropriate project and make a namefor yourself in the community.

Your level of involvement is up to you;you can simply observe, or you canassign or fix defects in the code you find,communicate with other members viamailing lists, and submit your own work.The more people who contribute, themore valuable the community will be forits members, so we’re looking for eagerparticipants.

CodeXchange will be of particularinterest to PowerBuilder users with therelease of PowerBuilder 9. We havealready aggregated our existing Sybase-produced samples and utilities, includ-ing new PB 9 sample code. We have anumber of contributions from

TeamSybase, including several PBNI-related open-source utilities (you’ll seesome articles about these utilities inupcoming issues of PBDJ). Come down-load the source for these, upload yourown, and start collaborating!

CodeXchange is similar to a librarythat contains only donations so it willstart off small, but we expect it to growrapidly as the Sybase world centralizesall their collaborative efforts there.

You can access CodeXchange via SDNat www.sybase.com.developer. If you’renot an SDN member, you can sign up atthe Web site. Everyone is welcome. Seeyou there! ▼

“SDN CodeXchange, from the SybaseDeveloper Network, allows for the free

exchange of code samples, utilities,scripts, and other tools” [email protected]

31PBDJ volume10 issue4www.POWERBUILDERJOURNAL.com

800 513-7111

www.sys-con.com

The world’s leading i-technogy publisher

SUBSCRIBE NOWTO THEFINESTTECHNICALJOURNALSIN THE INDUSTRY!

the annual newsstand rateSAVE$31Off*

SAVE$31Off*

Receive 12 issues of PBDJ for only $149.00. That’s a savings of $31 off the annual newsstand rate.

Visit our site at www.powerbuilderjournal.com or call 1-888-303-5282 and subscribe today!

ANNUAL COVER PRICE

$180.00ANNUAL NEWSSTAND RATE

$149.00

$31

YOU PAY

YOU SAVEOff the AnnualNewsstand Rate

• New PowerBuilder Features • Tips, Tricks and Techniques in

Server-Side Programming • DB Programming Techniques • Tips on Creating Live PowerBuilder Sites • Product Reviews • Display Ads of the Best Add-on Products • PowerBuilder User Group Info

Here’s whatyou’ll find in every

issue of PBDJ

Here’s whatyou’ll find in every

issue of PBDJ• New PowerBuilder Features • Tips, Tricks and Techniques in

Server-Side Programming • DB Programming Techniques • Tips on Creating Live PowerBuilder Sites • Product Reviews • Display Ads of the Best Add-on Products • PowerBuilder User Group Info

*Offer subject to change without notice

PBDJ ADVERTISER INDEXADVERTISER URL PHONE PAGE

Advertiser is fully responsible for all financial liability and terms of the contract executed by theiragents or agencies who are acting on behalf of the advertiser. This index is provided as an addi-tional service to our readers. The publisher does not assume any liability for errors or omissions.

Amyuni Technologies, Inc. www.amyuni.com 866-926-9864 2

E.Crane Computing www.ecrane.com 35

JDJ Store www.jdjstore.com 888-303-JAVA 27

JDJ Workshop www.sys-con.com/education 201-802-3058 23

Linux Business & Technology www.sys-con.com 888-303-5282 17

PowerObjects www.powerobjects.com 612-339-3355 36

Sybase www.sybase.com/powerbuilder 11

Sybase, Inc www.sybase.com/pbextension 9

Sybase, Inc www.sybase.com/powerbuilder 5

SYS-CON Media http://developer.sys-con.com 888-303-5282 29

SYS-CON Reprints www.sys-con.com 201-802-3026 27

SYS-CON Subscription Offer www.sys-con.com/suboffer.cfm 888-303-5282 32, 33

Web Logic Developer's Journal www.weblogicdevelopersjournal.com 888-303-5282 27

Web Services Journal www.sys-con.com 888-303-5282 19

and receive yourFREE CD Gift Package VIAPriority MailEach CD is an invaluable developerresource packed with important articles and useful source code!

The largest and most complete library of exclu-sive XML-Journal articles compiled on one CD!Edited by well-known Editors-in-Chief Ajit Sagarand John Evdemon, these articles are organizedinto more than 30 chapters containing morethan 1,150 articles on Java & XML, XML &XSLT, <e-BizML>, data transition... and more!

LIST PRICE $198

The most up-to-date collection of exclusiveWSDJ articles! More than 200 articles offerinsights into all areas of WebSphere, includ-ing Portal, components, integration, tools,hardware, management, sites, wireless pro-gramming, best practices, migration...

LIST PRICE $198

The most complete library of exclusive CFDJarticles on one CD! This CD, edited by CFDJEditor-in-Chief Robert Diamond, is organizedinto more than 30 chapters with more than 400exclusive articles on CF applications, customtags, database, e-commerce, Spectra, enter-prise CF, error handling, WDDX... and more!

LIST PRICE $198

More than 1,400 Web services and Java articleson one CD! Edited by well-known editors-in-chief Sean Rhody and Alan Williamson, thesearticles are organized into more than 50 chap-ters on UDDI, distributed computing, e-busi-ness, applets, SOAP, and many other topics.Plus, editorials, interviews, tips and techniques!

LIST PRICE $198

The most complete library of exclusive JDJarticles compiled on one CD! Assembled byJDJ Editor-in-Chief Alan Williamson, morethan 1,400 exclusive articles are organizedinto over 50 chapters, including fundamen-tals, applets, advanced Java topics, Swing,security, wireless Java,... and much more!

LIST PRICE $198

An up-to-the-minute collection of exclusive LinuxBusiness & Technology articles plus MaureenO'Gara's weekly LinuxGram, which keeps a finger onthe pulse of the Linux business community. Editedby LBT's Editor-in-Chief Alan Williamson, these arti-cles cover migration, hardware, certification, and thelatest Linux-related products. Available June 2003!

LIST PRICE $198

The most complete library of exclusive WLDJarticles ever assembled! More than 200 arti-cles provide invaluable information on “every-thing WebLogic”, including WebLogic Server,WebLogic Portal, WebLogic Platform,WebLogic Workshop, Web services, security,migration, integration, performance, training...

LIST PRICE $198

Pick the CDsto go with yourMulti-Pack orderPick one CD withyour 3-Pack orderPick two CDs withyour 6-Pack orderPick three CDs withyour 9-Pack order

Your order will beprocessed the same day!

■ Web Services Resource CD■ Java Resource CD■ WebLogic Resource CD■ ColdFusion Resource CD■ XML Resource CD■ WebSphere Resource CD■ Linux Resource CD

Subscribe Online Today

A LIMITED TIME SAVINGS

Go To www.sys-con.com/suboffer.cfmSUBSCRIBE TODAY TO MULTI

■■■■■■■

I3-PackPick any 3 of our magazines and saveup to $27500

Pay only $175 for a 1 year subscriptionplus a FREE CD• 2 Year – $299.00• Canada/Mexico – $245.00• International – $315.00

6-PackPick any 6 of our magazines and saveup to $35000

Pay only $395 for a 1 year subscriptionplus 2 FREE CDs• 2 Year – $669.00• Canada/Mexico – $555.00• International – $710.00

9-PackPick 9 of our magazines and saveup to $40000

Pay only $495 for a 1 year subscriptionplus 3 FREE CDs• 2 Year – $839.00• Canada/Mexico – $695.00• International – $890.00

RECEIVEYOUR DIGITAL

EDITIONACCESS CODEINSTANTLY

WITH YOUR PAID SUBSCRIPTIONS

www.sys-con.com/2001/sub.cfm

■ Web Services JournalU.S.- Two Years (24) Cover: $168 You Pay: $99.99 / Save: $68 + FREE $198 CDU.S. - One Year (12) Cover: $84 You Pay: $69.99 / Save: $14Can/Mex - Two Years (24) $192 You Pay: $129 / Save: $63 + FREE $198 CDCan/Mex - One Year (12) $96 You Pay: $89.99 / Save: $6Int’l - Two Years (24) $216 You Pay: $170 / Save: $46 + FREE $198 CDInt’l - One Year (12) $108 You Pay: $99.99 / Save: $8

■ Java Developer’s JournalU.S. - Two Years (24) Cover: $144 You Pay: $89 / Save: $55 + FREE $198 CDU.S. - One Year (12) Cover: $72 You Pay: $49.99 / Save: $22Can/Mex - Two Years (24) $168 You Pay: $119.99 / Save: $48 + FREE $198 CDCan/Mex - One Year (12) $84 You Pay: $79.99 / Save: $4Int’l - Two Years (24) $216 You Pay: $176 / Save: $40 + FREE $198 CDInt’l - One Year (12) $108 You Pay: $99.99 / Save: $8

■ Linux Business & TechnologyU.S. - Two Years (24) Cover: $143 You Pay: $79.99 / Save: $63 + FREE $198 CDU.S. - One Year (12) Cover: $72 You Pay: $39.99 / Save: $32Can/Mex - Two Years (24) $168 You Pay: $119.99 / Save: $48 + FREE $198 CDCan/Mex - One Year (12) $84 You Pay: $79.99 / Save: $4Int’l - Two Years (24) $216 You Pay: $176 / Save: $40 + FREE $198 CDInt’l - One Year (12) $108 You Pay: $99.99 / Save: $8

■ .NET Developer’s JournalU.S. - Two Years (24) Cover: $168 You Pay: $99.99 / Save: $68 + FREE $198 CDU.S. - One Year (12) Cover: $84 You Pay: $69.99 / Save: $14Can/Mex - Two Years (24) $192 You Pay: $129 / Save: $63 + FREE $198 CDCan/Mex - One Year (12) $96 You Pay: $89.99 / Save: $6Int’l - Two Years (24) $216 You Pay: $170 / Save: $46 + FREE $198 CDInt’l - One Year (12) $108 You Pay: $99.99 / Save: $8

■ XML-JournalU.S. - Two Years (24) Cover: $168 You Pay: $99.99 / Save: $68 + FREE $198 CDU.S. - One Year (12) Cover: $84 You Pay: $69.99 / Save: $14Can/Mex - Two Years (24) $192 You Pay: $129 / Save: $63 + FREE $198 CDCan/Mex - One Year (12) $96 You Pay: $89.99 / Save: $6Int’l - Two Years (24) $216 You Pay: $170 / Save: $46 + FREE $198 CDInt’l - One Year (12) $108 You Pay: $99.99 / Save: $8

■ ColdFusion Developer’s JournalU.S. - Two Years (24) Cover: $216 You Pay: $129 / Save: $87 + FREE $198 CDU.S. - One Year (12) Cover: $108 You Pay: $89.99 / Save: $18Can/Mex - Two Years (24) $240 You Pay: $159.99 / Save: $80 + FREE $198 CDCan/Mex - One Year (12) $120 You Pay: $99.99 / Save: $20Int’l - Two Years (24) $264 You Pay: $189 / Save: $75 + FREE $198 CDInt’l - One Year (12) $132 You Pay: $129.99 / Save: $2

■ WebLogic Developer’s JournalU.S. - Two Years (24) Cover: $360 You Pay: $169.99 / Save: $190 + FREE $198 CDU.S. - One Year (12) Cover: $180 You Pay: $149 / Save: $31Can/Mex - Two Years (24) $360 You Pay: $179.99 / Save: $180 + FREE $198 CDCan/Mex - One Year (12) $180 You Pay: $169 / Save: $11Int’l - Two Years (24) $360 You Pay: $189.99 / Save: $170 + FREE $198 CDInt’l - One Year (12) $180 You Pay: $179 / Save: $1

■ Wireless Business & TechnologyU.S. - Two Years (24) Cover: $144 You Pay: $89 / Save: $55 + FREE $198 CDU.S. - One Year (12) Cover: $72 You Pay: $49.99 / Save: $22Can/Mex - Two Years (24) $192 You Pay: $139 / Save: $53 + FREE $198 CDCan/Mex - One Year (12) $96 You Pay: $79.99 / Save: $16Int’l - Two Years (24) $216 You Pay: $170 / Save: $46 + FREE $198 CDInt’l - One Year (12) $108 You Pay: $99.99 / Save: $8

■ PowerBuilder Developer’s JournalU.S. - Two Years (24) Cover: $360 You Pay: $169.99 / Save: $190 + FREE $198 CDU.S. - One Year (12) Cover: $180 You Pay: $149 / Save: $31Can/Mex - Two Years (24) $360 You Pay: $179.99 / Save: $180 + FREE $198 CDCan/Mex - One Year (12) $180 You Pay: $169 / Save: $11Int’l - Two Years (24) $360 You Pay: $189.99 / Save: $170 + FREE $198 CDInt’l - One Year (12) $180 You Pay: $179 / Save: $1

■ WebSphere Developer’s JournalU.S. - Two Years (24) Cover: $360 You Pay: $169.99 / Save: $190 + FREE $198 CDU.S. - One Year (12) Cover: $180 You Pay: $149 / Save: $31Can/Mex - Two Years (24) $360 You Pay: $179.99 / Save: $180 + FREE $198 CDCan/Mex - One Year (12) $180 You Pay: $169 / Save: $11Int’l - Two Years (24) $360 You Pay: $189.99 / Save: $170 + FREE $198 CDInt’l - One Year (12) $180 You Pay: $179 / Save: $1

■ 3-Pack ■ 1YR ■ 2YR ■ U.S. ■ Can/Mex ■ Intl.

■ 6-Pack ■ 1YR ■ 2YR ■ U.S. ■ Can/Mex ■ Intl.

■ 9-Pack ■ 1YR ■ 2YR ■ U.S. ■ Can/Mex ■ Intl.

•Choose the Multi-Pack you want to order by checkingnext to it below. •Check the number of years you want toorder. •Indicate your location by checking either U.S.,Canada/Mexico or International. •Then choose which magazines you want to include with your Multi-Pack order.

TOORDER

Pick a 3-Pack, a 6-Pack or a 9-Pack

OFFER FROM SYS-CON Media

OFFER SUBJECT TO CHANGE WITHOUT NOTICE

PLE MAGAZINES ONLINEAND SAVE UP TO $400 ANDRECEIVE UP TO 3 FREE CDs!

34 www.POWERBUILDERJOURNAL.comPBDJ volume10 issue4

EASERVEREAServer 4.22/11 – Sybase announced theavailability of EAServer 4.2, anopen application server that hasbeen selected by a growing num-ber of state and regional govern-ments for its uncompromisingperformance and support forsecure Web services within an“open-choice” development anddeployment environment. Asevidenced by forward-thinkingcustomers including HennepinCounty, Minnesota; the TexasWorkforce Commission; andWellington City Council, NewZealand, government agenciesand enterprises alike are increas-ingly turning to Sybase EAServerfor the technology infrastructureto help them unlock the value oftheir existing data and to quicklydevelop and deploy new servicesand applications.

IANYWHERENEC2/12 – iAnywhere Solutions, asubsidiary of Sybase, announcedan agreement with NECCorporation to stimulate thedevelopment of mobile, wireless,and remote database-poweredsolutions in Japan. As part of thisrelationship, NEC will resell SQLAnywhere Studio, the iAnywhereSolutionsmarket-lead-ing mobiledata management and enter-prise synchronization solution.The companies will also worktogether to develop new enter-prise applications that extendbusiness-critical informationfrom a variety of data sources –including databases from IBM,Microsoft, Oracle, and Sybase –to PCs, laptops, and mobiledevices. www.nec.com

Manage Anywhere Studio 52/03 – iAnywhere Solutions, asubsidiary of Sybase, announced

Manage Anywhere Studio 5, pro-viding a full life-cycle manage-ment solution for enterpriseapplications and hardwareincluding PCs, laptops, andmobile devices. This new versionintroduces new OS migrationcapabilities, enhanced mobilesecurity, and new specializedsoftware modules – enablingcompanies to select just the fea-tures they require today and eas-ily add new functionality in thefuture. Manage Anywhere Studio5 features targeted softwaremodules to address specificbusiness needs including assetmanagement, live support,mobile and remote softwaredeployment, and OS migration.

KoKo Link2/03 – iAnywhere Solutions, asubsidiary of Sybase, announcedthat PDS Research selected SQLAnywhere Studio and Manage

Anywhere Studio for use in itscardiopulmonary diagnosticequipment. PDS Research willleverage technology fromiAnywhere Solutions to power itsKoKo Link solution, which isprovided to laboratories to testpatient breathing capacity aspart of clinical drug trials.www.pulmonarydata.com

POWERBUILDERPowerBuilder 9.03/04 – Sybase announced thatPowerBuilder 9.0 is currently

scheduled for general availabilitythe week of March 24. This ver-sion of Sybase’s industry-leadingrapid application developmenttool enables developers to con-tinue building rich-client appli-

cations for their mission-criticalbusiness requirements, and atthe same time propel them fur-ther into Web and n-tier devel-opment with significant newcapabilities. PowerBuilder 9.0also lays the foundation for“4GLplus,” the next RAD envi-ronment from Sybase that willbring an even higher level ofdeveloper productivity throughtight integration of design, mod-eling, development, deployment,and management.

ADAPTIVE SERVERENTERPRISEDBXray3/03 – Sybase announced theavailability of ASE PerformanceMonitoring Option – DBXray forSybase, a part of the SmartDBAsolution for comprehensiveenterprisedata man-agementfrom BMC Software Inc., a leaderin enterprise management.DBXray for Sybase simplifiesdatabase management througha performance “dashboard,”allowing database administra-tors (DBAs) to easily monitor thehealth of an overall system,anticipate and solve potentialproblems, and achieve a 24-hourview of activity for database per-formance optimization. The toolwill be available as an option inSybase Adaptive ServerEnterprise 12.5.0.3, Sybase’senterprise-class relational data-base management system, andwill be supported by Sybase.

CORPORATEAvantGo2/26 – Sybase announced thecompletion of its acquisition ofAvantGo, a leading provider ofmobile enterprise software.Sybase will operate AvantGo inconjunction with its iAnywhereSolutions subsidiary, strengthen-ing the company’s leadership

position in the mobile middle-ware market. AvantGo stock-holdersapprovedthe acquisi-tion by Sybase of all outstandingshares of AvantGo for cash con-sideration of approximately$1.029 per share. AvantGo com-mon stock will no longer bepublicly traded. The majority ofAvantGo employees are joiningiAnywhere Solutions and will beworking in the Dublin,California, headquarters. www.avantgo.com

iAnywhere Solutions Subsidiary2/12 – iAnywhere Solutions, asubsidiary of Sybase, announcedthe formation of iAnywhereSolutions K.K. in Japan. This newsubsidiary of iAnywhereSolutions will work to developand expand the company’s pres-ence in the Japanese mobile,remote, embedded, and work-group database and mobile mid-dleware markets. NoriyukiHayakawa, who has directed thecompany’s mobile and embed-ded operations in Japan as vicepresident of Sybase K.K. andcountry manager for iAnywhereSolutions, Inc., will become thepresident of the new subsidiary.

EVENTSThe Fifth Annual EAServer 4.2 andSybase Tools SeminarMinneapolis, MNApril 7, 2003www.powerobjects.com/seminar

TechWave 2003Orlando, FLAugust 4–8, 2003www.sybase.com/techwave2003 ▼

[email protected]

PowerBuilder NewsAll things of interest to the PB community BY BRUCE ARMSTRONG

www.POWERBUILDERJOURNAL.com 35PBDJ volume10 issue4

E.Crane Computingwww.ecrane.com

36 www.POWERBUILDERJOURNAL.comPBDJ volume10 issue4

PowerObjectswww.powerobjects.com