Difference between revisions of "Database Tutorial"
From RifidiWiki
(→Download and Run the Application) |
(→Outline) |
||
Line 53: | Line 53: | ||
=Outline= | =Outline= | ||
+ | The next three sections walk you through the source code to explain how the DB App works. | ||
* [[Database Tutorial Create Application| Step 1: Create the Application]] | * [[Database Tutorial Create Application| Step 1: Create the Application]] | ||
* [[Database Tutorial Implement DAO| Step 2: Implementing the DAO]] | * [[Database Tutorial Implement DAO| Step 2: Implementing the DAO]] | ||
* [[Database Tutorial Command Provider| Step 3: Create a Command Provider]] | * [[Database Tutorial Command Provider| Step 3: Create a Command Provider]] |
Revision as of 19:12, 3 December 2009
This document provides instructions for creating an edge server application that logs RFID tags to a database.
Contents
Download and Run the Application
If you are interested in running the application, you can download it and unzip it into the applications folder of your Rifidi Edge Server installation.
This section provides instructions on how to download the final application and run it. It assumes you already have downloaded and installed the edge server and that you know how to read tags. If you need help with this see Edge Server Getting Started
Configure the database
If you are using MySQL
- First set up a MySQL instance and create a database called rifididb. There are no instructions here on how to set up MySQL on your system. There are plenty of tutorials on that, however.
- Now open up 'edge server.ini' in the edge server file and add this:
-Dorg.rifidi.jdbc.driver=com.mysql.jdbc.Driver -Dorg.rifidi.jdbc.url=jdbc:mysql://127.0.0.1/rifididb -Dorg.rifidi.jdbc.user=root -Dorg.rifidi.jdbc.pass=root
If you are using Derby
- You don't need to configure a derby DB in the same way you have to configure a MySQL DB, since it is embedded.
- Open up 'edge server.ini' in the edge server file and add this:
-Dorg.rifidi.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver -Dorg.rifidi.jdbc.url=jdbc:derby:RifidiDB;create=true -Dorg.rifidi.jdbc.user -Dorg.rifidi.jdbc.pass
Run the App
Note that you need to set the url, user, and pass to the values according to your database.
- Start up the edge server, workbench, and start reading tags just like you are used to doing.
- Now type this into the edge server console (at the osgi prompt)
loadApp dbapp
That is what loads the application.
- Wait for it to tell you the bundles are loaded properly. Then type this:
dbstart
Prerequisites
This tutorial assumes that you are using eclipse, that you have some java development experience, and that you know how to run the edge server and get tags back from it. The Northwind Tutorial is much more in-depth than this one, and is recommended for people who have little experience with java and/or eclipse.
To get started
- Follow the directions here: Edge Server Development Environment.
- Create a new application project following similar directions to the northwind project: Northwind Creating the Application
- For more instructions about how to use emulator with your application see Northwind Using Emulator
Download the Source
You can download the source and import it into eclipse. There are instructions in the readme file about how to import it into eclipse.
Outline
The next three sections walk you through the source code to explain how the DB App works.