| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: JDBC for Oracle on AIX 4.2 ?
In comp.lang.java.advocacy Mats Olsson <matso_at_dtek.chalmers.se> wrote:
: Of course not. Any static's are only run when the class they belong to
: is loaded, and they are only loaded when they are needed - like when you
: first create an object using it.
Hmm... I've not mentioned the example code what I used.
As you know if you've seen JDBC spec from JavaSoft,
one and frequently used way to load a JDBC driver is like
the following code:
Class.forName("my.sql.Driver");
I used it. Then it worked on Solaris machine with JDK 1.1.4
and won't on AIX machine with JDK 1.1.2.
Yes. That's true that JVM runs any static codes when the class
is actually loaded. But, what about the Class.forName() call?
The semantics of the call is mentioned in the API doc. as follows:
Returns the Class object associated with the class with the given
string name. Given the fully-qualified name for a class or
interface, this method attempts to locate, load and link the class.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If it succeeds, returns the Class object representing the class.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If it fails, the method throws a ClassNotFoundException.
The true semantics of Class.forName() should have loaded
the JDBC driver when the call is invoked.
That was my intention of the last posting.
: /Mats
Received on Sat Jan 03 1998 - 00:00:00 CST
![]() |
![]() |