You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Dinesh Bajaj <di...@ymail.com> on 2010/07/12 14:42:35 UTC
Attaching a jar file to the database.
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
Re: Attaching a jar file to the database.
Posted by Dinesh Bajaj <di...@ymail.com>.
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
SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY.
I hope that this more clearly explains the issue I am facing.
-Dinesh
--- On Mon, 12/7/10, Ron Rudy <ro...@gmail.com> wrote:
From: Ron Rudy <ro...@gmail.com>
Subject: Re: Attaching a jar file to the database.
To: "Derby Discussion" <de...@db.apache.org>
Date: Monday, 12 July, 2010, 6:52 PM
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 <di...@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
Re: Attaching a jar file to the database.
Posted by Ron Rudy <ro...@gmail.com>.
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 <di...@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
>
>