YOUR FEEDBACK
John Portnov wrote: This code does not work for me. I created a new website and a C# console applic...
AJAXWorld RIA Conference
$300 Savings Expire August 22
Register Today and SAVE!

SYS-CON.TV
TOP THREE LINKS YOU MUST CLICK ON


SQL Anywhere Studio 9 Developer's Guide
A new book by Breck Carter

As a PowerBuilder developer I'm sure you have already used SQL Anywhere a few times, but did you know that SQL Anywhere owns over 70% of the mobile database market?

There are several good reasons for this big market share; it's easy to use, easy to administer, and doesn't take up much space, but SQL Anywhere isn't just for mobile and embedded databases; it's got the features and the flexibility to work as a network server with hundreds of active users pounding away on a single database. And it's got a solid foundation and a long history from its roots with Watcom in the 1980s through to Powersoft and Sybase in the 1990s and now with iAnywhere Solutions in the new millennium. But there are still some features that aren't fully covered by the documentation so Breck Carter decided to write a book about this wonderful database. It's called SQL Anywhere Studio 9 Developer's Guide. So let's have a look at this book this month.

The Book
The book includes a companion CD that includes the full Backus-Naur Form notation for the SQL syntax from the book in HTML format for easy browsing. It also includes all of the examples in the book, plus a full copy of SQL Anywhere Studio 9 Developer Edition for Windows. The book itself is about 450 pages long and starts with the history of the database, beginning with the story of Watcom in 1965 and ending with the release of SQL Anywhere version 9. Then the reader dives into the deep world of the product and learns a lot in the next 10 chapters.

Chapter 1: Creating
This chapter begins with 12 rules to answer the question "What is a relational database?" It then describes the five kinds of tables (global permanent, global temporary, remote, proxy and local temporary) available using the seven different syntax options for the CREATE TABLE statement and, moving on to the wide variety of built-in string, date-time, and numeric data types, it continues with column properties, computed columns, default values, the NULL property, and column constraints. User-defined data types, table constraints, remote data access, and temporary tables are also covered. The chapter ends with a discussion of normalization to answer the question, "What is a good relational database?" An interesting chapter, compactly written.

Chapter 2: Inserting
With the first chapter covering so much information, the second one is exactly right. It talks about putting data into the database, covering five different flavors of INSERT (with a values list for all columns or a list of named columns, a select for all column values or a list of named columns, and use of the auto name facility as well as the load table statement and ISQL's client-side alternative, the input statement.

Chapter 3: Selecting
This one talks about the inverse of Chapter 2, getting data out of the database with SELECT, UNLOAD, and the ISQL OUTPUT statement. This is the longest chapter in the book, which should come as no surprise since the SQL SELECT statement may be the most powerful and complex single syntactic construction available in any database programming language.

Chapter 3 starts by explaining the SELECT statement, and the logical execution of a SELECT, which shows how all the various clauses fit together and contribute to the final result set without concern for how SQL Anywhere actually executes a SELECT. Most of the rest of Chapter 3 follows the steps laid out and explained at the beginning of the chapter. If you've ever had trouble with the GROUP BY clause, or had a SELECT that returned 10,000 rows instead of the three you wanted, or wondered why you can't call NUMBER(*) in a WHERE clause, this is the chapter for you.

Chapter 4: Updating
This chapter covers the UPDATE statement and how it can be used to update a single row in one table, or multiple rows, or even multiple rows in multiple tables. It also includes a section on the logical execution of a set UPDATE and a discussion of cursor UPDATE statements using the WHERE CURRENT OF clause.

Chapter 5: Deleting
Breck calls deleting the evil twin of Chapter 4; he talks about deleting single and multiple rows, and includes a section on the logical execution of a set DELETE as well as information about cursor DELETE statements using WHERE CURRENT OF. He also has a section on TRUNCATE TABLE and how it compares with DELETE: sometimes faster, sometimes not, and why.

Chapter 6: Fetching
A chapter six is a chapter a PowerBuilder developer should read since it talks about the DECLARE, OPEN, FETCH, and CLOSE statements as they apply to cursors using SELECT queries and procedure calls. It also describes the cursor FOR loop, which vastly simplifies the cursor loops in SQL by eliminating the need to DECLARE all those local variables or code those endless FETCH lists. Something a PowerBuilder developer doesn't do very often because of the datawindow and datastore we have.

Chapter 7: Synchronizing
Here you have it - the MobiLink chapter. It discusses how the MobiLink server works together with the MobiLink client for ASA to synchronize data back and forth between a consolidated database and dozens or thousands of remote databases. MobiLink scripts are classified by level (connection, session, table, and row) and by direction (upload versus download). And error handling on the server and client sides is described. This is an interesting chapter for every serious PocketBuilder developer. I can highly recommend it if you want to synchronize your mobile device with a desktop machine.

Chapter 8: Packaging
This chapter is about moving application logic into the database using BEGIN blocks and SQL modules based on BEGIN blocks: procedures, functions, triggers, and events. The SET assignment statement is described, as well as the flow-of-control structures IF, CASE, and WHILE, the EXECUTE IMMEDIATE statement, and the connection-level CREATE VARIABLE statement. This section introduces the basics of exception handling, a topic expanded on in Chapter 9.

Chapter 9: Protecting
Chapter 9 is the second-longest chapter in the book. It explores a wide variety of topics including options, transactions, exceptions, errors, subtransactions, locks, blocks, isolation levels, deadlocks, mutexes, user IDs, privileges, user groups, logging, recovery, backup, restore, and (gasp!) database validation. Many of these topics are only loosely connected to one another, but they all fall under the general heading "Crashing, Bashing, Thrashing, and Protection Therefrom."

Chapter 10: Tuning
This chapter might be the one with the biggest audience since everyone's interested in speed, speed, speed. This chapter should be read last because the first rule of optimization is "Don't do it." If you're an expert, Rule 2 also applies: "Don't do it yet."

Chapter 10 explains the four big performance tuning tools that SQL Anywhere provides: request-level logging, the Index Consultant, the Execution Profiler, and the Graphical Plan. It then moves on to more arcane topics such as file, table, and index fragmentation, and table, index, and database reorganization.

Sections on the syntax of CREATE INDEX and database performance counters are included, and the book ends with a performance tuning "Tips and Techniques" section that lists 36 do's and don'ts that didn't find a home earlier in the book.

Conclusion
The book is easy to read and contains important details about SQL Anywhere development. If you're new to SQL Anywhere the material will save you hours of time and dramatically shorten your learning curve. This book is simply a must-have for SQL Anywhere database developers because it's a complete and compact reference for experienced developers as well as comprehensive immersion for beginners and less experienced coders. It's written by someone who has a great deal of experience using SQL Anywhere Studio to build real-world software solutions. Have fun reading it.

SIDEBAR

Breck Carter is an experienced database developer. He first worked with a relational database in 1973 (the year I was born) before there were any practical commercial implementations. Over the years he has worked as an independent consultant to develop enterprise databases and applications using IMS DB/DC, DB2, Oracle, SQL Server, ASE, and, beginning in 1995, SQL Anywhere.

Breck has been a member of Team Sybase since 1993, which means you can find him answering questions on the SQL Anywhere newsgroups on behalf of Sybase and iAnywhere Solutions. He is also a member of the iAnywhere Solutions Customer Advisory Board, helping to shape future product direction.

About Berndt Hamboeck
Berndt Hamboeck is a senior consultant for BHITCON (www.bhitcon.net). He's a CSI, SCAPC8, EASAC, SCJP2, and started his Sybase development using PB5. You can reach him under admin@bhitcon.net.

WEBSPHERE LATEST STORIES . . .
IBM announced that Vantage Deluxe World Travel has increased sales and improved business operations since turning to IBM to run its Web site and online booking system. Since switching to IBM WebSphere Commerce software, Vantage Travel has reduced order-taking time by 80 percent and inc...
Red Hat CTO Brian Stevens, Citrix CTO Simon Crosby, Egenera CTO Pete Manca, Allen Stewart, Group Manager, Windows Virtualization at Microsoft, and Brian Duckering, Sr. Director of Products and Alliances at Symantec were the top industry executives who joined Jeremy Geelan in the 4th Fl...
Mike Neil is general manager for virtualization strategy in the Windows Server Division at Microsoft. Mike is focused on the delivery of the Windows virtualization technology, including Windows Server 2008 Hyper-V, Microsoft Hyper-V Server and Virtual PC 2007. Mike also directs the tec...
The AJAX for IBM WebSphere Platform Early Program is an optionally installable product extension for IBM WebSphere Application Server Version 6.1 and WebSphere Application Server Community Edition that offers targeted, incremental new features that can make Web applications running on ...
Two of the biggest launches in Rich Internet Application history took place in 2007/2008 when Adobe launched AIR 1.0 in February '08 and Microsoft launched Silverlight (September '07). At the 6th International AJAXWorld RIA Conference & Expo in October SYS-CON Events is delighted to be...
Unify announced the expansion of its Composer for Lotus Notes solution through a partnership with CASAHL Technology. Partnering with CASAHL extends the Composer solution to include an assessment of the Lotus Notes infrastructure in order to inventory, categorize and analyze the types o...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE
BREAKING WEBSPHERE NEWS
Today at the TDWI World Conference, IBM (NYSE: IBM) introduced new versions of two software product...