Installation
Unzipping JDBaccess Unzip your jdbaccess.zip file into your project directory. You should see the following directories and files: - desc: manual.pdf (this file), license.txt - doc: documentation files of JDBaccess for the Java platform - lib: jdbaccess.jar (and mysql-connector-java-5.0.3-bin.jar or ojdbc14.jar) - src: Employee example files - .project, .classpath, EmployeeExampleDA.launch, EmployeeExampleGUI.launch: Eclipse project files for the example applications
For MySql you should download the JDBC driver MySql Connector/J (mysql-connector-java-5.0.3-bin.jar) and copy it to the directory lib.
If you need another version of the JDBC driver copy it to the directory lib and change your .classpath-settings to the new entry, for example: <classpathentry kind="lib" path="lib/mysql-connector-java-3.1.13-bin.jar"/>
Starting the examples
With Eclipse you can directly import the example project by “File/Import/Existing projects into workspace": 

Click on “Next” to get the next dialog for selecting your project directory: 
Click on “Finish” to finalize your import.
After importing your project in Eclipse you see the JDBaccessExample as a new Eclipse project:
And you see two example applications as Eclipse launchable Run/Debug applications:
The first example “EmployeeExampleDA” demontrates the use of data access operations such as insert, update, delete, select, function and procedure. To see what happens debug it and step by step through each operation. Some information is automatically logged to standard output.
The second example “EmployeeExampleGUI” shows the usage of JDBaccess in a typical three-layer-architecture with presentation, application and persistence layer. It starts a main window with a list of employees which can be edited.
You only need little database space (3 tables with some hundred rows of data).
To start the examples perform the following steps:
- Create an example database user:
- MySQL: a) Create database: CREATE DATABASE employee; b) Create user with the appropriate permissions: GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,CREATE ROUTINE,ALTER ROUTINE,EXECUTE ON employee.* TO 'scott'@'%' IDENTIFIED BY 'tiger'; - Oracle: a) Create user with the appropriate permissions: CREATE USER joe IDENTIFIED BY "tiger" DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp PROFILE DEFAULT;
GRANT CONNECT TO joe; GRANT RESOURCE TO joe;
- Provide your data source settings in: com/your_domain/your_product/main/ExampleJDBaccess.java: change the first 6 instance variables: dataSourceName, dbServiceName, dbHost, dbPort, dbUser, dbUserPW) to appropriate values.
- Compile the sources.
- Start "EmployeeExampleDA" or "EmployeeExampleGUI" in run or debug mode.
|