I am new to Apache Derby database,
When i am trying to crate new database using the following command i am getting the below problem
C:\>java org.apache.derby.tools.ij
ij version 10.10
ij> connect 'jdbc:derby:Mynewdb;create=true';
Mon Mar 03 20:17:32 IST 2014 Thread[main,5,main] java.io.FileNotFoundException: derby.log
(Access is denied)
----------------------------------------------------------------
Mon Mar 03 20:17:33 IST 2014:
Booting Derby version The Apache Software Foundation - Apache Derby - 10.10.1.1 - (1458268): instance a816c00e-0144-886a-02f2-000000b8d0b0
on database directory C:\Mynewdb with class loader sun.misc.Launcher$AppClassLoader@11b86e7
Loaded from file:/C:/db-derby-10.10.1.1-bin/db-derby-10.10.1.1-bin/lib/derby.jar
java.vendor=Sun Microsystems Inc.
java.runtime.version=1.6.0_23-b05
user.dir=C:\
os.name=Windows 7
os.arch=x86
os.version=6.1
derby.system.home=null
Database Class Loader started - derby.database.classpath=''
Start the JVM. Load the appropriate driver. Create a connection by providing a valid database connection URL.
Choose Window > Preferences from the menu to open the Eclipse Preferences dialog. Navigate to Connectivity > Driver Definitions. Select the Derby 10.2 folder and click Add.... In the New Driver Definition dialog, select Derby Client JDBC Driver and click OK.
The bottom line: Never delete or manipulate *ANY* files in a Derby database directory structure. Doing so will corrupt the database. The problem: Some Derby users have discovered that deleting the files in the log subdirectory of the database will silence recovery errors and allow access the database.
The derby. log file is created when the Derby server is booted. The network server records the time and version. If a log file exists, it is overwritten, unless the property derby. infolog.
A file named derby.log will be created in the current working directory when you run ij
(or attempt to use embedded Apache Derby in some other application). From the post, it appears you are executing this from C:\
and the user you are logged on as does not have write access to that directory: change to a directory where the user has permission to create a file and retry.
Note it is possible to suppress this log file (though I have not yet done this myself). See Getting rid of derby.log. However, suppressing the log file would just result in another failure in your case because the database will be created on the file system relative to the current directory. That is, an attempt to create the directory named Mynewdb
in the current directory, C:\
, would also fail for the same reason. It is possible to specify a path for the database to avoid creating in the current working directory:
ij> connect 'jdbc:derby:/tmp/test_db;create=true';
user.dir=C:\
os.name=Windows 7
Windows 7 (and up?) doesn't let you write files to the root directory in most cases. You should cd to another directory before starting ij. e.g. cd \Users\YOUR_USER_NAME
and you should be good to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With