Board index » delphi » Attempting my first java connection to an InterBase db...

Attempting my first java connection to an InterBase db...

Hi all,

W2K, InterBase 6.01 (384 MB of RAM).

Downloaded InterClient from the Borland web site. Install seemed to go
fine.

I have an InterBase db running locally. I know it's up and running,
because I can look at it in IBConsole.

Took sample programme DriverExample.java and changed it thus:

Changed the first line

public class FirstProg // DriverExample

and changed the db line to

    String databaseURL = "jdbc:interbase://10.160.1.190/C:/Program Files/Borland/InterBase/examples/Database/employee.gdb";

Could be a problem with the slashes - e.g "/" - if I leave in
backslashes, I get a problem when compiling - illegal escape
character.

I also copied *_all_* of the interclient jars into the directory that
I am running the programme in and

javac FirstProg.java

it said I was using a deprecated API, but that's normally OK.

I then tried to run my programme

java FirstProg and it immediately bombs out with the error

Exception in thread "main" java.lang.NoClassDefFoundError: FirstProg

Can anybody tell me what I am doing wrong?

Paul...

 

Re:Attempting my first java connection to an InterBase db...


 p...@esat.net (Paul Linehan) wrote:

Quote
> Exception in thread "main" java.lang.NoClassDefFoundError: FirstProg

I should mention that after compiling, I do get a FirstProg.class
file.

Paul...

Quote
> Paul...

Re:Attempting my first java connection to an InterBase db...


Quote
Matt Minyard wrote:

> Try this

>     java -classpath .;c:\"yourpath"\interclient.jar FirstProg

Put the value after the classpath switch in quotes. Like this:

java -classpath ".;c:\<path>\inerclient.jar" FirstProg

Failing to do this caused me no end of trouble a couple days ago.

Ben
--
InterBase Technical Support
Borland Software Corp.

And now a word from Legal and Marketing...

This e-mail, and any attachments thereto, is intended only for
use by the addressee(s) named herein and may contain legally
privileged and/or confidential information. If you are not the
intended recipient of this e-mail, you are hereby notified that
any  dissemination, distribution or copying of this e-mail, and
any attachments thereto, is strictly prohibited. If you have
received this e-mail in error, please immediately and permanently
delete the original and any copy of any e-mail and any printout
thereof.

Accelerate your Linux? application development with Kylix(TM),
the RAD tool for Linux. Easily integrate web, desktop and database
development to quickly deliver fast Linux applications. Kylix is
the only Linux development tool that combines the world's fastest
compiler with the most productive visual design environment for
GUI, web and database programming. Order your copy now!
http://www.borland.com/kylix/

Re:Attempting my first java connection to an InterBase db...


JDK 1.3 should be fine.

Matt

Quote
"Paul Linehan" <p...@esat.net> wrote in message

news:3abb87e4.887988970@newsgroups.borland.com...
Quote

>  p...@esat.net (Paul Linehan) wrote:

> > System returned (fairly quickly this line
> > -------------------
> > InterClient version 2.0 registered with driver manager.
> > -------------------

> > Then it returned
> > ---------------------------------------------
> > Closing database resources and rolling back any changes we made to the
> > database.

> > Exception in thread "main" java.lang.VerifyError: (class:
> > interbase/interclient/
> > ErrorKey, method: _$372 signature:
> > (Ljava/lang/String;Ljava/lang/String;I)V) Exp
> > ecting to find unitialized object on stack
> >         at interbase.interclient.JDBCNet._$125439(JDBCNet.java:92)
> >         at interbase.interclient.JDBCNet.<init>(JDBCNet.java:74)
> >         at interbase.interclient.Connection._$45044(Connection.java:317)
> >         at interbase.interclient.Connection.<init>(Connection.java:285)
> >         at interbase.interclient.Driver.connect(Driver.java:204)
> >         at java.sql.DriverManager.getConnection(DriverManager.java:517)
> >         at java.sql.DriverManager.getConnection(DriverManager.java:177)
> >         at FirstProg.main(FirstProg.java:223)

> > C:\Paul\Private\Java\jdbc>
> > ------------------------------------------------

> In fact, this looks like an error with the InterClient stuff and not
> the programme that accesses it.

> Could the problem here be because I am using the JDK 1.3 and it says
> 1.2 on the Borland web site for this stuff?

> Paul...

> > Paul...

Re:Attempting my first java connection to an InterBase db...


Please watch the over quoting.  You quoted ~500 lines to add 5.  Thank you.

Quote
Matt Minyard wrote:

--
Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
(Please do not email    'Till I lost the peace that dreaming gives
 me directly unless     I dreamed of the moment of my own death
 asked.  Thank You)     That no one ever dreams and lives (Marillion)

Re:Attempting my first java connection to an InterBase db...


 p...@esat.net (Paul Linehan) wrote:

Quote
> System returned (fairly quickly this line
> -------------------
> InterClient version 2.0 registered with driver manager.
> -------------------
> Then it returned
> ---------------------------------------------
> Closing database resources and rolling back any changes we made to the
> database.
> Exception in thread "main" java.lang.VerifyError: (class:
> interbase/interclient/
> ErrorKey, method: _$372 signature:
> (Ljava/lang/String;Ljava/lang/String;I)V) Exp
> ecting to find unitialized object on stack
>         at interbase.interclient.JDBCNet._$125439(JDBCNet.java:92)
>         at interbase.interclient.JDBCNet.<init>(JDBCNet.java:74)
>         at interbase.interclient.Connection._$45044(Connection.java:317)
>         at interbase.interclient.Connection.<init>(Connection.java:285)
>         at interbase.interclient.Driver.connect(Driver.java:204)
>         at java.sql.DriverManager.getConnection(DriverManager.java:517)
>         at java.sql.DriverManager.getConnection(DriverManager.java:177)
>         at FirstProg.main(FirstProg.java:223)

> C:\Paul\Private\Java\jdbc>
> ------------------------------------------------

In fact, this looks like an error with the InterClient stuff and not
the programme that accesses it.

Could the problem here be because I am using the JDK 1.3 and it says
1.2 on the Borland web site for this stuff?

Paul...

- Show quoted text -

Quote
> Paul...

Re:Attempting my first java connection to an InterBase db...


Try this

    java -classpath .;c:\"yourpath"\interclient.jar FirstProg

Matt

Quote
"Paul Linehan" <p...@esat.net> wrote in message

news:3abb46ef.871360229@newsgroups.borland.com...
Quote

> Hi all,

> W2K, InterBase 6.01 (384 MB of RAM).

> Downloaded InterClient from the Borland web site. Install seemed to go
> fine.

> I have an InterBase db running locally. I know it's up and running,
> because I can look at it in IBConsole.

> Took sample programme DriverExample.java and changed it thus:

> Changed the first line

> public class FirstProg // DriverExample

> and changed the db line to

>     String databaseURL = "jdbc:interbase://10.160.1.190/C:/Program

Files/Borland/InterBase/examples/Database/employee.gdb";

- Show quoted text -

Quote

> Could be a problem with the slashes - e.g "/" - if I leave in
> backslashes, I get a problem when compiling - illegal escape
> character.

> I also copied *_all_* of the interclient jars into the directory that
> I am running the programme in and

> javac FirstProg.java

> it said I was using a deprecated API, but that's normally OK.

> I then tried to run my programme

> java FirstProg and it immediately bombs out with the error

> Exception in thread "main" java.lang.NoClassDefFoundError: FirstProg

> Can anybody tell me what I am doing wrong?

> Paul...

Re:Attempting my first java connection to an InterBase db...


 "Matt Minyard" <m...@Minyard.org> wrote:

Quote
> Try this
>     java -classpath .;c:\"yourpath"\interclient.jar FirstProg

Thanks. Any chance of an explanation of what's going on here?

I Ran

---------------------------
C:\Paul\Private\Java\jdbc>java -classpath .;C:\Paul\Private\Java
\jdbc\interclient.jar FirstProg
--------------------------

System returned (fairly quickly this line
-------------------
InterClient version 2.0 registered with driver manager.
-------------------

Then it returned
---------------------------------------------
Closing database resources and rolling back any changes we made to the
database.

Exception in thread "main" java.lang.VerifyError: (class:
interbase/interclient/
ErrorKey, method: _$372 signature:
(Ljava/lang/String;Ljava/lang/String;I)V) Exp
ecting to find unitialized object on stack
        at interbase.interclient.JDBCNet._$125439(JDBCNet.java:92)
        at interbase.interclient.JDBCNet.<init>(JDBCNet.java:74)
        at interbase.interclient.Connection._$45044(Connection.java:317)
        at interbase.interclient.Connection.<init>(Connection.java:285)
        at interbase.interclient.Driver.connect(Driver.java:204)
        at java.sql.DriverManager.getConnection(DriverManager.java:517)
        at java.sql.DriverManager.getConnection(DriverManager.java:177)
        at FirstProg.main(FirstProg.java:223)

C:\Paul\Private\College\Java\jdbc>
------------------------------------------------

Anybody any ideas?

Paul...

Quote
> Matt

Re:Attempting my first java connection to an InterBase db...


Paul,

    Could you post some source?  One idea off the top of my head - I know
you mentioned that the Interbase server was running, but is the InterClient
server (InterServer) also running?

Matt

Quote
"Paul Linehan" <p...@esat.net> wrote in message

news:3abb54e5.874934319@newsgroups.borland.com...
Quote

>  "Matt Minyard" <m...@Minyard.org> wrote:

> > Try this

> >     java -classpath .;c:\"yourpath"\interclient.jar FirstProg

> Thanks. Any chance of an explanation of what's going on here?

> I Ran

> ---------------------------
> C:\Paul\Private\Java\jdbc>java -classpath .;C:\Paul\Private\Java
> \jdbc\interclient.jar FirstProg
> --------------------------

> System returned (fairly quickly this line
> -------------------
> InterClient version 2.0 registered with driver manager.
> -------------------

> Then it returned
> ---------------------------------------------
> Closing database resources and rolling back any changes we made to the
> database.

> Exception in thread "main" java.lang.VerifyError: (class:
> interbase/interclient/
> ErrorKey, method: _$372 signature:
> (Ljava/lang/String;Ljava/lang/String;I)V) Exp
> ecting to find unitialized object on stack
>         at interbase.interclient.JDBCNet._$125439(JDBCNet.java:92)
>         at interbase.interclient.JDBCNet.<init>(JDBCNet.java:74)
>         at interbase.interclient.Connection._$45044(Connection.java:317)
>         at interbase.interclient.Connection.<init>(Connection.java:285)
>         at interbase.interclient.Driver.connect(Driver.java:204)
>         at java.sql.DriverManager.getConnection(DriverManager.java:517)
>         at java.sql.DriverManager.getConnection(DriverManager.java:177)
>         at FirstProg.main(FirstProg.java:223)

> C:\Paul\Private\College\Java\jdbc>
> ------------------------------------------------

> Anybody any ideas?

> Paul...

> > Matt

Re:Attempting my first java connection to an InterBase db...


Paul,

    You are right, you did get a JDBC driver.  InterClient however supplies
a JDBC Type 3 driver (see SlideShow in docs downloaded with InterClient).
Quickly writing, this means that a "JDBC Server" (InterServer) must be
running to handle JDBC connections and communicate requests with database
engine (Interbase Server).

    Make sense?

Matt

Quote
"Paul Linehan" <p...@esat.net> wrote in message

news:3abb5cc6.876950918@newsgroups.borland.com...
Quote

>  "Matt Minyard" <m...@Minyard.org> wrote:

> >     Could you post some source?

> See source at end of post.

> > One idea off the top of my head - I know
> > you mentioned that the Interbase server was running, but is the
InterClient
> > server (InterServer) also running?

> Sorry, maybe I'm confused here. I thought that what I was getting with
> InterClient was a jdbc driver. Why do I need to run a further service?
> Just out of interest, I did this (ran the service) and it still
> doesn't work.

> Please excuse me if my questions appear stupid - I have nobody else to
> ask anything of here.

> Paul...

> > Matt

> ----this code is from the Borland example with InterClient, called
> DriverExample - I renamed it to FirstProg. I hope this is not a breach
> of any copywrite  - this is just for example/demo/comprehension
> purposes. The only lines I changed were the name of the file and the
> file location string. I put all the jar files from InterClient in my
> FirstProg directory and compiled as shown in the last post.

> // Copyright InterBase Software Corporation, 1998.
> // Written by com.inprise.interbase.interclient.r&d.PaulOstler :-)
> //
> // A small application to demonstrate basic, but not necessarily
> simple, JDBC features.
> //
> // Note: you will need to hardwire the path to your copy of
> employee.gdb
> //       as well as supply a user/password in the code below at the
> //       beginning of method main().

> public class FirstProg // DriverExample
> {
>   // Make a connection to an employee.gdb on your local machine,
>   // and demonstrate basic JDBC features.
>   // Notice that main() uses its own local variables rather than
>   // static class variables, so it need not be synchronized.

>   public static void main (String args[])
>   {
>     // Modify the following hardwired settings for your environment.
>     // Note: localhost is a TCP/IP keyword which resolves to your local

machine's IP address.
Quote
>     //       If localhost is not recognized, try using your local
machine's name or
>     //       the loopback IP address 127.0.0.1 in place of localhost.
>     String databaseURL = "jdbc:interbase://10.160.1.190/C:/Program

Files/Borland/InterBase/examples/Database/employee.gdb";

- Show quoted text -

Quote
>     String user = "SYSDBA";
>     String password = "masterkey";
>     String driverName = "interbase.interclient.Driver";

>     // As an exercise to the reader, add some code which extracts
databaseURL,
>     // user, and password from the program args[] to main().
>     // As a further exercise, allow the driver name to be passed as well,
>     // and modify the code below to use driverName rather than the
hardwired
>     // string "interbase.interclient.Driver" so that this code becomes
>     // driver independent.  However, the code will still rely on the
>     // predefined table structure of employee.gdb.

>     // See comment about closing JDBC objects at the end of this main()
method.
>     System.runFinalizersOnExit (true);

>     // Here are the JDBC objects we're going to work with.
>     // We're defining them outside the scope of the try block because
>     // they need to be visible in a finally clause which will be used
>     // to close everything when we are done.
>     // The finally clause will be executed even if an exception occurs.
>     java.sql.Driver d = null;
>     java.sql.Connection c = null;
>     java.sql.Statement s = null;
>     java.sql.ResultSet rs = null;

>     // Any return from this try block will first execute the finally
clause
>     // towards the bottom of this file.
>     try {

>       // Let's try to register the InterClient JDBC driver with the driver
manager
>       // using one of various registration alternatives...
>       int registrationAlternative = 1;
>       switch (registrationAlternative)
>       {

>       case 1:
>         // This is the standard alternative and simply loads the driver
class.
>         // Class.forName() instructs the java class loader to load
>         // and initialize a class.  As part of the class initialization
>         // any static clauses associated with the class are executed.
>         // Every driver class is required by the jdbc specification to
automatically
>         // create an instance of itself and register that instance with
the driver
>         // manager when the driver class is loaded by the java class
loader
>         // (this is done via a static clause associated with the driver
class).
>         //
>         // Notice that the driver name could have been supplied
dynamically,
>         // so that an application is not hardwired to any particular
driver
>         // as would be the case if a driver constructor were used, eg.
>         // new interbase.interclient.Driver().
>         try
>         {
>           Class.forName ("interbase.interclient.Driver");
>         }
>         catch (java.lang.ClassNotFoundException e)
>         {
>           // A call to Class.forName() forces us to consider this
exception :-)...
>           System.out.println ("InterClient not found in class path");
>           System.out.println (e.getMessage ());
>           return;
>         }
>         break;

>       case 2:
>         // There is a bug in some JDK 1.1 implementations, eg. with
Microsoft
>         // Internet Explorer, such that the implicit driver instance
created during
>         // class initialization does not get registered when the driver is
loaded
>         // with Class.forName().
>         // See the FAQ at http://java.sun.com/jdbc for more info on this
problem.
>         // Notice that in the following workaround for this bug, that if
the bug
>         // is not present, then two instances of the driver will be
registered
>         // with the driver manager, the implicit instance created by the
driver
>         // class's static clause and the one created explicitly with
newInstance().
>         // This alternative should not be used except to workaround a JDK
1.1
>         // implementation bug.
>         try {
>           java.sql.DriverManager.registerDriver (
>              (java.sql.Driver) Class.forName

("interbase.interclient.Driver").newInstance ()
Quote
>           );
>         }
>         catch (java.lang.ClassNotFoundException e) {
>           // A call to Class.forName() forces us to consider this
exception :-)...
>           System.out.println ("Driver not found in class path");
>           System.out.println (e.getMessage ());
>           return;
>         }
>         catch (java.lang.IllegalAccessException e) {
>           // A call to newInstance() forces us to consider this exception
:-)...
>           System.out.println ("Unable to access driver constructor, this

shouldn't happen!");
Quote
>           System.out.println (e.getMessage ());
>           return;
>         }
>         catch (java.lang.InstantiationException e) {
>           // A call to newInstance() forces us to consider this exception
:-)...
>           // Attempt to instantiate an interface or abstract class.
>           System.out.println ("Unable to create an instance of driver

class, this shouldn't happen!");

- Show quoted text -

Quote
>           System.out.println (e.getMessage ());
>           return;
>         }
>         catch (java.sql.SQLException e) {
>           // A call to registerDriver() forces us to consider this
exception :-)...
>           System.out.println ("Driver manager failed to register driver");
>           showSQLException (e);
>           return;
>         }
>         break;

>       case 3:
>         // Add the InterClient driver name to your system's jdbc.drivers
property list.
>         // The driver manager will load drivers from this system property
list.
>         // System.getProperties() may not be allowed for applets in some
browsers.
>         // For applets, use one of the Class.forName() alternatives above.
>         java.util.Properties sysProps = System.getProperties ();
>         StringBuffer drivers = new StringBuffer

("interbase.interclient.Driver");

- Show quoted text -

Quote
>         String oldDrivers = sysProps.getProperty ("jdbc.drivers");
>         if (oldDrivers != null)
>           drivers.append (":" + oldDrivers);
>         sysProps.put ("jdbc.drivers", drivers.toString ());
>         System.setProperties (sysProps);
>         break;

>       case 4:
>         // Advanced: This is a non-standard alternative, and is tied to
>         // a particular driver implementation, but is very flexible.
>         //
>         // It may be possible to configure a driver explicitly, either
thru
>         // the use of non-standard driver constructors, or non-standard
>         // driver "set" methods which somehow tailor the driver to behave
>         // differently from the default driver instance.
>         // Under this alternative, a driver instance is created explicitly
>         // using a driver specific constructor.  The driver may then be
>         // tailored differently from the default driver instance which is
>         // created automatically when the driver class is loaded by the
java class loader.
>         // For example, perhaps a driver instance could be created which
>         // is to behave like some older version of the driver.
>         //
>         // d = new interbase.interclient.Driver ();
>         // d.setVersion (interbase.interclient.Driver.OLD_VERSION);
>         // DriverManager.registerDriver (d);
>         // c = DriverManager.getConnection (...);
>         //
>         // Since two drivers, with differing behavior, are now

...

read more »

Re:Attempting my first java connection to an InterBase db...


 "Matt Minyard" <m...@Minyard.org> wrote:

Quote
>     Could you post some source?  

See source at end of post.

Quote
> One idea off the top of my head - I know
> you mentioned that the Interbase server was running, but is the InterClient
> server (InterServer) also running?

Sorry, maybe I'm confused here. I thought that what I was getting with
InterClient was a jdbc driver. Why do I need to run a further service?
Just out of interest, I did this (ran the service) and it still
doesn't work.

Please excuse me if my questions appear stupid - I have nobody else to
ask anything of here.

Paul...

Quote
> Matt

----this code is from the Borland example with InterClient, called
DriverExample - I renamed it to FirstProg. I hope this is not a breach
of any copywrite  - this is just for example/demo/comprehension
purposes. The only lines I changed were the name of the file and the
file location string. I put all the jar files from InterClient in my
FirstProg directory and compiled as shown in the last post.

// Copyright InterBase Software Corporation, 1998.
// Written by com.inprise.interbase.interclient.r&d.PaulOstler :-)
//
// A small application to demonstrate basic, but not necessarily
simple, JDBC features.
//
// Note: you will need to hardwire the path to your copy of
employee.gdb
//       as well as supply a user/password in the code below at the
//       beginning of method main().

public class FirstProg // DriverExample
{
  // Make a connection to an employee.gdb on your local machine,
  // and demonstrate basic JDBC features.
  // Notice that main() uses its own local variables rather than
  // static class variables, so it need not be synchronized.

  public static void main (String args[])
  {
    // Modify the following hardwired settings for your environment.
    // Note: localhost is a TCP/IP keyword which resolves to your local machine's IP address.
    //       If localhost is not recognized, try using your local machine's name or
    //       the loopback IP address 127.0.0.1 in place of localhost.
    String databaseURL = "jdbc:interbase://10.160.1.190/C:/Program Files/Borland/InterBase/examples/Database/employee.gdb";
    String user = "SYSDBA";
    String password = "masterkey";
    String driverName = "interbase.interclient.Driver";

    // As an exercise to the reader, add some code which extracts databaseURL,
    // user, and password from the program args[] to main().
    // As a further exercise, allow the driver name to be passed as well,
    // and modify the code below to use driverName rather than the hardwired
    // string "interbase.interclient.Driver" so that this code becomes
    // driver independent.  However, the code will still rely on the
    // predefined table structure of employee.gdb.

    // See comment about closing JDBC objects at the end of this main() method.
    System.runFinalizersOnExit (true);

    // Here are the JDBC objects we're going to work with.
    // We're defining them outside the scope of the try block because
    // they need to be visible in a finally clause which will be used
    // to close everything when we are done.
    // The finally clause will be executed even if an exception occurs.
    java.sql.Driver d = null;
    java.sql.Connection c = null;
    java.sql.Statement s = null;
    java.sql.ResultSet rs = null;

    // Any return from this try block will first execute the finally clause
    // towards the bottom of this file.
    try {

      // Let's try to register the InterClient JDBC driver with the driver manager
      // using one of various registration alternatives...
      int registrationAlternative = 1;
      switch (registrationAlternative)
      {

      case 1:
        // This is the standard alternative and simply loads the driver class.
        // Class.forName() instructs the java class loader to load
        // and initialize a class.  As part of the class initialization
        // any static clauses associated with the class are executed.
        // Every driver class is required by the jdbc specification to automatically
        // create an instance of itself and register that instance with the driver
        // manager when the driver class is loaded by the java class loader
        // (this is done via a static clause associated with the driver class).
        //
        // Notice that the driver name could have been supplied dynamically,
        // so that an application is not hardwired to any particular driver
        // as would be the case if a driver constructor were used, eg.
        // new interbase.interclient.Driver().
        try
        {
          Class.forName ("interbase.interclient.Driver");
        }
        catch (java.lang.ClassNotFoundException e)
        {
          // A call to Class.forName() forces us to consider this exception :-)...
          System.out.println ("InterClient not found in class path");
          System.out.println (e.getMessage ());
          return;
        }
        break;

      case 2:
        // There is a bug in some JDK 1.1 implementations, eg. with Microsoft
        // Internet Explorer, such that the implicit driver instance created during
        // class initialization does not get registered when the driver is loaded
        // with Class.forName().
        // See the FAQ at http://java.sun.com/jdbc for more info on this problem.
        // Notice that in the following workaround for this bug, that if the bug
        // is not present, then two instances of the driver will be registered
        // with the driver manager, the implicit instance created by the driver
        // class's static clause and the one created explicitly with newInstance().
        // This alternative should not be used except to workaround a JDK 1.1
        // implementation bug.
        try {
          java.sql.DriverManager.registerDriver (
             (java.sql.Driver) Class.forName ("interbase.interclient.Driver").newInstance ()
          );
        }
        catch (java.lang.ClassNotFoundException e) {
          // A call to Class.forName() forces us to consider this exception :-)...
          System.out.println ("Driver not found in class path");
          System.out.println (e.getMessage ());
          return;
        }
        catch (java.lang.IllegalAccessException e) {
          // A call to newInstance() forces us to consider this exception :-)...
          System.out.println ("Unable to access driver constructor, this shouldn't happen!");
          System.out.println (e.getMessage ());
          return;
        }
        catch (java.lang.InstantiationException e) {
          // A call to newInstance() forces us to consider this exception :-)...
          // Attempt to instantiate an interface or abstract class.
          System.out.println ("Unable to create an instance of driver class, this shouldn't happen!");
          System.out.println (e.getMessage ());
          return;
        }
        catch (java.sql.SQLException e) {
          // A call to registerDriver() forces us to consider this exception :-)...
          System.out.println ("Driver manager failed to register driver");
          showSQLException (e);
          return;
        }
        break;

      case 3:
        // Add the InterClient driver name to your system's jdbc.drivers property list.
        // The driver manager will load drivers from this system property list.
        // System.getProperties() may not be allowed for applets in some browsers.
        // For applets, use one of the Class.forName() alternatives above.
        java.util.Properties sysProps = System.getProperties ();
        StringBuffer drivers = new StringBuffer ("interbase.interclient.Driver");
        String oldDrivers = sysProps.getProperty ("jdbc.drivers");
        if (oldDrivers != null)
          drivers.append (":" + oldDrivers);
        sysProps.put ("jdbc.drivers", drivers.toString ());
        System.setProperties (sysProps);
        break;

      case 4:
        // Advanced: This is a non-standard alternative, and is tied to
        // a particular driver implementation, but is very flexible.
        //
        // It may be possible to configure a driver explicitly, either thru
        // the use of non-standard driver constructors, or non-standard
        // driver "set" methods which somehow tailor the driver to behave
        // differently from the default driver instance.
        // Under this alternative, a driver instance is created explicitly
        // using a driver specific constructor.  The driver may then be
        // tailored differently from the default driver instance which is
        // created automatically when the driver class is loaded by the java class loader.
        // For example, perhaps a driver instance could be created which
        // is to behave like some older version of the driver.
        //
        // d = new interbase.interclient.Driver ();
        // d.setVersion (interbase.interclient.Driver.OLD_VERSION);
        // DriverManager.registerDriver (d);
        // c = DriverManager.getConnection (...);
        //
        // Since two drivers, with differing behavior, are now registered with
        // the driver manager, they presumably must recognize different jdbc
        // subprotocols.  For example, the tailored driver may only recognize
        // "jdbc:interbase:old_version://...", whereas the default driver instance
        // would recognize the standard "jdbc:interbase://...".
        // There are currently no methods, such as the hypothetical setVersion(),
        // for tailoring an InterClient driver so this 4th alternative is academic
        // and not necessary for InterClient.
        //
        // It is also possible to create a tailored driver instance which
        // is *not* registered with the driver manager as follows
        //
        // d = new interbase.interclient.Driver ();
        // d.setVersion (interbase.interclient.Driver.OLD_VERSION);
        // c = d.connect
...

read more »

Re:Attempting my first java connection to an InterBase db...


 "Ben Matterson (Borland)" <bmatter...@borland.com> wrote:

Quote
> Put the value after the classpath switch in quotes. Like this:
> java -classpath ".;c:\<path>\inerclient.jar" FirstProg
> Failing to do this caused me no end of trouble a couple days ago.

I have also done  this and it still doesn't work.

It first does this

---------------
InterClient version 2.0 registered with driver manager.
--------------

Then nothing for about 20 - 30 seconds and then

---------------
Closing database resources and rolling back any changes we made to the
database.

Exception in thread "main" java.lang.VerifyError: (class:
interbase/interclient/
ErrorKey, method: _$372 signature:
(Ljava/lang/String;Ljava/lang/String;I)V) Exp
ecting to find unitialized object on stack
        at interbase.interclient.JDBCNet._$125439(JDBCNet.java:92)
        at interbase.interclient.JDBCNet.<init>(JDBCNet.java:74)
        at interbase.interclient.Connection._$45044(Connection.java:317)
        at interbase.interclient.Connection.<init>(Connection.java:285)
        at interbase.interclient.Driver.connect(Driver.java:204)
        at java.sql.DriverManager.getConnection(DriverManager.java:517)
        at java.sql.DriverManager.getConnection(DriverManager.java:177)
        at FirstProg.main(FirstProg.java:223)

C:\Paul\Private\Java\jdbc>
--------------------

Basically thrown back to the dos prompt.

Any other ideas?

Paul...

Quote
> Ben

Other Threads