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-3187) SimpleApp (demo) does not work in a client setting
Date Wed, 07 Nov 2007 15:22:50 GMT

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

John H. Embretsen commented on DERBY-3187:
------------------------------------------

I'm wondering how the DERBY-2216 J2ME change was tested in a J2ME environment in the first
place. Wouldn't the statement "import java.sql.DriverManager" cause an error in a CDC environment?
At least it fails (with NoClassDefFoundError: java.sql.DriverManager) with the phoneME cvm
(CDC/FP), even if I make sure the check for J2ME (which in its current state is inadequate)
is true.

Anyway, I am planning to fix this for 10.3.2 as part of a major overhaul of the simple demo
(DERBY-3118). I'm currently considering two options:

1) Revert the J2ME changes introduced in DERBY-2216. Instead, we may create a separate simple
demo for the mobile platform.

2) Always keep the datasource's static type as javax.sql.DataSource, which is available in
all environments. When access to methods in EmbeddedSimpleDataSource is required (only in
Java ME environments), do a cast from DataSource to EmbeddedSimpleDataSource, e.g. like this:

((org.apache.derby.jdbc.EmbeddedSimpleDataSource)ds).setCreateDatabase("create");

instead of this:

ds.setCreateDatabase("create");


Option 2 works (runtime errors in non-mobile environments are avoided), at least in the JVM's
I've tried so far, but:
  a) I'm not sure it will work in all "supported" JVMs (need to refresh and extend my Java
spec knowledge a bit I guess).
  b) The code looks less elegant, which partly defeats the purpose of a *simple* demo.

So I'm inclined to go for option 1.

Any opinions? Or does anyone have any other options we could use to solve this?


> SimpleApp (demo) does not work in a client setting
> --------------------------------------------------
>
>                 Key: DERBY-3187
>                 URL: https://issues.apache.org/jira/browse/DERBY-3187
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Demos/Scripts
>    Affects Versions: 10.3.1.4
>         Environment: derbyclient (no derby.jar in the classpath)
>            Reporter: John H. Embretsen
>            Assignee: John H. Embretsen
>
> Since J2ME support was added to the simple demo (bin-releases: demo/programs/simple/SimpleApp.java)
in DERBY-2216 (first available in 10.3.1.4), the demo has not worked in a pure client setting
as described in the documentation (bin-releases: demo/programs/simple/example.html). This
is a regression from 10.2.2.0.
> $ export CLASSPATH=.:$DERBY_INSTALL/lib/derbyclient.jar
> $ cd $DERBY_INSTALL/demo/programs/simple
> 10.2.2.0:
> $ java SimpleApp derbyclient
> SimpleApp starting in derbyclient mode.
> Loaded the appropriate driver.
> Connected to and created database derbyDB
> Created table derbyDB
> Inserted 1956 Webster
> Inserted 1910 Union
> Updated 1956 Webster to 180 Grand
> Updated 180 Grand to 300 Lakeshore
> Verified the rows
> Dropped table derbyDB
> Closed result set and statement
> Committed transaction and closed connection
> SimpleApp finished
> 10.3.1.4:
> $ java SimpleApp derbyclient
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/derby/jdbc/EmbeddedSimpleDataSource

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


Mime
View raw message