Hi Ron,

Many thanks for your quick response.

I am sorry that I didn't make myself clear.

Let me clarify that I am not referring to the derby.jar or any other jar file that is shipped with the Derby database installation. I am instead referring to a custom jar file that contains the java code for the user-defined procedures written by me.

I had attached the custom jar file to the database by calling the system procedure sqlj.install_jar(), and had added it to the database classpath using the system procedure 

I hope that this more clearly explains the issue I am facing.


--- On Mon, 12/7/10, Ron Rudy <ronchalant@gmail.com> wrote:

From: Ron Rudy <ronchalant@gmail.com>
Subject: Re: Attaching a jar file to the database.
To: "Derby Discussion" <derby-user@db.apache.org>
Date: Monday, 12 July, 2010, 6:52 PM


I'm not sure I entirely understand. The jar file(s) contains the embedded driver, as well as the code needed to read/write to the database.  You need to include Derby jar(s) each time you connect to the database in any scenario (embedded, network, etc.) because it dictates how you communicate.  In the case of the embedded database it also dictates how the database itself actually reads/writes data to disk. 

The jar is not "attached" to the database in any sense.  It's attached to the JVM that reads/writes to the database.  You typically use it behind the JDBC API, but it is using Derby code as its underlying implementation.

I hope this answers your question...


On Mon, Jul 12, 2010 at 8:42 AM, Dinesh Bajaj <dinesh.bajaj@ymail.com> wrote:

Kindly let me know whether a jar file only needs to be attached once to the database, or it needs to be attached every single time a connection to the database is made?

I attached a jar file to the database, and added it to the database classpath. This was done through code, and no exception was thrown. So, I assumed that the file was added to the database. Now, when I connect to the database again and try to call a user-defined procedure that depends  on the added jar file, the derby throws back the java.lang.ClassNotFoundException'.

Kindly suggest what I am doing wrong.

Dinesh Bajaj