Dinesh,

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...

-Ron

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

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.

Regards,
Dinesh Bajaj