Eclipse: How to integrate Derby

1. Quite often, we need to test dao in our project.

    And derby is a good choice for this specific purpose.

 

2. Installation:

1) DTP Installation

Help->Install New Software...

Eclipse: How to integrate Derby_第1张图片

2) Download Derby JDBC JAR

1> In Non-maven project

     We need to download the latest derby jar from the official download link.

2> In Maven project

     We need to include derby jar in pom file

<dependency>
	<groupId>org.apache.derby</groupId>
	<artifactId>derby</artifactId>
	<version>10.10.1.1</version>
</dependency>

3) Register Derby JDBC Driver

1> Window->Open Perspective->Other->Database Development

2> Database Connections->New...

Eclipse: How to integrate Derby_第2张图片Eclipse: How to integrate Derby_第3张图片
Eclipse: How to integrate Derby_第4张图片Eclipse: How to integrate Derby_第5张图片
Eclipse: How to integrate Derby_第6张图片Eclipse: How to integrate Derby_第7张图片
Eclipse: How to integrate Derby_第8张图片Eclipse: How to integrate Derby_第9张图片
Eclipse: How to integrate Derby_第10张图片

 

Extensions:

1> How to delete Driver/Connection Profiles?

Window->Preferences->Data Management->Connectivity->Driver Definitions

Eclipse: How to integrate Derby_第11张图片

2> Sometimes after we added a connection, we may encounter exception like this:

Failed to create database 'C:\Program Files\MyApp\myDB', see the next exception for details.

To me, it is because there is already a directory "c:/Program Files/MyApp/myDB" exists.

1> Remove Driver Definitions and connection profiles.

2> Close eclipse, and restart computer(To dissolve the occupation of myDB directory).

3> Delete myDB directory.

4> Start Eclipse, and then create connection profiles.

The exception just disappeared.

 

Reference Links:

1) http://www.vogella.com/articles/EclipseDataToolsPlatform/article.html#dtpintro_dtp Introduction how to enable DTP and integrate Derby.

2) http://download.eclipse.org/releases/kepler The DTP URL.

3) http://db.apache.org/derby/derby_downloads.html Download for Derby JAR.

4) http://www.binarytides.com/create-autoincrement-columnfield-in-apache-derby/ Simple Auto-increment Primary Key DDL Definition.

5) http://stackoverflow.com/questions/4999106/fail-to-create-embedded-derby-java Possible other solution for db creation exception.

6) http://www.eclipse.org/forums/index.php/t/14650/ Possible other solution for db creation exception.

你可能感兴趣的:(eclipse,Derby,integration)