You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Ch...@kost.admin.ch on 2006/02/16 11:50:50 UTC

RE: NullPointerException creating a new platform instance using h sqld b

Hi Tom,

How do I do that (it must be something like a connection pool!?)

Thanks

Christian

-------------------------------------- 
Christian Eugster
Koordinationsstelle für die dauerhafte Archivierung elektronischer
Unterlagen
c/o Schweizerisches Bundesarchiv
Archivstrasse 24      
3003 Bern

T/ 031 324 17 94
F/ 031 322 78 32
E/ christian.eugster@kost.admin.ch
W/ www.vsa-aas.org/Koordinationsstelle.78.0.html



-----Ursprüngliche Nachricht-----
Von: Thomas Dudziak [mailto:tomdzk@gmail.com]
Gesendet: Donnerstag, 16. Februar 2006 11:46
An: ddlutils-user@db.apache.org
Betreff: Re: NullPointerException creating a new platform instance using
hsqld b


On 2/16/06, Christian.Eugster@kost.admin.ch
<Ch...@kost.admin.ch> wrote:

> I try to use an hsqldb database in my application. The following code
throws
> a NullPointerException at the last line (>):
>
>         Class.forName( "org.hsqldb.jdbcDriver" );
>         org.hsqldb.jdbc.jdbcDataSource ds = new
> org.hsqldb.jdbc.jdbcDataSource();
>         ds.setDatabase(db.getName());
>         ds.setUser("sa");
>         ds.setPassword("");
> >       Platform platform = PlatformFactory.createNewPlatformInstance(ds,
> "sa", "");
>
> The hsqldb server ist running...
>
> The Exception:
>
> Exception in thread "main" java.lang.NullPointerException
>         at
>
org.apache.ddlutils.PlatformUtils.determineDatabaseType(PlatformUtils.java:2
> 48)

Since I've never used the Hsqldb DataSource (I always use DBCP with
Hsqldb), I can only guess here, but looking at the code, its either
that the data source does not return a connection (but does not throw
a SQL exception either as it is supposed to do), or that the
connection does not return a metadata object (and does not throw a SQL
exception either as it is supposed to do).
Either way, could you try this with DBCP instead of the Hsqldb data
source just to see whether it works then ?

Tom

Re: NullPointerException creating a new platform instance using h sqld b

Posted by Thomas Dudziak <to...@gmail.com>.
On 2/16/06, Christian.Eugster@kost.admin.ch
<Ch...@kost.admin.ch> wrote:

> How do I do that (it must be something like a connection pool!?)

Not necessarily. It should suffice to create an instance of
BasicDataSource
(http://jakarta.apache.org/commons/dbcp/apidocs/org/apache/commons/dbcp/BasicDataSource.html)
and set the appropriate parameters (driver name, jdbc url, username,
password).

Tom