Let me tell you I already got the tutorial on how to do this http://db.apache.org/derby/docs/10.3/adminguide/tadminconfig814963.html

But sincerely speaking I did not understood how to do any of the two methods described. Let me tell you my confusions and what I didn't understood and I am developing my project in netbeans.

1) How to set up a properties file(I never worked with them, so really have no idea) and if not required then where to find this derby.properties file and exactly how to enter that string in it.

2) And how to make my java code to execute that propeties file before loading the emebedded or network database drivers.

3) I have my JavaDb installed at C:\Program Files\Sun\JavaDB and in netbeans for my project I added a library refering to this location C:\Program Files\Sun\JavaDB\lib . So if I am done with properties file then will the final packaged jar file of my project along with library files in dist folder be able to start the derby server on any machine.(I mean to ask will it try to look for this location C:\Program Files\Sun\JavaDB\bin as batch file is located here to start)

Can anybody please help me with this?

Recommended Answers

All 8 Replies

Have you tried using the NetworkServerControl API as mentioned in the second point linked in your post? If yes, what kind of problems are you facing?

Have you tried using the NetworkServerControl API as mentioned in the second point linked in your post? If yes, what kind of problems are you facing?

No I have not tried NetworkServerControl API yet, I am looking to go with properties way primarily otherwise NetworkServerControl API is the last option I have. Nevertheless I'm going to try NetworkServerControl API tonight.

I think you should first try with NetworkServerControl simply because it seems more logical than setting system properties (at the JVM level) and relying on the derby driver class loading to start the server.

Regarding the properties file, I think you just need to create the properties file with the contents as per your need and make sure it is on the classpath (look into how to set classpath for a given JVM process; tip: java -h). Also, read this.

I think you should first try with NetworkServerControl simply because it seems more logical than setting system properties (at the JVM level) and relying on the derby driver class loading to start the server.

Regarding the properties file, I think you just need to create the properties file with the contents as per your need and make sure it is on the classpath (look into how to set classpath for a given JVM process; tip: java -h). Also, read this.

I get it done using NetworkServerControl API, in fact its quite easy this way. Now looking to understand the properties procedure to start the server. I hope it is also easy to do unless I understand the concept.

Why do you need to start the db as a server at all on a single machine? Do you have more than one client sharing the data?

In your earlier posts, it sounded as if you were wanting an embedded database for use with a single application instance.

Why do you need to start the db as a server at all on a single machine? Do you have more than one client sharing the data?

In your earlier posts, it sounded as if you were wanting an embedded database for use with a single application instance.

No I have just one client accessing the database on localhost. Actually I need to specify a path to create new database or to read from. With embedded driver derby looks into the default directory for the databases, and I was unable to find a way to do it with embedded driver so I switched to Network driver. If you know a way to do so with embedded driver then please tell me.

The path to your database can be specified in your JDBC connection URL. See the following page about that: http://db.apache.org/derby/docs/10.8/devguide/

Examples are shown on this page

Well first of all a lot of thanks for this developer guide I was really needing it, and luckily I got it done with embedded as well. Don't know what was the problem before, I tried to connect in the same way as described in tutorial. Anyways, tutorial have lot for me to study in Derby.
Thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.