- java -jar $DERBY_HOME/lib/derbyrun.jar ij
- $DERBY_HOME/bin/ij
This is very important, this tool must be launch where the database is going to create. If the database create under /home/the_database directory, make sure the current directory is locate at the_database, no elsewhere. Otherwise an error message say Unable to establish connection will shown.
Now issue this command to create a database > connect 'jdbc:derby:thedb;create=true', a new folder named thedb will be created under the /home/derby directory. Usually a database will come with user authentication to ensure the data are secure. Unfortunately Derby set this configuration to false by default. To enabled user authentication, make sure derby.properties is exists in Derby installation path. If not, create it. The content should look like below. Replace username with your prefer user ID, and password with your desire password.
derby.connection.requireAuthentication=true
derby.user.username=password
To connect the database, use this command > connect 'jdbc:derby:DB_name;user=username;password=password'; Alternately, it can also be connect in this way > connect 'jdbc:derby:DB_name' user='username' password='password'; Since I am setting up the Derby for R&D on my local PC, and I have no intention to do serious work, thus I am keeping the authentication as simple as possible.
No comments:
Post a Comment