Database Application Programming With Linux

Brian Jepson, Joan Peckham, Ram Sadasiv · CERN Document Server (European Organization for Nuclear Research) · 2000

From the Book: Welcome to the first edition of . This book is, for the most part, about building desktop database applications for Linux, although the way we address that topic will open your mind to a lot of other great stuff. If you opened this book hoping to learn how to build an application that uses a relational database to store data, and a graphical front-end to interact with users, you came to the right place! There is one thing we should make perfectly clear: this book does not talk about how to develop web database applications. There are many books on this topic (Brian has even written a couple of them), and perhaps we will address it in a future edition of this book. However, with the growth of desktop application environments such as KDE and GNOME, we felt challenged to produce a book with a desktop focus. It wouldn't be fair to say that this book is only about plugging databases into a pretty user interface. In fact, it's much more than that. In this book, we're going to look at a lot of things that will help you build better applications, and you'll be able to apply many of these things to other programming endeavors. Here are some of the topics we discuss: Database systems In this book, we look at five popular database systems for Linux: PostgreSQL, MySQL, Mini SQL, Sybase, and Oracle. Wherever possible (and incompatibilities permitting), we have developed example code that works with as many of these databases as possible. Differences that were known to us during writing and testing are documented where appropriate, and Chapter 9, Databases, takes a close look at these databases. Two areas we focus on in particular are how you can get up and running with the database system of your choice, and how each database server deals with specific database development issues. We also take a good look at the different data types and date formats, two things that are confusing when developing cross- database applications. If your favorite database system was not covered in this book, we apologize, but we had a limited amount of time to produce this book, and we chose these database systems so we could best leverage the experience of the authors. If you are interested in other database systems for Linux, see Christopher Browne's resource on this topic at www.ntlug.org/~cbbrowne/rdbms.html. Conceptual Modeling In this book, we spend as much time talking about what you must do to prepare for programming as we do about programming itself (I think I heard a groan from the back of the room). Don't fear - even the chapters about analysis and design are peppered lightly with some concrete examples, and we think you'll find it useful. We won't mind if you skip ahead to the implementation-oriented stuff, which begins in Chapter 9. We're hoping that if you do that, you'll eventually come back to the earlier stuff. UML and Patterns Perhaps these are two buzzwords you've heard a lot, or perhaps these are two things with which you are familiar. For those who don't know, UML and Patterns are modeling aids that are used by programmers and designers to better communicate with others. UML is a notation that documents a number of things, including the mental model you have of a system that you're going to build, the classes that make up a system, and how these classes are related. Patterns are a way of expressing solutions to problems in a context. When you are looking at a problem that needs to be solved, you can apply one or more Patterns to reach a solution. This makes it easy for you to find a solution, gives you confidence that you are doing something tried and true, and makes it easier for other people to understand your design. Chapter 7, Object-Oriented Analysis, and Chapter 8, Object-Oriented Design, talk about how you can apply UML and Patterns to analyze and design your project. SQL Chapter 2, Database Design, specifically addresses SQL, the programming language used by all five database servers we discuss in this book. Before we dive into the SQL, though, we take a good look at how to design a database in the context of a problem that needs to be solved. We look at a particular set of requirements, plan a database for a system, and refine it until it's designed well enough to work well with an database system. Then, we show you how to create the tables that make up the database, and how to work with them in SQL. Appendix A, SQL Reference, will help you find your way around the language. Chapter 9 treats many database issues, including several special topics in SQL. Programming languages Chapters 11, 12, and 13 cover Java, Perl, and C, respectively. In all three chapters, we look at how you can develop graphical applications in these languages that talk to an database back-end. Chapter 13 looks at C programming in the context of GNOME, an exciting desktop application framework for and other operating systems. Who Can Use This Book Before we wrote this book, we decided to keep one user in particular in mind: someone who has been using the system for a little while, and who may have learned a bit of programming. This is not to say that expert users or complete novices should be afraid; in fact, we felt that by targeting the inexperienced programmer, we would diminish barriers to entry as much as possible. Also, by concentrating on delivering a lot of information in this book, we felt there would be plenty of interest for even the most experienced programmers. How to Use This Book For the total newbie, we suggest that you take the time to get comfortable with Linux, and get to know your way around the shell (bash, the Bourne Again Shell) before you try to tackle this book. It's best if you've had some experience doing light programming in a language such as Perl, Tcl, or Python, and that you understand the basics of programming (functions, variables, and data structures such as arrays, linked lists, and hashtables, for example). For the expert developer, there are certainly parts of the book that you can skip, if you feel like it. We think that the chapters are set up in a way that you can simply read the first few paragraphs of each chapter to decide whether the chapter will be helpful. For the rest of you (and total newbies after you've learned the basics), we'd like you to try going through the book from start to finish. The first thing you'll see is Chapter 1, Requirements, which talks about software development from a very traditional perspective. Although we use this approach as the basis of the next three chapters (Chapter 2, Database Design; Chapter 3, User Interface Design; and Chapter 4, Construction), we take a fresh look at the issue in the chapters that follow. Chapter 5, Object-Oriented Programming, is a quick introduction to object-oriented programming, and in Chapter 6, Software Engineering, we look at software engineering from an open source perspective. Finally, we wrap up the Part One of the book by looking at how you can use UML and Patterns to design a system. Then, it's on to Part Two. Part Two of the book looks at implementation issues. Chapter 9 looks at what you need to get up and running with any of the five database servers we talk about in this book. Chapter 10, Linux Development Tools Catalogue, takes a quick look at various tools that will help you develop database applications; everything from graphical query tools to environments that are similar to 4GL tools like Access. From there on, the next chapters look at programming database applications in Java, Perl, and in C under the GNOME framework. After that, we wrap up the book with chapters on distributed components and CORBA.

Read the paper · More papers on PaperTik