Hi Sebastian,

I'm not sure I'm understanding your question. Please bear with me. The install_jar command copies the jar file from the file system into the database. The remove_jar command deletes the jar file from the database. Neither command alters the external file system. If you need to delete an obsolete jar file from the file system, you can use ordinary operating system commands.

Hope this helps,
-Rick

Sebastian Pfaff wrote:
Hi Rick,

tnx for your answer! Your snippet works fine (if i install/include a
new jar file, your snippet shows me this). But when i have NO NEW
ADDTIONIAL jars in my database installed and if i'm executing your SQL
snippet:

ij> SELECT s.schemaname, f.filename FROM sys.sysschemas s,
sys.sysfiles f WHERE s.schemaid = f.schemaid

i get this result:

SCHEMANAME
                                                         |FILENAME
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

0 rows selected

the jar file ISN'T listed here (!!!), but the jar file
SAMPLE1.jar.G1210431624637  _IS_STILL_ in the filesystem:

ls SM_DATA_LAYER/jar/APP/
SAMPLE1.jar.G1210431624637

So i have only one question:

How can i remove this jar file (Would it be save to remove the jar
file via a manual delete on the filesystem?)?

Regards && tnx in advance

Sebastian






On Mon, May 12, 2008 at 6:23 PM, Rick Hillegas <[EMAIL PROTECTED]> wrote:
Hi Sebastian,

 The following query will show you the names of the jar files loaded into
your database:

 select s.schemaname, f.filename
 from sys.sysschemas s, sys.sysfiles f
 where s.schemaid=f.schemaid

 So, for instance, the following script runs like this for me:

 ij> call sqlj.install_jar( '/Users/rhillegas/junk/z.txt', 'APP.Foo', 0 );
 0 rows inserted/updated/deleted
 ij> select s.schemaname, f.filename
 from sys.sysschemas s, sys.sysfiles f
 where s.schemaid=f.schemaid
 ;
 SCHEMANAME
|FILENAME

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 APP
|FOO

 1 row selected
 ij> call sqlj.remove_jar( 'APP.Foo', 0 );
 0 rows inserted/updated/deleted
 ij> select s.schemaname, f.filename
 from sys.sysschemas s, sys.sysfiles f
 where s.schemaid=f.schemaid
 ;
 SCHEMANAME
|FILENAME

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 0 rows selected

 Hope this helps,
 -Rick



 Sebastian Pfaff wrote:

Hello,

how can i see which jars are included in my database? I want to see
all jars which are added through a call of 'CALL sqlj.install_jar
[...]'.

the main problem is:

yesterday i added a jar to my database via the call of:

ij> CALL
sqlj.install_jar('/me/netBeansPojects/java/DerbyZeroCheck/dist/DatabaseRoutines.jar',
'APP.Sample1', 0);

Notice: [...]Pojects[...] is a typo but that is ok!!!

You can see the jar in the filesystem:

ls DATACENTER/SM_DATA_LAYER/jar/APP/
SAMPLE1.jar.G1210431624637

today i tried to remove the jar via a call of:

ij> CALL sqlj.remove_jar('APP.Sample1', 0);

The call above always produces this errror:

ERROR X0X13: Jar file 'SAMPLE1' does not exist in schema 'APP'.

here the server side stacktrace:

2008-05-12 14:44:51.422 GMT Thread[DRDAConnThread_3,5,main] (XID =
13623), (SESSIONID = 0), (DATABASE = SM_DATA_LAYER), (DRDAID =
NF000001.DF1C-1025975079512780256{2}), Cleanup action starting
2008-05-12 14:44:51.422 GMT Thread[DRDAConnThread_3,5,main] (XID =
13623), (SESSIONID = 0), (DATABASE = SM_DATA_LAYER), (DRDAID =
NF000001.DF1C-1025975079512780256{2}), Failed Statement is: CALL
sqlj.remove_jar('APP.Sample1', 0)
ERROR X0X13: Jar file 'SAMPLE1' does not exist in schema 'APP'.
       at
org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
       at org.apache.derby.impl.sql.execute.JarUtil.drop(Unknown Source)
       at org.apache.derby.impl.sql.execute.JarUtil.drop(Unknown Source)
       at org.apache.derby.catalog.SystemProcedures.REMOVE_JAR(Unknown
Source)
       at
org.apache.derby.exe.acf81e0010x0119xdd3bxc79bx00001d72cbbd1b.g0(Unknown
Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown
Source)
       at
org.apache.derby.impl.sql.execute.CallStatementResultSet.open(Unknown
Source)
       at
org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
Source)
       at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
Source)
       at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
Source)
       at
org.apache.derby.impl.jdbc.EmbedCallableStatement.executeStatement(Unknown
Source)
       at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown
Source)
       at org.apache.derby.impl.drda.DRDAStatement.execute(Unknown Source)
       at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTT(Unknown
Source)
       at
org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown
Source)
       at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
Cleanup action completed

If i'm trying to include/install an additional jar file everything works
fine:
ij> CALL sqlj.install_jar(
   '/me/netBeansPojects/java/DerbyZeroCheck/dist/DatabaseRoutines.jar',
'APP.Sample1', 0);


Statement executed.


here layout of filesystem before removing:

ls DATACENTER/SM_DATA_LAYER/jar/APP/
SAMPLE1.jar.G1210431624637  SAMPLE1.jar.G1210597561003

ij> CALL sqlj.remove_jar('APP.Sample1', 0);
Statement executed.
ij>

layout just after removing:

ls DATACENTER/SM_DATA_LAYER/jar/APP/
SAMPLE1.jar.G1210431624637

It seems to be impossible to remove the file named
'SAMPLE1.jar.G1210431624637'! It would be nice to know, how to make
included/installed jars visible and how to remove them if a call of
sqlj.remove_jar fails.

Is it save to remove the file manually from filesystem (e.g. rm
SAMPLE1.jar.G1210431624637)?

my environment is:

Linux 2.6.25.1 && java version "1.6.0_06 && derby 10.4


If you need additional infos, please let me know. Any help is appreciated.

TNX in advance!

Sebastian



Reply via email to