Sisäänkirjautuminen| Uusi tunnus
FrontPage| Projects| Forums| Search|
Sivuston navigointi: ^ DaoGen: › DaoGen Manual › DaoGen FAQ › DaoGen Forums » Programming Examples
» Käyttäjätunnus:
» Salasana:
» Muista kirjautuminen:
Suosituimmat sivut: › DaoGen Forums › Forums › PHP4 vs PHP5 and other considerations. › DaoGen Manual › Using ToString() with PHP › DaoGen FAQ › Projects » Programming Examples › Search › PHP5?
FrontPage » Projects » DaoGen » Programming Examples

DaoGen Programming examples

Here you can get the programming examples for DaoGen generator. These examples are provided to make it easier for you to start using generated sources. Even though these examples are programmed for the DaoGen generator, you can also use them as general purpose DAO examples for the Data Access Object design pattern. Currently there are 3 examples for Java language and 1 programming example for PHP.

Since 15.4. you can also run the servlet/jsp examples here and see how they really look like! Check out the examples 2 and 3!

System Environment

The examples are provided as source code, so you can view them without doing any preparations. However, if you want to run them in your own system, you will need at least:

1. Database server.
If you already don't have one, get the MySQL server from it is free and runs on all platforms. The examples are also programmed to work well with MySQL.

2 For Java, you will need the Java JDK, JDBC driver for your database and Tomcat application server.
- You will need the full Java development kit, the runtime environment is not enough, since you will need to compile the example source code. It is recommended to get the version 1.4 but 1.3 should also work well.
- JDBC stands for Java DataBase Connectivity and you will need the driver for your preferred database to connect to it. For MySQL get the driver from here:
- Tomcat application server is high-quality free J2EE web container. Get the Tomcat here:

3. For PHP, you will need Apache and PHP setup
For PHP environment, please check the installation manual for your platform.

Common Files

All these examples share significant amount of code - the DaoGen generated code for database handling. At first the amount of generated code might look like overkill for these simple applications, but when you check out all examples, you should understand that it is not. Once you have generated code for your database, you can easily write different functionality based on the generated code.

All example programs need customer database table:

- The SQL definition (CREATE TABLE-statement) for "customer" database table.
- Some initial content for the table.

For Java examples you will need these files:
- DaoGen generated Value Object.
- DaoGen generated Data Access Object.
- DaoGen generated exception.

For PHP examples you will need the these files:

- DaoGen generated Value Object.

- DaoGen generated Data Access Object.

- DaoGen generated simple database abstraction layer.

Finally here are the example programs. These are the only files that you will actually need to write, all other work will be done by the DaoGen. Download the files and edit the database connection information for you database. Then compile and run..

Example1 (Java only):

- Simple Java batch run program for resetting the Customer-table.
- Java source-code here:

Example2 (Java and PHP):

- Simple example for displaying customer information.
- Java servlet source-code here:
- Java JSP source-code here: customer-list.jsp
- PHP source-code here: example2.php
- Want to see how it actually looks like? Run it here!

Example3 (Java only):

- Simple example for editing customer information:
- Java servlet source-code here:
- Java JSP source-code here: customer-edit.jsp
- Want to see how it actually looks like? Run it here!

Feedback, Questions?

- Go to DaoGen discussion forums!