Building AJAX applications with Google Web Toolkit, Apache Derby, and Eclipse 2

Source: Internet
Author: User
Tags command line

In this article, you will install and configure the backend of the database--web application to create a database schema and learn some simple tools to populate it with data. The database that you will be using is the Apache derby,100% pure Java™ relational database, which was originally developed under the name of Cloudscape™. Finally, IBM® acquired the Cloudscape code and then contributed its open-source version to the Apache project. The same project was issued by Sun Microsystems's javadb name, but there was no confusion between the two.

I chose Derby not because it has three names, but because it is lightweight and easy to configure. Unlike most relational databases, Derby can run in the same Java Virtual machine (JVM) as the Java-side server code. (If you like, you can also run it on a separate JVM.) This makes development and deployment easier, and Derby is a fast, ideal choice for small and medium Web applications.

Before you begin, there are a few caveats: first, to read this article, you should have a basic knowledge of relational databases, JDBC, and Structured Query Language (SQL). Second, for demonstration purposes, this article provides some content that may not be ideal in the production system in the code. I tried to point out those elements in the course of the story, but I'm not going to discuss performance tuning here.

Get Derby

Derby is provided as part of the Apache DB project. When writing this article, the latest version is the 10.1.3.1 version. If you are working in the Eclipse Integrated development Environment (IDE), it is sufficient to get the Derby_core_plugin and Derby_ui_plugin two plug-ins. If not, you can choose any other distribution that meets your needs. Some of these distributions contain only library files, some contain libraries and documents, some contain libraries with debug information, and distributions that have only source code. Derby is based on Java technology and can be run on any version 1.3 or later JVM. The code example in this article assumes that you are using Java 1.4.

Do not use Eclipse to set Derby

If you do not use Eclipse, unzip the downloaded release to any location you deem convenient. When you are done, make sure that the files Lib/derby.jar and Lib/derbytools.jar are located in the CLASSPATH variable. You can do this at the system level, which may help to set the environment variable Derby_install to the directory where Derby is located (including the Derby directory itself, in/opt/bin/db-derby-10.1.3.1-bin). You can also perform this action in the IDE or in the launcher script. If you need to use Derby in client/server mode and embedded mode, the file Lib/derbyclient.jar and Lib/derbynet.jar must also be in classpath.

Setting up Derby with Eclipse

If you are using Eclipse, it will be easier to make the setup work for your development. To set up Derby in Eclipse, complete the following steps:

Unzip the two plug-in files. Each plug-in file has a top-level directory named plugin.

Copy the contents of the directory to the Eclipse plug-in directory.

Open your project in Eclipse.

Click Project > Add Apache Derby Nature into Derby fantasy world. Doing so will add four library files to the project classpath and give you access to the IJ command line prompt.

Figure 1 shows the Derby menu after the derby nature has been added.

Figure 1. Eclipse Derby Menu

Even if you are using Eclipse for development, you must have a corresponding JAR file when you deploy your application. I will explain this topic in more detail in a later article.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.