db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John H. Embretsen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2733) ij rolls through NullPointerException (NPE) with J2ME/JSR169/WEME 6.1.
Date Thu, 10 Jan 2008 10:18:34 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557587#action_12557587

John H. Embretsen commented on DERBY-2733:

Thank you for doing this Myrna, it is a great improvement!

The code change works fine with my Java ME VM (phoneME Advanced).

I will comment on the doc changes below, but first I'd like to present my view of how this
should ideally work:

 - I think it would be easier to use IJ with a datasource (and to document it) if IJ tries
to connect automatically to a database ONLY IF ij.dataSource.databaseName is set. It makes
no sense doing it otherwise.
 - If ij.dataSource.databaseName is set, and IJ successfully connects to the database automatically
on startup, this should be indicated to the user, e.g. "Connected to database [databaseName]".

Given the current implementation, I have the following comments regarding the doc changes:

First, I think it would be useful to explicitly say that ij will try to connect to your database
automatically when you specify ij.dataSource. E.g.

"When you set the ij.dataSource property ij will automatically try to connect to a database.
To establish a connection to a specific database using ij.dataSource, set the ij.dataSource.databaseName
property. If you do not set this property, ij will start with an error..."

It's awkward, but I think it is needed given the current implementation.

Second, I think the sentence

"If you do not specify ij.dataSource.databaseName, you can still connect to a database after
the error indicating that no database was found, but you should not specify the protocol,
just the databasename, in the connect statement."

is a bit long and complex (I almost lose my breath reading it). Besides, I think "just the
databasename" may be misleading (because you may include connection attributes as well), and
that we should say "connect command" instead of "connect statement" (because that is how it
is described in the Tools guide). I suggest the following:

"If you do not specify ij.dataSource.databaseName and get an error indicating that no database
was found, you can still connect to a database manually by using ij's connect command. You
should not specify the protocol (for example jdbc:derby:) in the connect command when using

Actually, I think Example 2 as it is in the current doc trunk is useful to show this "feature",
but it should include the error message:

java -Dij.dataSource=org.apache.derby.jdbc.EmbeddedSimpleDataSource org.apache.derby.tools.ij
ERROR XJ004: Database '' not found.
ij version 10.4
ij> connect 'smalldb;create=true';

The doc page should include a reference to the documentation for the connect command.

Finally, the documentation for the connect command ( http://db.apache.org/derby/docs/dev/tools/rtoolsijcomref22318.html
) says:

"Connects to the database indicated by the ConnectionURLString. Specifically, takes the value
of the string database connection URL and issues a java.sql.DriverManager.getConnection request
to set the current connection to that database connection URL."

which is incorrect if you specify ij.dataSource (and do not include the protocol in the URL
- sigh...). Something like this is more correct, I guess:

"Connects to the database indicated by the ConnectionURLString. Specifically, ij takes the
value of the string (the database connection URL) and issues a getConnection request using
java.sql.DriverManager or a javax.sql.DataSource implementation (see the ij.dataSource property)
to set the current connection to that database connection URL."

(If the connect command docs should be handled in a separate Jira, feel free to create one,
or let me know so I can do it myself).

> ij rolls through NullPointerException (NPE) with J2ME/JSR169/WEME 6.1.
> ----------------------------------------------------------------------
>                 Key: DERBY-2733
>                 URL: https://issues.apache.org/jira/browse/DERBY-2733
>             Project: Derby
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions:,,
>         Environment: windows xp; j9 -jcl:foun11 -version:
> java version "J2ME Foundation Specification v1.1"
> IBM J9 2.3 Windows XP x86-32  (JIT enabled)
> J9VM - 20061023_08962_lHdSMR
> JIT  - 20060629_1804ifx1_r8
> GC   - 200609_15
> JCL  - 20061020_1321,foun11
> Licensed Materials - Property of IBM
> J9 - VM for the Java(TM) platform, Version 2.3
> (c) Copyright IBM Corp. 1991, 2006  All Rights Reserved
> Target: 20061023_08962_lHdSMR (Windows XP 5.1 build 2600 Service Pack 2 x86)
> JIT  - 20060629_1804ifx1_r8
>            Reporter: Myrna van Lunteren
>            Assignee: Myrna van Lunteren
>         Attachments: DERBY-2733-doc.diff, DERBY-2733-src.diff, DERBY-2733.diff2, DERBY-2733_3.diff,
DERBY-2733_doc_3.diff, DERBY-2733_doc_4.diff, rtoolsijproprefdatasource.html, rtoolsijproprefdatasource.html,
> When starting ij - with, or without any derby.properties, ij first shows this:
> -------------------------------------------------------
> java.lang.reflect.InvocationTargetException
>         at java.lang.reflect.AccessibleObject.invokeL(AccessibleObject.java:215)
>         at java.lang.reflect.Method.invoke(Method.java:272)
>         at org.apache.derby.impl.tools.ij.util.getDataSourceConnection(util.java:426)
>         at org.apache.derby.impl.tools.ij.util.startJBMS(util.java:516)
>         at org.apache.derby.impl.tools.ij.util.startJBMS(util.java:585)
>         at org.apache.derby.impl.tools.ij.ConnectionEnv.init(ConnectionEnv.java:64)
>         at org.apache.derby.impl.tools.ij.utilMain.initFromEnvironment(utilMain.java:179)
>         at org.apache.derby.impl.tools.ij.Main.<init>(Main.java:230)
>         at org.apache.derby.impl.tools.ij.Main.getMain(Main.java:193)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:178)
>         at org.apache.derby.impl.tools.ij.Main.main(Main.java:73)
>         at org.apache.derby.tools.ij.main(ij.java:67)
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.jdbc.InternalDriver.embeddedDriverAcceptsURL(InternalDriver.java:116)
>         at org.apache.derby.jdbc.InternalDriver.acceptsURL(InternalDriver.java:107)
>         at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:126)
>         at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection(EmbeddedSimpleDataSource.java:406)
>         at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection(EmbeddedSimpleDataSource.java:373)
>         at java.lang.reflect.AccessibleObject.invokeL(AccessibleObject.java:213)
>         ... 11 more
> ij version 10.3
> ij>
> After that, ij does appear to start normal operations.

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

View raw message