The ServletJDBCEngine sample contains a server definition for basic servlet support, and illustrates a simple datasource definition using an included configuration file. It uses Apache Derby (an open source relational database). Also included is a servlet which gets a connection to the database using the defined datasource, creates a table, inserts some data, retrieves the data, and prints the data out to the browser
This sample can be installed onto runtime versions 8.5.0.0 and later.
To run the JDBCApp application:
java -jar JDBCSample.jar
bin
directory in the Liberty profile installation:
server run JDBCSample
CWWKZ0001I: Application JDBCApp started in XX.XX seconds.
Text retrieved from database is: myHomeCounty
The JDBCApp.war
file contains the source and binaries for the application, and can be
used to import it to Eclipse.
The created database is stored in usr/shared/resources/data/exampleDB as specified by the 'databaseName' property of the datasource.
This sample does not include the open source dependencies. The installer will provide a list of the open source pre-requisite libraries and where they can be downloaded from. To help obtaining these libraries, the installer provides the option to download them on your behalf.
The table below shows the dependencies that are required for: JDBC sample shared Derby library.
Target install path | Source URL |
---|---|
shared/resources/JDBCSampleDerbyLibs/derby-10.10.1.1.jar | http://repo1.maven.org/maven2/org/apache/derby/derby/10.10.1.1/derby-10.10.1.1.jar |
For further information and resources for developers using IBM WebSphere Application Server, please visit wasdev.net.