[ 
https://issues.apache.org/jira/browse/DERBY-3091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531534
 ] 

Chip Hartney commented on DERBY-3091:
-------------------------------------

Here's a simple IJ session that reproduces the problem in my env (only when 
query logging is turned on) with the data file in my prior attachment...

ij version 10.2
ij> connect 'jdbc:derby:OrderEntryDB;user=xxx;password=xxx';
ij> CREATE TABLE TEMP.ZJVTERMS ("CODE" INTEGER NOT NULL, "TEXT" CHAR(16) NOT 
NULL);
0 rows inserted/updated/deleted
ij> CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE ('TEMP', 'ZJVTERMS', 
'C:\DOCUME~1\Chip\LOCALS~1\Temp\20070724-124300-ZJVTERMS.dat',';','~',null, 1);
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

Note that it does not matter what table structure or what data I use.  (More 
accurately, I have yet to find a table structure or data file that avoid this 
problem.)

Be aware that, as opposed to specifying the logging as an argument to the 
command, I am specifying the logging properties through a derby.properties file 
with the following content:
 derby.infolog.append=false
 derby.language.logStatementText=false
 derby.language.logQueryPlan=true

As noted before, the query plan does appear to be generated.  At least part of 
it is.

The log output, including stack trace, is:

2007-10-01 15:13:10.171 GMT Thread[main,5,main] (XID = 153040), (SESSIONID = 
0), LOCK TABLE "TEMP"."ZJVTERMS" IN EXCLUSIVE MODE ******* null
2007-10-01 15:13:10.250 GMT Thread[main,5,main] (XID = 153040), (SESSIONID = 
0), INSERT INTO "TEMP"."ZJVTERMS"("CODE", "TEXT")  --DERBY-PROPERTIES 
insertMode=replace
 SELECT  cast(COLUMN1 AS INTEGER) ,  COLUMN2  from new 
org.apache.derby.impl.load.Import('C:\DOCUME~1\Chip\LOCALS~1\Temp\20070724-124300-ZJVTERMS.dat',';','~',null,
 2 ) AS importvti ******* Insert ResultSet using table locking:
deferred: false
insert mode: bulk insert
Rows inserted = 22
Indexes updated = 0
Execute Time = 0
        Normalize ResultSet:
        Number of opens = 1
        Rows seen = 22
                constructor time (milliseconds) = 0
                open time (milliseconds) = 0
                next time (milliseconds) = 0
                close time (milliseconds) = 0
                optimizer estimated row count:        10000.00
                optimizer estimated cost:       100000.00

        Source result set:
                Project-Restrict ResultSet (2):
                Number of opens = 1
                Rows seen = 22
                Rows filtered = 0
                restriction = false
                projection = true
                        constructor time (milliseconds) = 0
                        open time (milliseconds) = 0
                        next time (milliseconds) = 0
                        close time (milliseconds) = 0
                        restriction time (milliseconds) = 0
                        projection time (milliseconds) = 0
                        optimizer estimated row count:        10000.00
                        optimizer estimated cost:       100000.00

                Source result set:
                        VTI ResultSet for org.apache.derby.impl.load.Import:
                        Number of opens = 1
                        Rows seen = 22
                                constructor time (milliseconds) = 0
                                open time (milliseconds) = 0
                                next time (milliseconds) = 0
                                close time (milliseconds) = 0
                                optimizer estimated row count:        10000.00
                                optimizer estimated cost:       100000.00


2007-10-01 15:13:10.265 GMT Thread[main,5,main] (XID = 153045), (SESSIONID = 
0), (DATABASE = OrderEntryDB), (DRDAID = null), Cleanup action starting
2007-10-01 15:13:10.265 GMT Thread[main,5,main] (XID = 153045), (SESSIONID = 
0), (DATABASE = OrderEntryDB), (DRDAID = null), Failed Statement is: null
java.lang.NullPointerException
        at org.apache.derby.impl.sql.execute.NoRowsResultSetImpl.finish(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
        at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
        at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source)
        at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
        at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
        at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
        at org.apache.derby.tools.ij.main(Unknown Source)
Cleanup action completed



> NullPointerException executing SYSCS_UTIL.SYSCS_IMPORT_TABLE when 
> derby.language.logQueryPlan=true
> --------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3091
>                 URL: https://issues.apache.org/jira/browse/DERBY-3091
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.2.1.6
>         Environment: ------------------ Java Information ------------------
> Java Version:    1.6.0_01
> Java Vendor:     Sun Microsystems Inc.
> Java home:       C:\Program Files\Java\jre1.6.0_01
> Java classpath:  C:\Program 
> Files\Java\jdk1.6.0_01\db\lib\derby.jar;C:\Program F
> iles\Java\jdk1.6.0_01\db\lib\derbytools.jar;.;C:\Program 
> Files\Java\jre1.6.0_01\
> lib\ext\QTJava.zip
> OS name:         Windows XP
> OS architecture: x86
> OS version:      5.1
> Java user name:  Chip
> Java user home:  C:\Documents and Settings\Chip
> Java user dir:   C:\Documents and Settings\Chip\Desktop
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [C:\Program Files\Java\jdk1.6.0_01\db\lib\derby.jar] 10.2.1.7 - (453926)
> [C:\Program Files\Java\jdk1.6.0_01\db\lib\derbytools.jar] 10.2.1.7 - (453926)
>            Reporter: Chip Hartney
>         Attachments: 20070724-124300-ZJVTERMS.dat
>
>
> Derby throws NullPointerException when executing an IMPORT if logging of 
> query plans is turned on in the derby.properties file as in:
>     derby.language.logQueryPlan=true
> If logging is turned off, the failure does not occur and the table is 
> successfully loaded.
> I am using the version of Derby that is provided with Java 6.
> Java source code is:
>         Statement stmt = oCnxn.createStatement();
>         try {
>             stmt.execute("CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE ('TEMP', 
> 'ZJVTERMS', 
> 'C:\DOCUME~1\Chip\LOCALS~1\Temp\20070724-124300-ZJVTERMS.dat',';','~',null, 
> 1)");
>         } finally {
>             stmt.close();
>         }
> Derby log output is:
> 2007-09-27 15:29:06.843 GMT Thread[AWT-EventQueue-0,6,main] (XID = 311121), 
> (SESSIONID = 0), INSERT INTO "TEMP"."ZJVTERMS"("CODE", "TEXT")  PROPERTIES 
> insertMode=replace SELECT  cast(COLUMN1 AS INTEGER) ,  COLUMN2  from new 
> org.apache.derby.impl.load.Import('C:\DOCUME~1\Chip\LOCALS~1\Temp\20070724-124300-ZJVTERMS.dat',';','~',null,
>  2 ) AS importvti ******* Insert ResultSet using table locking:
> deferred: false
> insert mode: bulk insert
> Rows inserted = 22
> Indexes updated = 0
> Execute Time = 0
>       Normalize ResultSet:
>       Number of opens = 1
>       Rows seen = 22
>               constructor time (milliseconds) = 0
>               open time (milliseconds) = 0
>               next time (milliseconds) = 0
>               close time (milliseconds) = 0
>               optimizer estimated row count:        10000.00
>               optimizer estimated cost:       100000.00
>       Source result set:
>               Project-Restrict ResultSet (2):
>               Number of opens = 1
>               Rows seen = 22
>               Rows filtered = 0
>               restriction = false
>               projection = true
>                       constructor time (milliseconds) = 0
>                       open time (milliseconds) = 0
>                       next time (milliseconds) = 0
>                       close time (milliseconds) = 0
>                       restriction time (milliseconds) = 0
>                       projection time (milliseconds) = 0
>                       optimizer estimated row count:        10000.00
>                       optimizer estimated cost:       100000.00
>               Source result set:
>                       VTI ResultSet for org.apache.derby.impl.load.Import:
>                       Number of opens = 1
>                       Rows seen = 22
>                               constructor time (milliseconds) = 0
>                               open time (milliseconds) = 0
>                               next time (milliseconds) = 0
>                               close time (milliseconds) = 0
>                               optimizer estimated row count:        10000.00
>                               optimizer estimated cost:       100000.00
> 2007-09-27 15:29:06.875 GMT Thread[AWT-EventQueue-0,6,main] (XID = 311199), 
> (SESSIONID = 0), (DATABASE = OrderEntryDB), (DRDAID = null), Cleanup action 
> starting
> 2007-09-27 15:29:06.875 GMT Thread[AWT-EventQueue-0,6,main] (XID = 311199), 
> (SESSIONID = 0), (DATABASE = OrderEntryDB), (DRDAID = null), Failed Statement 
> is: null
> java.lang.NullPointerException evaluating expression
>      org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>      org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>      org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>      
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>      
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>      org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>      org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>      org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>      org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>      org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>      ...ref to stmt.execute(...) in my code here...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to