4D and SQL Server: Powerful Flexibility OVERVIEW MS SQL Server has become a standard in many parts of corporate America. It can manage large volumes of data and integrates well with other products from Microsoft. However, as a database server, MS SQL Server only represents one piece of a complete data management solution. Many organizations have already decided on MS SQL Server as their "back-end" database. But choosing the tools that will be used in conjunction with MS SQL Server is a different issue. The software marketplace is full of potential candidates, many of which are narrowly focused and not appropriate in a broad range of uses. This document does not attempt to compare the various tools you might use. Rather, it is designed to highlight the many ways in which 4th Dimension s flexibility makes it an optimal partner with MS SQL Server. 4th Dimension describes an environment of complementary products that perform a variety of tasks. As a mature product, 4th Dimension has evolved over many years to encompass a diverse set of capabilities. 4th Dimension is a stand-alone application, a client/server database, and a Web application-server, capable of including any or all of these abilities in a single application. In addition, 4th Dimension has a comprehensive development environment, an industrial-strength machine code compiler, and a powerful cross-referencing tool. Combining the strengths of 4th Dimension with MS SQL Server creates one of the most powerful and flexible application design and deployment systems in existence today. TOOLS OF THE TRADE 4th Dimension interacts with MS SQL Server using 4D ODBC, a plug-in that adds a series of commands to the 4th Dimension language. These new commands provide for a variety of database operations and they work together seamlessly with the rest of the 4th Dimension environment. The 4D ODBC a plug-in allows 4th Dimension to be an ODBC client for any standard ODBC data source. This can be a great benefit in organizations that use MS SQL Server but also have other back-end databases. SCENARIOS AND SETUP The combination of 4th Dimension and MS SQL Server provides a great variety of application configurations. Below are descriptions of the three most basic configurations followed by descriptions of other possibilities. 4TH DIMENSION STAND-ALONE AND MS SQL SERVER In this scenario, 4th Dimension plays the role of a traditional client in a client/server application. User interface and client-side code reside individually at each workstation. Applications of this kind can be implemented with 4th Dimension stand-alone or 4D Runtime. Compiled, merged, front-end applications can be created using 4D Engine, which can be distributed as a single, executable application. 4D CLIENT/4D SERVER AND MS SQL SERVER This scenario uses 4D Client and 4D Server in conjunction with MS SQL Server. Individual 4D Clients as well as the 4D Server can make connections to MS SQL Server. Application code resides on 4D Server and is automatically distributed to clients as needed, which greatly simplifies the introduction of new versions of the application. 4D Client uses a sophisticated caching mechanism that downloads application fragments from the server to the local machine on an "as needed" basis, thus preventing unnecessary network traffic. This is accomplished by retrieving only the portions of the application that are visited by the user and have been altered since the previous use of the system. The result is a local custom cached set of resources for each user. HTTP://WWW.4D.COM/67 1
4D and SQL Server: Powerful Flexibility 4TH DIMENSION AS A WEB APPLICATION SERVER 4th Dimension has a built-in Web server and provides a variety of server-side processing capabilities. It can automatically translate a screen form into a Web page. It can process any HTML page using its own tags (which are supported by several Web development systems such as Adobe GoLive and Macromedia Dreamweaver). It can also respond to HTTP requests procedurally, producing Web pages "on the fly" as needed. With its broad set of Web application serving capabilities, 4th Dimension can replace more complex solutions using multiple products. Coupled with its ability to communicate with MS SQL Server, 4th Dimension can be an information hub, routing data between browsers and MS SQL Server with ease. REAL-WORLD APPLICATIONS Many workgroups have changing needs and require more flexibility than the simple configurations above. One might require a workgroup-level database that pulls data from a corporate MS SQL Server system. Or one may require a traditional client/server application with additional Web interfaces. Furthermore, one may even require an application with only Web browsers as clients. 4th Dimension can fit any of these needs while maintaining its role as good corporate citizen. Below we outline an example of a single workgroup application and trace its life throughout its development. A SIMPLE EXAMPLE IN THE ENTERPRISE In our example, a workgroup or division has data management needs. They have decided to implement a solution in their own department but need some information from an MS SQL Server database on a nightly basis. The application is written in 4th Dimension and served using 4D Client /4D Server. In this example, the 4D Server is used to connect to MS SQL Server and retrieve information. The clients do not interact with the MS SQL Server database but receive the benefits of the MS SQL Server data. Next the workgroup decides that certain reports sourced in both 4D and MS SQL Server need to be e- mailed on a nightly basis. Using its built-in email capabilities, 4D Server queries MS SQL Server, combines the information with workgroup data, formats the reports, and then e-mails the reports to designated users all with no user interaction. The scenario changes to this: Later, the workgroup/division discovers or decides that some information in their workgroup application needs to be viewed, edited, and then written to the MS SQL Server database during each transaction. The workgroup application needs up-to-the-minute information from the corporate system and needs to update this information at each commit. This involves the 4D Client collaborating directly with the MS SQL Server database. The scenario might look like this: 2 HTTP://WWW.4D.COM/67
Even later the workgroup/division recognizes the need to implement a Web interface to their workgroup application. In this scenario, the Web-based users reside in other divisions or outside the organization. Using 4D Server s Web application server and middleware ability the scenario changes to this: As shown here, the 4th Dimension/MS SQL Server combination can play a significant role in a large number of data management scenarios without placing undo resource load on the MS SQL Server database. 4th Dimension provides a natural hub for workgroup- or division-level data access. And since workgroups can seldom foresee all of the possible ways that workgroup data will be used, 4th Dimension s flexibility becomes a key advantage. 4TH DIMENSION FEATURES FOR MS SQL SERVER Regardless of how flexible 4th Dimension is, it would not be a good choice if developing were difficult or limited. Nor would it be a good choice if a completed 4th Dimension application was slow or cumbersome. Much of what makes 4th Dimension a superior development environment applies to 4D and MS SQL Server applications. Below are some of the more important features of 4th Dimension with respect to collaborative applications with MS SQL Server. Here users are accessing information stored in MS SQL Server through both 4D Client and Web browsers. The Web client interacts with the MS SQL Server data in an efficient manner yet cannot access the MS SQL Server database directly. This provides for an added level of security and a natural control point for throttling down access to the MS SQL Server system if needed. Even later the workgroup/division recognizes the need for a Java application to communicate with both MS SQL Server and 4th Dimension. Using 4D Open for Java, the scenario becomes this: 4th Dimension has a built-in interpreter that makes development and testing very easy. Modifications to an application can be implemented in one window while testing occurs in another. Developing under 4D Server is even more dynamic changes can be distributed in realtime to all the clients that are using the application. 4th Dimension has a world-class debugger. Combined with the 4th Dimension interpreter, the 4th Dimension debugger allows application developers to examine the state, values, conditions, and other components of an application. And since 4th Dimension is multithreaded, it allows multiple debuggers at the same time, providing the ability to investigate each separate thread of execution. The 4th Dimension Debugger HTTP://WWW.4D.COM/67 3
4D and SQL Server: Powerful Flexibility 4th Dimension has an industrial strength, machine-codegenerating compiler. The 4th Dimension compiler has many of the advanced features found in compilers for more traditional programming languages such as C and C++. Compiled 4th Dimension code is extremely fast, which allows many operations to be performed by 4th Dimension, freeing MS SQL Server resources. In one compilation 4th Dimension can generate machine code for multiple platforms (see below). The compiler also provides range checking, auto version numbering, error file generation and other advanced compiler capabilities. Using 4D Server s application distribution mechanism allows platform-specific machine code to be downloaded and cached at each client. This saves on network resources. In addition, the high-performance execution of compiled 4th Dimension code gives developers the option of offloading certain processes to the client without any loss of performance. In some cases, a performance increase can be achieved by running routines on the compiled client that would otherwise run less quickly on the MS SQL Server machine. 4th Dimension is cross-platform. One single application can run simultaneously on both Windows-based computers as well as Macintosh. This applies to the entire 4th Dimension development and deployment suite including 4D Server and 4D Client. In addition, 4th Dimension has built-in features such as style sheets and appearance control mechanisms that allow a single form to display as a native screen on each platform. 4th Dimension provides a local data engine, which allows for a wide range of data manipulation needs. MS SQL Server system resources and number of connections can be reduced by downloading information to the local data engine, disconnecting from MS SQL Server, processing the information, and then reconnecting. Semi-static data-driven interface components can be stored in the local data engine creating a cache that reduces MS SQL Server resources. On the other end of the spectrum, 4th Dimension can be used to create a complete database application with only modest MS SQL Server information sharing needs. In essence, the flexibility granted by the 4th Dimension data engine is enormous. With its completely multithreaded architecture, 4th Dimension has multiple processes and/or screens on a single machine that can query and update MS SQL Server at the same time. It is fairly simple to create a 4th Dimension interface that downloads a row from MS SQL Server into an editing interface, allows the user to make edits, and upon saving the information, shunts the processing over to another thread of execution while the user goes on to another row. Multithreading is native to 4th Dimension and this ability is available in 4th Dimension stand-alone, 4D Server, and 4D Client. An example of the maturity of the 4th Dimension development environment is 4D Insider. This tool provides a complete cross-reference and documentation system. It manages source code and makes transporting code modules between applications easy. It also lets developers understand the interrelationships of application objects. This is particularly useful when working on applications created by someone else. Another feature provided in 4th Dimension is an advanced information status tool called the Runtime Explorer. This built-in process allows administrators to examine the state of all processes in both interpreted and compiled 4th Dimension code. With this tool, the state of memory and performance of each process can be examined. Critical to all applications that connect to MS SQL Server, 4th Dimension provides extensive array-handling capabilities. This flexibility allows for efficient manipulation of information in preparation for user-interface display. One small example of flexibility is that 4th Dimension arrays can be resized without losing the content of the remaining elements. 4D Insider provides a complete cross reference all for application objects 4 HTTP://WWW.4D.COM/67
These capabilities and many others make 4th Dimension uniquely qualified for use in a collaborative environment with MS SQL Server. 4th Dimension fully supports MS SQL Server s multithreaded server architecture and has one of the lowest costs of ownership in the industry. (Go to http://www.4d.com/products/tco/aberdeen_2001.html). CONCLUSION When data is organized it becomes valuable. Once it becomes valuable, the need to have access to that information in a variety of manners and formats increases. 4th Dimension provides world-class collaboration with MS SQL Server yet brings a comprehensive suite of other abilities that make it the ideal choice in the enterprise. In a world where data management needs can change as fast as data itself, 4th Dimension is a safe, flexible, and powerful component in the data management universe, guaranteed to meet the needs of today and tomorrow. HTTP://WWW.4D.COM/67 5