Comments
Matt McLarty wrote: For more info... Follow me on Twitter See our website
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


Book Excerpt: Sybase Adaptive Server Anywhere
A powerful database

Sybase's Adaptive Server Anywhere (ASA) is a small footprint, low maintenance database designed for mobile, embedded, personal and workgroup settings. In spite of its compact nature, it still provides all the "big iron" features, such as replication, synchronization, and Java in the database.

It is also a very flexible database, which makes it highly suitable for use in the development of prototypes for applications that might eventually be implemented in other database systems. Finally, it's the one database that is provided with PowerBuilder (a single-user license that can be upgraded).

Connecting via PowerBuilder
Many of the other databases that PowerBuilder supports have a native client layer that the PowerBuilder driver interacts with. ASA does not provide such a native client layer. Instead, the interfaces it supports (e.g., ODBC, OLE DB, embedded SQL, and JDBC) interact directly with the database.

Configuring the PowerBuilder Connection Profile
PowerBuilder developers normally use the ASA ODBC driver to interact with ASA. The discussion of configuring an ODBC connection through DBParm parameters or editing the PBODB90.INI file are applicable to the use of ASA. Therefore, we will only be covering those same parameters here on a limited basis.

Data Types
ASA provides a number of common data types. Table 1 presents a description of the ASA data types and their analogous PowerBuilder native data types.

Development Time Considerations
When building client/server applications that target ASA databases, there are several development time aspects that should be considered. Choices that should be made early in the development cycle include how to best deal with the case sensitivity, whether or not to use qualified SQL in your PowerScript code and DataWindow objects, and whether or not to employ the PowerBuilder extended attribute tables. We'll explore these and other topics in the section that follows.

Identifier Case
ASA is a case-insensitive database in terms of identifiers such as table and column names. For example, a table could be created in mixed case as Employee, and referred to as Employee, EMPLOYEE, or employee. Note that unlike other databases, ASA remains case-insensitive even when the SQL statement is delimited.

SELECT LNAME, FNAME FROM EMPLOYEE
SELECT lname, fname FROM employee
SELECT Lname, FnAmE FROM EMPloyEE

SELECT "LNAME", "FNAME" FROM "EMPLOYEE"
SELECT "lname", "fname" FROM "employee"
SELECT "Lname", "FnAmE" FROM "EMPloyEE"

Other databases are case-sensitive, particularly if the SQL statements are delimited. Therefore, if your intent is to write cross-database applications, care should be taken with regard to the use of SQL delimiters and mixed case. The safest approach to use in this regard is to use upper case for database object names and avoid the use of embedded reserved words or characters that would require the use of delimiters.

Qualifying SQL with Owner Names
Like many other databases, ASA requires a database object reference to be qualified with the owner name. That is, there could be several EMPLOYEE tables in the database, each one under a different owner. When an unqualified SQL statement is submitted to the database, it assumes that the user is attempting to access a table that they own, essentially prefixing the user name to the object reference.

For a number of reasons the requirement for such prefixes may not be desired, particular for cross-database support. An easy way to accomplish this with ASA is to use ASA's group feature. Instead of creating the database objects under a specific user ID, create a group that is allowed to connect to the database (see Figure 1) and has Resource authority (the right to create tables and other database objects). Then use that group ID to create the database objects.

The developers can then be added to that group (see Figure 2), which allows them to reference the tables in code without requiring an owner prefix.

Note that adding a member to a group that has table creation rights doesn't mean that the users themselves will inherit such rights. They only inherit the object permissions, not the authorities, of the groups they are members of. Similarly, you would want to create a group with more limited rights that you would then make the end users of the applications members of.

Since the group is creating the tables in the database, the PowerBuilder catalog tables will also get created under that group ID. You'll need to have the developers ensure that their connection profiles to the database reference the group ID as the owner of those tables (see Figure 3).

Even though membership in the group means that the owner prefix is no longer required, PowerBuilder by default includes it anyway in all of the painters. This behavior can be changed through the PBTableOwner parameter in the PBODB090.INI file (see Figure 4).

Note that this parameter affects the display of all tables in the painters, not just those for which the user is a member of the group that owns them. The TableOwner setting of the TableCriteria DBParm parameter can be used to restrict these object lists to a particular group.

Interacting with the Database
There are three primary means of interacting with the ASA database from PowerBuilder: the DataWindow, stored procedures in the database, and embedded SQL. This division is somewhat artificial, as these methods can actually be combined. In particular, stored procedures can be used to select, update, insert, and delete methods for a DataWindow and stored functions can be used within embedded SQL statements. Such advanced techniques are covered in the following as well.

DataWindows
The simplest method of defining the source for a DataWindow's data is a simple select statement such as:

SELECT emp_id,
    manager_id,
    dept_id,
    emp_fname,
    emp_lname
FROM employee

If the intent is to show the employee's full name in such a case, a computed field could be added to the DataWindow that concatenates the emp_fname and emp_lname columns. Alternatively, the SQL statement could be modified to perform the concatenation through a computed column as the data is being retrieved:

SELECT emp_id,
    manager_id,
    dept_id,
    emp_fname || ' ' || emp_lname as emp_fullname
FROM employee

About Bruce Armstrong
Bruce Armstrong is a development lead with Integrated Data Services (www.get-integrated.com). A charter member of TeamSybase, he has been using PowerBuilder since version 1.0.B. He was a contributing author to SYS-CON's PowerBuilder 4.0 Secrets of the Masters and the editor of SAMs' PowerBuilder 9: Advanced Client/Server Development.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

1. What is the exact diffrence between server and database?
2.Adaptive servers works as normal server or it is some diffrent from normal servers?

Book Excerpt: Sybase Adaptive Server Anywhere. Sybase's Adaptive Server Anywhere (ASA) is a small footprint, low maintenance database designed for mobile, embedded, personal and workgroup settings. In spite of its compact nature, it still provides all the 'big iron' features, such as replication, synchronization, and Java in the database.

Adaptive Server Anywhere. Sybase's Adaptive Server Anywhere (ASA) is a small footprint, low maintenance database designed for mobile, embedded, personal and workgroup settings. In spite of its compact nature, it still provides all the 'big iron' features, such as replication, synchronization, and Java in the database.


Your Feedback
mukul trivedi wrote: 1. What is the exact diffrence between server and database? 2.Adaptive servers works as normal server or it is some diffrent from normal servers?
PBDJ News Desk wrote: Book Excerpt: Sybase Adaptive Server Anywhere. Sybase's Adaptive Server Anywhere (ASA) is a small footprint, low maintenance database designed for mobile, embedded, personal and workgroup settings. In spite of its compact nature, it still provides all the 'big iron' features, such as replication, synchronization, and Java in the database.
PBDJ News Desk wrote: Adaptive Server Anywhere. Sybase's Adaptive Server Anywhere (ASA) is a small footprint, low maintenance database designed for mobile, embedded, personal and workgroup settings. In spite of its compact nature, it still provides all the 'big iron' features, such as replication, synchronization, and Java in the database.
Enterprise Open Source Magazine Latest Stories . . .
Cloud computing is creating the new Wall Street boom, according to NIA. The only industry that is as bright as cloud computing on Wall Street is social networking, NIA said in a recent report. 2012 will be known as the year cloud computing became widely adopted worldwide. Cloud comput...
The impact of Big Data is extremely broad for business, information management and technology. Being able to analyze your growing mountain of data can give you a distinct competitive advantage, but Big Data can be more than traditional tools can handle. In his session at the 10th Int...
In this CTO Power Panel at the 10th International Cloud Expo, moderated by Cloud Expo Conference Chair Jeremy Geelan, industry-leading CTOs & VPs of Technology will discuss such topics as: Which do you think is the most important cloud computing standard still to tackle? Who should...
China’s antitrust regulators gave Google’s $12.5 billion acquisition of Motorola Mobility the nod Saturday provided Google’s Android operating system remains open and free-of-charge for the next five years. The “free” stipulation apparently doesn’t apply to applications or services...
Citrix has acquired Virtual Computer, a little Massachusetts outfit with enterprise-scale management solutions for client-side virtualization. It means to combine the acquisition’s NxTop widgetry with its XenClient hypervisor to create a new Citrix XenClient Enterprise edition that c...
In the wake of the Facebook IPO fiasco, Nasdaq CEO Robert Greifeld beat his breast and told the Wall Street Journal along with other press Sunday that Nasdaq’s “acknowledged design problems” bungled the social network’s landmark lPO Friday. Reporters were told on a conference call ...
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