maxf11 <[email protected]> writes:
> I've tried this way but...it doesn't work.
> I've modified source code of SimpleApp :
>
> EmbeddedSimpleDataSource ds = new EmbeddedSimpleDataSource();
> System.out.println("Loaded the appropriate driver.");
>
> Connection conn = null;
> /*
> The connection specifies create=true to cause
> the database to be created. To remove the database,
> remove the directory derbyDB and its contents.
> The directory derbyDB will be created under
> the directory that the system property
> derby.system.home points to, or the current
> directory if derby.system.home is not set.
> */
> ds.setDatabaseName("derbyDB");
> ds.setCreateDatabase("create");
> conn = ds.getConnection();
>
> and I get this error:
>
> Startup failed due to missing functionality for
> org.apache.derby.iapi.services.stream.InfoStreams. Please ensure your
> classpath includes the correct Derby software.
> ERROR XBM02: Startup failed due to missing functionality for
> org.apache.derby.iapi.services.stream.InfoStreams. Please ensure your
> classpath includes the correct Derby software.
> at org.apache.derby.iapi.error.StandardException.newException()
> at
> org.apache.derby.iapi.services.monitor.Monitor.missingImplementation()
> at org.apache.derby.impl.services.monitor.TopService.bootModule()
> at org.apache.derby.impl.services.monitor.BaseMonitor.startModule()
> at org.apache.derby.iapi.services.monitor.Monitor.startSystemModule()
> at org.apache.derby.impl.services.monitor.BaseMonitor.runWithState()
> at org.apache.derby.impl.services.monitor.FileMonitor.<init>()
> at org.apache.derby.iapi.services.monitor.Monitor.startMonitor()
> at org.apache.derby.iapi.jdbc.JDBCBoot.boot()
> at org.apache.derby.jdbc.EmbeddedSimpleDataSource.findDriver()
> at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection()
> at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection()
> at SimpleApp.go()
> at SimpleApp.main()
>
> exception thrown:
> java.sql.SQLException: org.apache.derby.jdbc.EmbeddedDriver is not
> registered with the JDBC driver manager
It looks like the Derby engine believes creme is a full Java 1.3
implementation and tries to boot the JDBC 2.0 version of the driver,
instead of the JSR-169 one which is the only one that works on J2ME.
Derby doesn't have a mechanism to override this and tell it to treat
creme as a J2ME implementation (except by adding the necessary logic to
java/engine/org/apache/derby/iapi/services/info/JVMInfo.java and
rebuilding the jar file). However, since it makes the decision based on
the value of the java.specification.name system property, it might work
if you execute
System.setProperty("java.specification.name", "J2ME");
before you create the EmbeddedSimpleDataSource instance.
--
Knut Anders