Best Practices When Developing a Mobile Database Application for Resale
Total Page:16
File Type:pdf, Size:1020Kb
WHITE PAPER Best Practices When Developing a Mobile Database Application for Resale www.sybase.com/sqlanywhere TABLE OF CONTENTS 1 Introduction 1 Ten Best Practices 1 Provide Current and Required Functionality 3 Add Value to Your Customer 5 Provide Robust End-To-End Encryption 5 Provide Access to Data at all Times 6 Integrate With Existing Systems 6 Support Multiple Mobile Devices 7 Keep Development Costs Low 8 Keep Maintenance Costs Low 8 Provide Quick and Easy Deployment 9 Plan for the Future 9 Conclusion INTRODUCTION Nowadays, it’s not uncommon to see smartphone users wherever you go. These mobile devices, such as the RIM® BlackBerry® and Apple® iPhone®, enable customers to do much more than just making phone calls. Catching up on email and browsing Internet sites are two ordinary tasks associated with smartphones. Additional applications are made available through popular third-party digital marketplaces and they provide users with richer and more sophisticated applications that they can access while on the go. Application developers who are looking to move into the mobile space are therefore presented with a unique opportunity to tap into this market. Whether you are an established independent software vendor (ISV) or a new player looking to resell mobile applications, there are guidelines that you must adhere to ensure the success of your solution. This article describes ten best practices that developers can follow when implementing a mobile database application for resale as part of an existing software package, or for online distribution. To illustrate the concepts presented in this article, we use Sybase’s SQL Anywhere® UltraLite® database because of its extensive feature set and ability to target multiple smartphone platforms, including Microsoft Windows Mobile, RIM BlackBerry, Apple iPhone, and Android. However, you may choose a different mobile database solution if it supports your platform of choice. TEN BEST PRACTICES The following ten best practices are discussed in this article: 1. Provide current and required functionality 2. Add value to your customer 3. Provide robust end-to-end encryption 4. Provide access to data at all times 5. Integrate with existing systems 6. Support multiple devices 7. Keep development costs low 8. Keep maintenance costs low 9. Provide quick and easy deployment 10. Plan for the future Provide Current and Required Functionality It is extremely important to understand the functionality that made a particular solution successful in the first place because it’s that same functionality that you must include in your mobile solution. Existing ISVs already enjoy success with their current desktop applications and so should be familiar with what they would need in a mobile version of their application. ISVs developing new applications can identify specific needs of mobile users and build application requirements based on those needs. Some examples of database applications that can be extended to smartphones include customer relationship management (CRM) and sales force automation (SFA). 1 Consider the simple sales force automation application in Figure 1. It allows the sales representative “Alan Able” to see his orders and a list of his top-selling products and his top customers. This application runs on his desktop computer. What is most important about this application is the ability to see the customer orders so that the sales representative can approve them. That is the functionality that must be made available in the mobile application. The list of top products and customers, while useful, are not mission-critical components of the solution and so should be optional in the mobile application. Assuming that all sales representatives are equipped with a BlackBerry device, the mobile version of this solution should allow them to see their orders, as shown in Figure 2. Figure 2: BlackBerry version showing customer orders. 2 In this example, the desktop application is written in C# and uses SQL Anywhere as the backend or corporate database that we will synchronize information to. The BlackBerry application is written in Java and uses UltraLite technology (database designed for smartphones included with SQL Anywhere) to store all information right on the device. Since both applications are alike, their implementation is straight-forward and use similar SQL statements to display the data, as shown in Code Listings 1 and 2. SAConnection conn; conn = new SAConnection(“dsn=SA12 CustDB;uid=dba;pwd=sql”); conn.Open(); string sql = @”SELECT o.order_id, c.cust_name, p.prod_name, o.quant FROM ULOrder o, ULCustomer c, ULProduct p, ULEmployee e WHERE o.cust_id = c.cust_id AND o.prod_id = p.prod_id AND o.emp_id = e.emp_id AND e.emp_name = ‘Alan Able’ ORDER BY order_id”; DataSet ds = new DataSet(); SADataAdapter da = new SADataAdapter(sql, conn); da.Fill(ds, “Results”); dataGridView1.DataSource = ds.Tables[“Results”]; Code Listing 1: C# code for Windows desktop SFA application to display customer orders. Connection _conn; ConfigPersistent _config; PreparedStatement _ps_order; ResultSet _rs_order; _config = createConfig(“custdb.ulj”); DatabaseManager.connect( _config ); _ps_order = _conn.prepareStatement ( “SELECT o.order_id, c.cust_name, p.prod_name, o.quant, p.price, “ + “o.disc, o.status, o.notes “ + “FROM ULOrder o “ + “ JOIN ULProduct p ON o.prod_id = p.prod_id “ + “ JOIN ULCustomer c ON o.cust_id = c.cust_id “ + “ORDER BY o.order_id” ); _rs_order = _ps_order.executeQuery(); boolean valid = _rs_order.next(); Code Listing 2: Java code for BlackBerry SFA application to display customer orders. Add Value to Your Customer Now that you’ve defined the required functionally for your mobile application, you need to determine how your solution is adding value to your customers. A solution that only displays information is not very useful, but one that allows the mobile worker to execute business processes is much more powerful and appealing. Mobile databases allow you to take full advantage of features such as indexes, transaction processing, referential integrity, multi-table joins, row-level locking, SQL functions, BLOB support, and location-based data. 3 Continuing with our SFA mobile solution, in addition to displaying customer’s orders, it allows approving or denying of orders, as well as adding and deleting orders (see Figure 3). The sales representative no longer needs to carry a laptop computer to manage his or her accounts, but can do so using his or her smartphone. Figure 3: Account management operations from BlackBerry SFA application. Just like retrieving the list of orders, the Java code required to add or delete orders comprises of simple JDBC calls, as shown in Code Listing 3. String sql_stmt = “INSERT INTO ULOrder( order_id, cust_id, prod_id, emp_id,” + “ disc, quant, notes, status )” + “ VALUES( ?, ?, ?, ?, ?, ?, ‘’, ‘’ )” PreparedStatement ps = _conn.prepareStatement( sql_stmt ); ps.setInt(1, order_id); ps.setInt(2, cust_id); ps.setint(3, prod_id); ps.setInt(4, emp_id); ps.setInt(5, discount); ps.setInt(6, quantity); try { ps.execute(); if( do_commit ) { _conn.commit(); } } finally { ps.close(); } Code Listing 3: Java code for BlackBerry SFA application to insert new customer orders. 4 Provide Robust End-To-End Encryption Security is of paramount importance in any enterprise solution, particularly when it comes to mobile database applications. As a software vendor, you must ensure that your customer’s data is safeguarded at all times against device theft or lost, and against data interception that may occur when the application is communicating using the Internet. The best method to protect your customer’s information is to provide them with end-to-end encryption, meaning that your solution encrypts the data at the point of origin (mobile device) and only decrypts it at the final destination (headquarters). Make sure to encrypt the database residing in the smartphone. The encryption method can range from simple obfuscation to strong 128 or 256-bit encryption. Ensure that you use the correct algorithm depending on who your end customer is. The Advanced Encryption Standard (AES) algorithm is appropriate for mobile business applications, while the Federal Information Processing Standard (FIPS) Publication 140-2 is suitable for government mobile solutions. An encrypted database will give your users piece of mind in case their mobile device is lost or stolen. It is also essential to encrypt the communication stream between the mobile database and the customer’s corporate network. Since the data transmission is likely to occur over the Internet, there’s a risk that your customer’s information may be intercepted along the way. To mitigate this risk, employ transport-layer security in your mobile database application. Transport-layer security employs digital certificates to establish and maintain a secure connection to your corporate server, and strongly encrypts the communication protocol using public-key cryptography. Just like database encryption, ensure that you are using the proper algorithm depending on who your ultimate customer is. Provide Access to Data at all Times Mobile applications allow customers to be productive when they are away from the office. A true mobile solution must be able to function properly whether or not the device is connected to the network. That is the main reason behind developing a mobile application that includes a database capable of running on smartphones. It enables your mobile customers to continue working without having to worry about network connectivity