Solved

IBM-JDBC on Solaris (No Suitable Driver)

Posted on 1998-11-18
13
786 Views
Last Modified: 2013-12-05
I am trying to get JDBC to work on a Solaris box.
SunOS Release 5.5.1 Version Generic_103640-12 [UNIX(r) System V Release
4.0]
Copyright (c) 1983-1996, Sun Microsystems, Inc.

DB2 can connect to the database with no problem as shown below.
maquis% db2
(c) Copyright IBM Corporation 1993,1995
Command Line Processor for DB2 Client Application Enabler 2.1.2


db2 => connect to db user mmoore using passwd
Database Connection Information
 Database product       = DB2/2 2.1.2
 SQL authorization ID   = MMOORE
 Local database alias   = DB

db2 => quit

THE PROBLEM IS
The Java program gets the following error at run time when using
jdk1.1.3:
maquis% java custfea
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:108)at
java.sql.DriverManager.getConnection(DriverManager.java:126) at custfea.main(custfea.java:22)

HERE ARE THE DETAILS:
--------------------
maquis% env
HOME=/u02/home/db2user
PATH=.:/bin:/usr/bin:/usr/ucb:/etc:/usr/proc/bin:/usr/openwin/bin:/opt/local/bin
:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/local/jdk1.1.3/bin:/u02/home/db2user/sqllib
/bin:/u02/home/db2user/sqllib/adm:/u02/home/db2user/sqllib/misc
LOGNAME=db2user
HZ=100
TZ=US/Pacific
TERM=dtterm
SHELL=/bin/csh
PWD=/u02/home/db2user
USER=db2user
LD_LIBRARY_PATH=/opt/IBMdb2/V2.1/lib:/opt/SUNWspro/lib:/usr/openwin/lib
CLASSPATH=.:/opt/IBMdb2/V2.1/java/db2java.zip
DB2DIR=/opt/IBMdb2/V2.1
DB2INSTANCE=db2user
INSTHOME=/u02/home/db2user
DB2DBDFT=DB
DFLTLOCALE=en_US
BOOKSHELF=/opt/IBMdb2/V2.1/doc/en_US
DB2COMM=TCPIP
DB2INSTPATH=/u02/home/db2user
maquis% which javac          
/usr/local/jdk1.1.3/bin/javac
maquis% java -version
java version "1.1.3"
maquis% javac -verbose custfea.java
[parsed custfea.java in 1707 ms]
[loaded /usr/local/jdk1.1.3/bin/../lib/classes.zip(java/net/URL.class)
in 506
ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/Object.class) in
97
ms]
[checking class custfea]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/Class.class) in
293
ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/ClassNotFoundException.clas
s) in 24 ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/Exception.class)
in
25 ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/Throwable.class)
in
97 ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/Error.class) in 23
ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/RuntimeException.class) in
25 ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/String.class) in
379 ms]
[loaded /opt/IBMdb2/V2.1/java/db2java.zip(java/sql/Connection.class) in
122 ms]
[loaded /opt/IBMdb2/V2.1/java/db2java.zip(java/sql/DriverManager.class)
in 216
ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/System.class) in
210 ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/io/PrintStream.class)
in
165 ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/io/Serializable.class)
in 17 ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/io/FilterOutputStream.class) in
42 ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/io/OutputStream.class)
in 33 ms]
[loaded /opt/IBMdb2/V2.1/java/db2java.zip(java/sql/Statement.class) in
81 ms]
[loaded /opt/IBMdb2/V2.1/java/db2java.zip(java/sql/ResultSet.class) in
190 ms]
[loaded /opt/IBMdb2/V2.1/java/db2java.zip(java/sql/SQLException.class)
in 84 ms]
[loaded
/usr/local/jdk1.1.3/bin/../lib/classes.zip(java/lang/StringBuffer.class)
in 195 ms]
[wrote custfea.class]
[done in 11733 ms]
maquis% java -verbose custfea
[Loaded java/lang/Thread.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Object.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Class.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/String.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/Serializable.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/ThreadDeath.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Error.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Throwable.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Exception.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/RuntimeException.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Cloneable.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Runnable.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/ThreadGroup.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/StringBuffer.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/System.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Integer.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Number.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Character.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/NoClassDefFoundError.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/LinkageError.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/OutOfMemoryError.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/VirtualMachineError.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/util/Properties.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/util/Hashtable.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/util/Dictionary.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/util/HashtableEntry.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/FileInputStream.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/InputStream.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/FileDescriptor.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/FileOutputStream.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/OutputStream.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/BufferedInputStream.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/FilterInputStream.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/PrintStream.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/FilterOutputStream.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/BufferedOutputStream.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/OutputStreamWriter.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/Writer.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded sun/io/CharToByteConverter.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded sun/io/CharacterEncoding.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/util/Locale.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded sun/io/CharToByte8859_1.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/io/BufferedWriter.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/Compiler.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded ./custfea.class]
[Loaded ibm/sql/DB2Driver.class from /opt/IBMdb2/V2.1/java/db2java.zip]
[Loaded java/sql/Driver.class from /opt/IBMdb2/V2.1/java/db2java.zip]
[Loaded java/lang/Runtime.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/IllegalMonitorStateException.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/sql/DriverManager.class from
/opt/IBMdb2/V2.1/java/db2java.zip]
[Loaded java/util/Vector.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/sql/SQLException.class from
/opt/IBMdb2/V2.1/java/db2java.zip]
java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getConnection(DriverManager.java:108)
        at java.sql.DriverManager.getConnection(DriverManager.java:126)
        at custfea.main(custfea.java:22)
------------------------------------------

I have also tried using Java 1.0.2 and here are the results: (the rest
of the examples pertain to JDK1.1.3 only.
maquis% java -version
java version "1.0.2"
maquis% javac custfea.java
maquis% java custfea
java.lang.IllegalMonitorStateException: current thread not owner
at ibm.sql.DB2Driver.<init>(DB2Driver.java:107) at
ibm.sql.DB2Driver.<clinit>(DB2Driver.java:82) at
custfea.<clinit>(custfea.java:10)
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:108) at
java.sql.DriverManager.getConnection(DriverManager.java:126) at
custfea.main(custfea.java:22)

----------------------------------




Here is misc information that may help in debugging my problem.
maquis% more db2cli.ini
; Comment lines start with a semi-colon.
[tstcli1x]
uid=mmoore
pwd=passwd
autocommit=0
TableType="'TABLE','VIEW','SYSTEM TABLE'"

[tstcli2x]
; Assuming dbalias2 is a database in DB2 for MVS.
SchemaList="'OWNER1','OWNER2',CURRENT SQLID"

[MyVeryLongDBALIASName]
dbaliasÛalias3
SysSchema=MYSCHEMA
-------------------

maquis% whoami
db2user

maquis% pwd
/u02/home/db2user

maquis% java -version
java version "1.1.3"

maquis% which java
/usr/local/jdk1.1.3/bin/java

Here is the java program source code. It compiles with no problem and
the same CODE WORKS on Win95 with CAE.
--------------------------------
maquis% cat custfea.java
import java.net.URL;
import java.sql.*;
import ibm.sql.*;

class custfea {
static {
try {
// register the driver with DriverManager
Class.forName("ibm.sql.DB2Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
      }
   }

public static void main(String argv[]) {
try {
// URL is jdbc:db2:dbname
String url = "jdbc:db2:db";

// connect with default id/password
Connection con =
DriverManager.getConnection(url,"mmoore","passwd");
// retrieve data from the database
System.out.println("Retrieve some data from the database...");
Statement stmt;
ResultSet rs;
stmt = con.createStatement();
rs = stmt.executeQuery(
"SELECT cust_bill_id, feature_code, curr_status,
primary_dns_srvr "+
"  from iprov.cust_features where cust_bill_id = '01570476
'");

System.out.println("Received results:");
// display the result set
// rs.next() returns false when there are no more rows
while (rs.next()) {
String a = rs.getString(1);
String b = rs.getString(2);
String c = rs.getString(3);
String d = rs.getString(4);
            System.out.print("cust_bill_id     = " + a + "\n");
            System.out.print("feature_code     = " + b + "\n");
            System.out.print("curr_status      = " + c + "\n");
System.out.print("primary_dns_srvr = " + d + "\n");
System.out.print("\n");
         }

rs.close();
stmt.close();


} catch( Exception e ) {
e.printStackTrace();
      }
   }
}
-----------------------------------

Other stuff to prove that I set it up right.
maquis% which db2
/u02/home/db2user/sqllib/bin/db2

maquis% cat /etc/services | grep db2
db2query1c 5300/tcp  
                   
maquis% cat /etc/system | grep msgsys
set msgsys:msginfo_msgmnb = 65535
set msgsys:msginfo_msgmax = 65535
set msgsys:msginfo_msgmap = 602
set msgsys:msginfo_msgmni = 400
set msgsys:msginfo_msgssz = 16
set msgsys:msginfo_msgtql = 600
set msgsys:msginfo_msgseg = 32768

maquis% showrev -p
Patch: 103630-09  Obsoletes:   Packages: SUNWcsu, SUNWcsr
Patch: 103663-08  Obsoletes: 103683-01  Packages: SUNWcsu, SUNWcsr,
SUNWhea
Patch: 103582-15  Obsoletes:   Packages: SUNWcsu, SUNWcsr
Patch: 103594-10  Obsoletes:   Packages: SUNWcsu
Patch: 103600-18  Obsoletes: 103609-02  Packages: SUNWcsu, SUNWcsr
Patch: 103612-33  Obsoletes: 103615-04, 103654-01  Packages: SUNWcsu,
SUNWcsr, SUNWarc, SUNWscpu, SUNWnisu,
SUNWsra
Patch: 103640-12  Obsoletes: 103591-09, 103658-02, 103920-05  Packages:
SUNWcsu, SUNWcsr, SUNWcar, SUNWhea
Patch: 103680-01  Obsoletes:   Packages: SUNWcsu
Patch: 103690-05  Obsoletes:   Packages: SUNWcsu
Patch: 103696-02  Obsoletes:   Packages: SUNWcsu, SUNWcsr
Patch: 103817-01  Obsoletes:   Packages: SUNWcsu
Patch: 103934-05  Obsoletes:   Packages: SUNWcsu, SUNWcsr, SUNWhea
Patch: 104266-01  Obsoletes:   Packages: SUNWcsu
Patch: 104317-01  Obsoletes:   Packages: SUNWcsu
Patch: 104331-04  Obsoletes:   Packages: SUNWcsu
Patch: 104433-04  Obsoletes:   Packages: SUNWcsu, SUNWcsr
Patch: 104334-01  Obsoletes:   Packages: SUNWcsu
Patch: 104613-01  Obsoletes:   Packages: SUNWcsu
Patch: 104654-03  Obsoletes:   Packages: SUNWcsu
Patch: 104692-01  Obsoletes:   Packages: SUNWcsu
Patch: 104708-06  Obsoletes: 104710-01, 103766-02  Packages: SUNWcsu,
SUNWhea
Patch: 104736-03  Obsoletes:   Packages: SUNWcsu
Patch: 104776-01  Obsoletes:   Packages: SUNWcsu, SUNWarc
Patch: 104958-01  Obsoletes:   Packages: SUNWcsu
Patch: 104960-01  Obsoletes:   Packages: SUNWcsu
Patch: 104968-01  Obsoletes:   Packages: SUNWcsu
Patch: 105050-01  Obsoletes:   Packages: SUNWcsu, SUNWscpu
Patch: 104893-01  Obsoletes:   Packages: SUNWcsr
Patch: 105004-06  Obsoletes: 104604-04  Packages: SUNWcsr, SUNWhea
Patch: 104795-02  Obsoletes:   Packages: SUNWkvm
Patch: 103566-21  Obsoletes:   Packages: SUNWxwplt, SUNWxwslb, SUNWxwopt
Patch: 104338-02  Obsoletes:   Packages: SUNWxwplt, SUNWxwslb
Patch: 104010-01  Obsoletes:   Packages: SUNWvolu
Patch: 103959-05  Obsoletes:   Packages: SUNWscpu, SUNWlpr, SUNWlpu,
SUNWlps
Patch: 103866-03  Obsoletes:   Packages: SUNWbcp
Patch: 103686-02  Obsoletes:   Packages: SUNWnisu
Patch: 103901-08  Obsoletes:   Packages: SUNWolrte, SUNWolinc, SUNWolslb
Patch: 103900-01  Obsoletes:   Packages: SUNWowbcp
Patch: 105251-01  Obsoletes:   Packages: SUNWowbcp
Patch: 103461-18  Obsoletes:   Packages: SUNWmfrun
Patch: 103558-10  Obsoletes:   Packages: SUNWadmap, SUNWadmc
Patch: 103879-04  Obsoletes:   Packages: SUNWkcsrt

maquis# dmesg
Nov 17 11:04
ock 40 MHz) cpu2: Cypress,CY605 (mid 10 impl 0x1 ver 0xb clock 40 MHz)
cpu3: Cypress,CY605 (mid 11 impl 0x1 ver 0xb clock 40 MHz) mem = 327680K
(0x14000000)
avail mem = 324968448
Ethernet address = 8:0:20:17:d9:84
root nexus = SUNW,SPARCsystem-600
iommu0 at root: obio 0xe0000000
sbus0 at iommu0: obio 0xe0001000
dma0 at sbus0: SBus slot f 0x81000
dma1 at sbus0: SBus slot 0 0x81000
dma2 at sbus0: SBus slot 1 0x81000
esp0 at dma0: SBus slot f 0x80000 sparc ipl 4
esp1 at dma1: SBus slot 0 0x80000 SBus level 3 sparc ipl 5
esp2 at dma2: SBus slot 1 0x80000 SBus level 3 sparc ipl 5
sd3 at esp0: target 3 lun 0
sd3 is /iommu@f,e0000000/sbus@f,e0001000/dma@f,81000/esp@f,80000/sd@3,0
<SUN1.3G cyl 1965 alt 2 hd 17 sec 80>
sd6 at esp0: target 6 lun 0
sd6 is /iommu@f,e0000000/sbus@f,e0001000/dma@f,81000/esp@f,80000/sd@6,0
        <>
sd16 at esp1: target 1 lun 0
sd16 is /iommu@f,e0000000/sbus@f,e0001000/dma@0,81000/esp@0,80000/sd@1,0
<SUN1.3G cyl 1965 alt 2 hd 17 sec 80>
sd17 at esp1: target 2 lun 0
sd17 is /iommu@f,e0000000/sbus@f,e0001000/dma@0,81000/esp@0,80000/sd@2,0
<SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
sd18 at esp1: target 3 lun 0
sd18 is /iommu@f,e0000000/sbus@f,e0001000/dma@0,81000/esp@0,80000/sd@3,0
<SUN1.3G cyl 1965 alt 2 hd 17 sec 80>
sd31 at esp2: target 1 lun 0
sd31 is /iommu@f,e0000000/sbus@f,e0001000/dma@1,81000/esp@1,80000/sd@1,0
<SUN1.3G cyl 1965 alt 2 hd 17 sec 80>
sd33 at esp2: target 3 lun 0
sd33 is /iommu@f,e0000000/sbus@f,e0001000/dma@1,81000/esp@1,80000/sd@3,0
<SUN1.3G cyl 1965 alt 2 hd 17 sec 80>
root on
/iommu@f,e0000000/sbus@f,e0001000/dma@f,81000/esp@f,80000/sd@3,0:a
fstype ufs
obio0 at root
zs0 at obio0: obio 0x100000 sparc ipl 12
zs0 is /obio/zs@0,100000
zs1 at obio0: obio 0x0 sparc ipl 12
zs1 is /obio/zs@0,0
cpu 0 initialization complete - online
cpu 1 initialization complete - online
cpu 2 initialization complete - online
cpu 3 initialization complete - online
vme0 at iommu0: space f offset df010000 and space f offset d0000000
lebuffer0 at sbus0: SBus slot f 0x40000
le0 at lebuffer0: SBus slot f 0x60000 sparc ipl 6
le0 is /iommu@f,e0000000/sbus@f,e0001000/lebuffer@f,40000/le@f,60000
lebuffer1 at sbus0: SBus slot 0 0x40000 le1 at lebuffer1: SBus slot 0
0x60000 SBus level 4 sparc ipl 7 le1 is
/iommu@f,e0000000/sbus@f,e0001000/lebuffer@0,40000/le@0,60000 lebuffer2
at sbus0: SBus slot 1 0x40000 le2 at lebuffer2: SBus slot 1 0x60000 SBus
level 4 sparc ipl 7 le2 is
/iommu@f,e0000000/sbus@f,e0001000/lebuffer@1,40000/le@1,60000 dump on
/dev/dsk/c0t3d0s1 size 163856K syncing file systems.j sion
Generic_103640-12 [UNIX(r) System V Release 4.0]
Copyright j j ed in write back mode cpu0: Cypress,CY605 (mid 8 impl 0x1
ver 0xj Y605 (mid 9 impl 0x1 ver 0xb clock 40 MHz) cpu2: Cypress,CY605
(mid 10 impl 0x1 ver\ clock 40 MHz) cpu3: Cypress,CY605 (mid 11 impl 0x1
ver 0xb clock 40 MHz)
mem = 327680K (0x1400000vail mem = 324968448
Ethernet address = 8:0:20:17:d9:84
root nexus = SUNW,SPARCsystem-600
iommu0/platform/sun4m/ufsbootem-600/ufsbootu0: obio 0xe0001000
dma0 at sbus0: SBus slot f 0x81000
dma1 at sbus0: SBus slot 0 0x81000
dma2 at sbus0: SBus slot 1 0x81000
esp0 at dma0: SBus slot f 0x80000 sparc ipl 4
esp1 at dma1: SBus slot 0 0x80000 SBus level 3 sparc ipl 5
esp2 at dma2: SBus slot 1 0x80000 SBus level 3 sparc ipl 5
sd3 at esp0: target 3 lun 0
sd3 is /iommu@f,e0000000/sbus@f,e0001000/dma@f,81000/esp@f,80000/sd@3,0
<SUN1.3G cyl 1965 alt 2 hd 17 sec 80>
sd6 at esp0: target 6 lun 0
sd6 is /iommu@f,e0000000/sbus@f,j /sd@6,0
        <>
sd16 at esp1: target 1 lun 0
sd16 is /iommu@f,e0000j esp@0,80000/sd@1,0
<SUN1.3G cyl 1965 alt 2 hd 17 sec 80>
sd17 j /iommu@f,e0000000/sbus@f,e0001000/dma@0,81000/esj733 alt 2 hd 19
sec 80>
sd18 at esp1: target 3 lun 0
sd18 is /ijdma@0,81000/esp@0,80000/sd@3,0
<SUN1.3G cyl 1965 alt 2 hd 17 sec 80>
sd31 at esp2: target 1 lun 0
sd31 is
/iommu@f,e0000000/sbus@f,e0001000/dma@1,81000/esp@1,80000/sdj```\?8@46H4
(
$[ Z'\'?@$on /iommu@f,e0000000/sbus@f,e0001000/dma@@`@W`3},@zs0 is
/obio/zs@0,100000
zs1 at obio0: obio 0x0 sparc ipl 12
zs1 is /obio/zs@0,0
cpu 0 initialization complete - online
cpu 1 initialization complete - online
cpu 2 initialization complete - online
cpu 3 initialization complete - online
vme0 at iommu0: space f offset df010000 and space f offset d0000000
lebuffer0 at sbus0: SBus slot f 0x40000
le0 at lebuffer0: SBus slot f 0x60000 sparc ipl 6
le0 is /iommu@f,e0000000/sbus@f,e0001000/lebuffer@f,40000/le@f,60000
lebuffer1 at sbus0: SBus slot 0 0x40000 le1 at lebuffer1: SBus slot 0
0x60000 SBus level 4 sparc ipl 7 le1 is
/iommu@f,e0000000/sbus@f,e0001000/lebuffer@0,40000/le@0,60000 lebuffer2
at sbus0: SBus slot 1 0x40000 le2 at lebuffer2: SBus slot 1 0x60000 SBus
level 4 sparc ipl 7 le2 is
/iommu@f,e0000000/sbus@f,e0001000/lebuffer@1,40000/le@1,60000 dump on
/dev/dsk/c0t3d0s1 size 163856K SunOS Release 5.5.1 Version
Generic_103640-12 [UNIX(r) System V Release 4.0]
Copyright (c) 1983-1996, Sun Microsystems, Inc.  vac: enabled in write
back mode cpu0: Cypress,CY605 (mid 8 impl 0x1 ver 0xb clock 40 MHz)
cpu1: Cypress,CY605 (mid 9 impl 0x1 ver 0xb clock 40 MHz) cpu2:
Cypress,CY605 (mid 10 impl 0x1 ver 0xb clock 40 MHz) cpu3: Cypress,CY605
(mid 11 impl 0x1 ver 0xb clock 40 MHz) mem = 327680K (0x14000000)
avail mem = 324964352
Ethernet address = 8:0:20:17:d9:84
root nexus = SUNW,SPARCsystem-600
iommu0 at root: obio 0xe0000000
sbus0 at iommu0: obio 0xe0001000
dma0 at sbus0: SBus slot f 0x81000
dma1 at sbus0: SBus slot 0 0x81000
dma2 at sbus0: SBus slot 1 0x81000
esp0 at dma0: SBus slot f 0x80000 sparc ipl 4

Hope I have not missed anything but if so, let me know and I will get it
to you right away.
Thanks,
Mike Moore


0
Comment
Question by:mmoore
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 6

Expert Comment

by:gadio
Comment Utility
mmoore, your original problem was illigal monitor state, which means that the driver stried to do something while it was not the owner of some objects monitor. Assuming that the driver is bug free (as much as possible...), the blame must be in the code you written. I feel that the static initialization may be the problem since the exception seems to be throws upon loading. Can you try and initialize the driver not in a static section, and if possible, not through forName()? Please tell me if it made a difference.

Regards,
gadio
0
 
LVL 3

Author Comment

by:mmoore
Comment Utility
I don't know how to register a driver without using forName()
but here is at test without the static initialization. By the
way, the example with the static initialization is the way IBM
does it in there SAMPLE provided with the install, and it works
just fine on my Win95 box.
--------------------------------
maquis% cat test.java
import java.net.URL;
import java.sql.*;
import ibm.sql.*;

class test {
   public static void main(String argv[]) {
      try {
         Class.forName("ibm.sql.DB2Driver");
      } catch (ClassNotFoundException e) {
         e.printStackTrace();
      }
      try {
         String url = "jdbc:db2:db";
         Connection con = DriverManager.getConnection(url,"mmoore","passwd");
         Statement stmt;
         ResultSet rs;
         stmt = con.createStatement();
         rs = stmt.executeQuery(
         "SELECT cust_bill_id "+
         "  from iprov.cust_features where cust_bill_id = '01570476    '");
         System.out.println("Received results:");
         while (rs.next()) {
            String a = rs.getString(1);
            System.out.print("cust_bill_id     = " + a + "\n");
            System.out.print("\n");
         }
         rs.close();
         stmt.close();
      } catch( Exception e ) {
         e.printStackTrace();
      }
   }
}
maquis% java -version
java version "1.1.3"
maquis% javac test.java

maquis% java -verbose test
[Loaded java/lang/Thread.class
/usr/local/jdk1.1.3/bin/../lib/classes.zip]

. snipped due to lack of anything interesting ...

[Loaded java/lang/Compiler.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded ./test.class]
[Loaded ibm/sql/DB2Driver.class from /opt/IBMdb2/V2.1/java/db2java.zip]
[Loaded java/sql/Driver.class from /opt/IBMdb2/V2.1/java/db2java.zip]
[Loaded java/lang/Runtime.class from /usr/local/jdk1.1.3/bin/../lib/classes.zip]
[Loaded java/lang/IllegalMonitorStateException.class from
/usr/local/jdk1.1.3/bin/../lib/classes.zip]
java.lang.NoClassDefFoundError
maquis%

So, that yeilds a different error, but I am still in the dark.
0
 
LVL 5

Expert Comment

by:msmolyak
Comment Utility
Doing Class.forName() is the way JDBC spec suggests registering the driver, so if the driver is bug free it should not be a problem.

The other way to initailize the driver is to instantiate the driver class provided it has a public cosntructor or simply declare a variable of ibm.sql.DB2Driver class.

If you have the source code (or can decompile the code) for the driver, look into it. The monitor exception is thrown when wait() or notify() are used improperly. For you it simply means that the driver did not register itself with the driver manager which is why the latter cannot find a suitable driver for you connection string. Try to understand why the driver fails to initialize.
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 600 total points
Comment Utility
i see three posibilities
1. ibm.sql.DB2Driver is corrupted
2. some part of the second JDK is corrupted
3. your driver neads more newer JDK version
(and i think that the real problem is 3.)

it seems that you have problems even when you just load the Driver ... so try to compile and run this program ...
(is the driver 100% pure java ??)

import ibm.sql.*;
      class test {
         public static void main(String argv[]) {
            try {
               Class.forName("ibm.sql.DB2Driver");
            } catch (ClassNotFoundException e) {
               System.out.println("cathed ..\n");
               e.printStackTrace();
            }
      }

you should still receive some kind of exception - maybe
java.lang.NoClassDefFoundError - which means that classloader couldn't load successfully load the ibm.sql.DB2Driver.class because when it has tried to load (and resolve) its base classes and interfaces it has encounter some strange problem - most of time this is because the driver has been compiled with a different (newer) version of java.

so the only solution (if this is the problem) is to upgrade.
hope this helps
  heyhey
0
 
LVL 3

Author Comment

by:mmoore
Comment Utility
Yes, I had considered a version mismatch. IBM's documentation says to use Java 1.0 for CAE 2.1.2. So when Java1.1.3 failed, I installed Java 1.0.2 and that also failed as shown in my example. But here is the weird thing ... on my PC the whole thing works just fine with Java 1.1.7A . So, I installed 1.1.7A on my Solaris just for yucks. Unfortunately, when I try to either compile (javac) or run (java) the only message I get is
Unable to initialize threads: cannot find class java/lang/Thread.
I did not mention this before because I suspect that somehow I botched the install. ( the disk filled up mid-install and I
had to clear space and continue .. maybe this is totally irrelevant but maybe not ... I don't know.)

So I guess I will try to re-install 1.1.7A and if that does not
work I will try 1.1.6. If either one of these works, you get the
points.

Also - tried your test case and you were right, it failed just like the other one - NoClassDefFoundError

Maybe you know why my 1.1.7A was failing?
Thanks,
Mike
0
 
LVL 16

Expert Comment

by:heyhey_
Comment Utility
>> Maybe you know why my 1.1.7A was failing?

sorry - no :)
but it seems that java.lang.Thread is one of the first classes that java loads

>>      maquis% java -verbose test
>>      [Loaded java/lang/Thread.class
>>      /usr/local/jdk1.1.3/bin/../lib/classes.zip]

so can this be a java CLASSPATH problem ? It's so strange ...

>>      Also - tried your test case and you were right, it failed just like the other one - NoClassDefFoundError

at least now you know where is the real problem - inside the ibm.sql.DB2Driver.class. If you still have problems you can at least contact IBM and send them this little example :).

(are you sure that DB2Driver classes are installed correctly ? and of course the problem can be inside the VM implementation ... )

Till the next time
  heyhey
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 3

Author Comment

by:mmoore
Comment Utility
Ok, I reinstalled 1.1.7A and now it works same as 1.1.3. ;-(
I want to double check that I installed the IBM drivers correctly.
Maybe I will try to load their applet driver and see what happens.
0
 
LVL 3

Author Comment

by:mmoore
Comment Utility
I am reviewing the IBM documentation at
http://www.software.ibm.com/data/db2/java/   and at
http://www.software.ibm.com/data/db2/java/v2/index.html .
It is a little confusing because it seems like it wants me
to use Java 1.0.2 with JDBC as an add-on.

 "DB2 version 2.1.2 includes support for an earlier version
  of the JDBC API running under JDK 1.0.2."

http://java.sun.com:80/products/jdbc/index.html refers to
"JDBC 1.0 Software and specifications for download " and
clicking on this takes you to

http://java.sun.com:80/products/jdbc/jdbcsw2.html

which of course has not a single reference to JDBC 1.0, ARGH!!!
It does however mention JDBC 1.10c which I have now un-tar'd
on my solaris box. The documentation says refer to the web
page for installation instructions. There are of course NO
installation instructions on the web page. The un-tar'd JDBC-RELEASE-NOTES says "JDBC Version 1.1 Release Notes" so
I probably have a version that won't work anyway.

Any Idea where I can get JDBC 1.0?

I don't know if points are an incentive for you or anyone
but if you are thinking "Gosh, for a few hundred extra
points I might actually be willing to slog through all
the garbage", then let me know and I will up the ante.


I will be out of the office Thursday so until Friday


ciao
Mike



0
 
LVL 16

Expert Comment

by:heyhey_
Comment Utility
I'll read your answer more precisely later and I can make some more search for info ... but when you use the same Driver on WIndows don't you use the same JDBC version ? Also i far as i remember (not sure - have to check) there is no JDBC 1.0 - JDBC 1.1 is included as part of JDK 1.1 and there is JDBC extension (with same functionality ??) to JDK 1.0 ...

or all the problems came from the Solaris JDK ??

looking again through the Dump
      [Loaded ./test.class]
      [Loaded ibm/sql/DB2Driver.class from /opt/IBMdb2/V2.1/java/db2java.zip]
      [Loaded java/sql/Driver.class from /opt/IBMdb2/V2.1/java/db2java.zip]
      [Loaded java/lang/Runtime.class from /usr/local/jdk1.1.3/bin/../lib/classes.zip]
      [Loaded java/lang/IllegalMonitorStateException.class from
      /usr/local/jdk1.1.3/bin/../lib/classes.zip]
      java.lang.NoClassDefFoundError
      maquis%

javaVM  loads  
ibm/sql/DB2Driver.class,
then trying to resolve it (load all other classes that this one depends on) it loads
java/sql/Driver.class (the interface that ibm/sql/DB2Driver.class implements) than

java/lang/Runtime.class
java/lang/IllegalMonitorStateException.class

(i don't know why ??)
and throws
      java.lang.NoClassDefFoundError

so there are problems at level of .class files - it seems that ibm/sql/DB2Driver.class  depends (internaly) on some other class that cannot be found ... but it's not the classic ClassNotFound ...) and it works on the other platform ...

so (sorry - I can't evaluate the problem myself)
1. find the 'eigth differences' between both platforms :)
2. write a letter to IBM, describing the platform configuration and sending im the last small example with the -verbose dump.

(I'll check this later again, maybe i can download the driver classes IBM ?)
  heyhey
0
 
LVL 5

Expert Comment

by:msmolyak
Comment Utility
As far as I remember the difference between JDBC 1.0 and JDBC 1.10 was in Math.Decimal and Math.Integer classes for arbitrary precision operations. Those classes were added in JDBC 1.10 and are used in some JDBC interfaces.
0
 
LVL 16

Expert Comment

by:heyhey_
Comment Utility
can you send me the driver class
ibm/sql/DB2Driver.class

(mailto: heyhey@nettaxi.com)
0
 
LVL 3

Author Comment

by:mmoore
Comment Utility
HeyHey,
I sent you the driver and the /lib. Did you get them?
I think you have already gone the extra mile so I am giving you the points.
I would like to give some points to msmolak too, but alas, this system does
not allow one to distribute points amongst multiple contributers.
(Perhaps in a future release of Experts-Exchange.)
Anyway, I have desided to avoid the situation entirely by using
NT instead of Solaris. This means that I will have to install
and entire webserver (Oracle 4.0 in my case) on NT which, no doubt,
will be a royal pain in the backside but at least it is doable.
(I think I could make the Solaris solution work if I had access to
IBM support but I don't)
I still hold out hope that you might find a solution but if not,
well life goes on. ;-)

mmoore@antares.tymnet.com

Thanks,
Mike
0
 
LVL 16

Expert Comment

by:heyhey_
Comment Utility
hi Mike

i got the drivers yesterday and here is my final message :) (wrote it off-line, now just posting it )

-------
it seems that ibm.sql classes are not pure Java, but rely om some native stuff, so problems when loading DB2Driver class came (probably) from some 'native part' problems (you remember the strange loading of the Runtime class ? :)

since this is not Java any more, i can't help you :(
read the documentation about installing these drivers on Solaris ...
check where is positioned the native part of the driver ...
(maybe some PATH problems ???)

that's all from me
  heyhey

here is the begining of the DB2Driver class

// Decompiler options: packimports(3)
// Source File Name:   DB2Driver.java
package ibm.sql;
import java.sql.*;
import java.util.*;
// Referenced classes of package ibm.sql:
//            DB2Constants, DB2Connection
public class DB2Driver
    implements Driver
{
    protected native int SQLAllocEnv();   // NATIVE !!!
    protected native int SQLFreeEnv();;   // NATIVE !!!
    public native String getDLLVersion();;   // NATIVE !!!

    public DB2Driver()
    {
        language = "C";
        int i;
        synchronized(cliLock)
        {
            i = SQLAllocEnv();
        }
        if(i != 0)
            DriverManager.println("DB2 Driver error allocating environment handle, rc=" + i);
    }
// ...........
// ...........

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now