I have (java) code that creates and populates tables in a derby database, using text files as source data. I’m currently running it out of eclipse indigo, on Win7, and it works fine.
I have other code in that program that, based on user choice, creates the database into which that data is to go. I can’t get that part to work.
It uses ‘jdbc:derby:x\y;create=true’ as its connection string; it throws an exception from DriverManager.getConnection(connectionString, properties) saying “The database directory blah\blah\x\y exists; however, the it does not contain the expected ‘service.properties’ file. Perhaps…’ and some more irrelevant stuff.
Before I run this, I delete the directories x and y, and then perform a refresh on the eclipse project that my code is in. These directories currently live in the same directory as my eclipse project. After I run my code, directories x and y have both been created, but not my database.
If I delete the directories, open a command prompt, set my default to the directory that is to contain x, start ij, and use the connect statement with the same connection string given above, it creates the directories and the database. THEN my program will populate the database as expected, no errors.
I have also tried creating the database directly in the workspace directory that my project is in (i.e., y without a parent directory of x), with the same result, so I don’t think it’s the slash in the database name spec.
So I would like to know what I might be doing wrong that prevents that program from creating the database, just like the ‘connect’ statement in ij will do.
I found it. I had set the derby.system.home property to the database name instead of to a reasonable (or even an existing) directory. I haven’t worked out exactly what the problem with it was, but when I set it to a hard-coded directory, the problem disappeared.
rc