| By Bruce Armstrong | Article Rating: |
|
| October 18, 2005 04:45 PM EDT | Reads: |
28,199 |
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
Published October 18, 2005 Reads 28,199
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By 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.
![]() |
mukul trivedi 12/28/07 02:47:36 AM EST | |||
1. What is the exact diffrence between server and database? |
||||
![]() |
PBDJ News Desk 10/18/05 05:09:01 PM EDT | |||
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 10/12/05 03:50:42 PM EDT | |||
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. |
||||
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- How PowerBuilder Got Its Groove Back
- The Cloud Has Cross-Border Ambitions
- Ulitzer Named "New Media" Partner of Greatly Anticipated iStrategy Event in Berlin
- Risks and Enterprise Mobility?
- Steps for Success in Enterprise Mobility?
- Are Mobile Luddites Resisting Mobility?
- Hot Event in Santa Clara Becomes Cool with the iPhone
- The Difference Between Web Hosting and Cloud Computing
- Sybase CTO to Speak at 4th International Cloud Computing Expo
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- Five Reasons to Choose a Private Cloud
- Seeding The Cloud: The Future of Data Management
- The Threat Behind the Firewall
- Economy Drives Adoption of Virtual Lab Technology
- Tips for Efficient PaaS Application Design
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- Where Are RIA Technologies Headed in 2008?
- PowerBuilder History - How Did It Evolve?
- The Top 250 Players in the Cloud Computing Ecosystem
- Custom Common Dialogs Using SetWindowsHookEx
- DDDW Tips and Tricks
- OLE - Extending the Capabilities of PowerBuilder
- DataWindow.NET How To: Data Entry Form
- Book Excerpt: Sybase Adaptive Server Anywhere
- Sybase ASE 12.5 Performance and Tuning
- Working with SOA & Web Services in PowerBuilder
- Office 2003 Toolbar: A New Look For Your Old PowerBuilder App
- Dynamically Creating DataWindow Objects


































