This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: class.forName() and java.sql
- From: Lars Andersen <lars at rimfaxe dot com>
- To: Erik Poupaert <erik dot poupaert at chello dot be>
- Cc: java at gcc dot gnu dot org
- Date: 27 Jan 2003 10:28:51 +0100
- Subject: Re: class.forName() and java.sql
- References: <POEIJGMGPFPGFHAGKFHAKEADCEAA.erik.poupaert@chello.be>
On Sun, 2003-01-26 at 23:56, Erik Poupaert wrote:
>
> I've natively compiled hSql into libhsql.a in order to embed an rdb in a
> test application I'm creating on minGW.
>
> The first snag is the fact that java.sql.DriverManager.getConnection()
> doesn't work, because class.forName() doesn't work. I circumvented the
> problem by using directly the jdbcDriver class. But then I ran into another
> snag:
>
> """java.sql.SQLException: java.util.MissingResourceException: Bundle
> gnu.java.locale.Calendar not found."""
>
> I guess it's related to the same problem, i.e., the fact that
> class.forName() doesn't work; since the java.util.date and
> java.util.Calendar related methods seem to use class.forName(). But on top
> of that, it's very hard to locate the problem and work around it, because I
> can't get a stacktrace on minGW in this version of GCJ.
>
Class.forName() works for me, but classes you load thru Class.forName()
may not be linked with the executable. (Meaning the class has to be
found in the classpath.)
I solve the gnu.java.locale.Calendar issue by adding lines like
private static Class c1 = gnu.java.locale.Calendar.class;
private static Class c2 = gnu.java.locale.LocaleInformation.class;
in my Calendar utility class. The trick is that these lines forces gcj
to link the classes into the executable. Perhaps this approach will
solve your JDBC issue as well.
/Lars Andersen