Subject How to compile and debug InterClient with JBuilder(was: d3test.gb3 missing)
Author Torsten Welches
--- In IB-Java@egroups.com, krzysztofgolko@y... wrote:
> Hi all,
> I've managed to compile InterClient 2.0, under JBuilder 35, slight
> changes to the projrct were reuired. There are a few test classes
in
> the Test subdirectory. All of them try to connect to d3test.gdb or
> d3ro.gdb databases on server Venture.
> You thing we should get them from Borland?
>
> BTW. The compiler reports a lot of deprecated function calls
>
> regards
> kris golko

Kris,

I, too, am using JBuilder 3.5 to test InterClient (I started with
InterClient 1.6). I installed it this weekend and had to make some
changes as well. The "installation" is quite straightforward - here
are my installation notes, maybe they are useful for somebody (I'm
under NT). I'll talk about the deprecations in a seperate post.

1. Download the InterClient sources, e.g. IC16_sources.zip at
http://inprise-svca.www.conxion.com/

2. Extract it into some directory

3. Create a new directory for the debug classes (the obfuscated
classes don't contain debug information) - I named it debugClasses

4. Download the "JDBC 2.0 Optional Package" at
http://java.sun.com/products/jdbc/download.html#spec and install it
as a JBuilder library.

5. Download the "Java Transaction API (JTA)" at
http://java.sun.com/products/jta/index.html
and install it as a JBuilder library.

6. Create a new JBuilder project with following project properties:
- source: [InterClient install dir]\dev\packages
- documentation: [InterClient install dir]\dev\docs\specifications
- output path: [your new directory, e.g. ..\dev\debugClasses]
- required libraries: JDBC Extensions and JTA (see above)
- compiler tab: include debug info

7. Add package to project: interbase.interclient (select the the
interclient node in the "Select a class" dialog)

8. Try to compile the package/project
- the classes XAResource.java and XAConnection.java are slightly
outdated and cause compiler error (the JTA specification changed):

9. XAResource.java
- add this method
synchronized public boolean isSameRM(javax.transaction.xa.XAResource
xares) throws javax.transaction.xa.XAException { return false; }
- change the return type of method setTransactionTimeout from void to
boolean and add "return false;" in the method body.

10. XAConnection.java
-change the return type javax.jts.xa.XAResource to
javax.transaction.xa.XAResource

11. Compile should work now (ignore deprecation warnings for now)

12. Add a new class to the project (e.g. Tester.java) and do some
testing/tracing/breakpoints on InterClient classes. My Tester look
like this:

public class Tester {
static public void main (String args[]) {
java.sql.Connection c = null;
java.sql.Statement stmt = null;
java.sql.ResultSet results = null;
interbase.interclient.DataSource dataSource = new
interbase.interclient.DataSource ();
dataSource.setDatabaseName ("c:/program
files/Borland/InterBase/examples/database/employee.gdb");
try {
c = dataSource.getConnection ("sysdba", "masterkey");
try {
stmt = c.createStatement();
results = stmt.executeQuery("Select count(*) from
SALARY_HISTORY");
results.next();
System.out.println ("got connection with " + results.getInt
(1) + " records");
} finally {
if (results != null) results.close ();
if (stmt != null) stmt.close ();
if (c != null) c.close ();
}
} catch (java.sql.SQLException e) {
System.out.println ("sql exception: " + e.getMessage ());
}
}
}

The three XA (JTA) classes currently are not part of the official
InterClient release.

BTW - I used JBuilder 3.5 Enterprise, but the free Foundation
edition should work fine as well - if you don't have it yet, you
might want to check it out - good product!
http://www.borland.com/jbuilder/foundation/

Torsten