This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Java application crashes because of ODBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java application crashes because of ODBC" Watch "Java application crashes because of ODBC" New topic
Author

Java application crashes because of ODBC

noga knaz
Greenhorn

Joined: Feb 03, 2009
Posts: 6
Hi all,

I wrote a short java program that is suppose to print the column names of a certain table ("PrintHistory) in an Access database.
This is the code:
public class JdbcWithJre6 {
/**
* @param args
*/
public static void main(String[] args) {
final String url = "jdbcdbcriver={Microsoft Access Driver (*.mdb)};DBQ=j://magic//WD_DEV3//lastprintout28102008.mdb";

Connection c = null;
ResultSet rs = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c = DriverManager.getConnection(url);
DatabaseMetaData dbmd = c.getMetaData();
rs = dbmd.getColumns(null, null, "PrintHistory", "%");
while (rs.next()) {
System.out.println(rs.getString(4));
}
} catch (Throwable e){
e.printStackTrace();
} finally {
if (rs != null) {
try {
rs.close();
}
catch (SQLException xSql) {
System.err.println("WARNING (error ignored): Failed to close result set.");
xSql.printStackTrace();
}
}
if (c != null) {
try {
c.close();
}
catch (SQLException xSql) {
System.err.println("WARNING (error ignored): Failed to close database connection.");
xSql.printStackTrace();
}
}
}
}
}


The problem is that this program runs fine on several computers, but crashes on other computers when applying to the database.
All the computers run on windows 2000 and use jre 1.6.0_02.
The same java program runs fine on ALL the computers when using jre 1.5.

In theory, all those computers suppose to have the same installations and drivers, but obviously this is not the case...

I tried to update the odbc driver, but no matter what I installed, the file odbc32.dll wasn't updated (I suspect this is the guilty file, but I'm not sure).

Does anybody have any idea what could create such a hs_err_pidXXXX file?
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d3f4df2, pid=3036, tid=3040
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_02-b06 mixed mode)
# Problematic frame:
# C 0x6d3f4df2
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

--------------- T H R E A D ---------------

Current thread (0x004a6400): JavaThread "main" [_thread_in_native, id=3040]

siginfo: ExceptionCode=0xc0000005, reading address 0x6d3f4df2

Registers:
EAX=0x0000ffff, EBX=0x0aba9e80, ECX=0x0b0c1518, EDX=0x00000000
ESP=0x009df9b8, EBP=0x009dfac8, ESI=0x004a64ec, EDI=0x00000000
EIP=0x6d3f4df2, EFLAGS=0x00010202

Top of Stack: (sp=0x009df9b8)
0x009df9b8: 004a6400 06c89fb8 06c89fb8 00000005
0x009df9c8: 00000001 00000005 004a5b40 6d9968d0
0x009df9d8: 00a76300 00000000 00a7635d 00a76700
0x009df9e8: 00000000 00000000 00000000 00a76300
0x009df9f8: 00000000 009df9d4 00000000 00000000
0x009dfa08: 00000000 00000000 00000000 00000000
0x009dfa18: 00000000 00000000 00010000 009df9d4
0x009dfa28: 00000000 00000000 00000000 00000000

Instructions: (pc=0x6d3f4df2)
0x6d3f4de2:
[error occurred during error reporting, step 100, id 0xc0000005]

Stack: [0x00990000,0x009e0000), sp=0x009df9b8, free space=318k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C 0x6d3f4df2
j sun.jdbc.odbc.JdbcOdbc.driverConnect(J[B[B)V+0
j sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JLjava/lang/String;)V+93
j sun.jdbc.odbc.JdbcOdbcConnection.initialize(Ljava/lang/String;Ljava/util/Properties;I)V+984
j sun.jdbc.odbc.JdbcOdbcDriver.connect(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;+129
j java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/util/Properties;Ljava/lang/ClassLoader;)Ljava/sql/Connection;+210
j java.sql.DriverManager.getConnection(Ljava/lang/String;)Ljava/sql/Connection;+15
j JdbcWithJre6.main([Ljava/lang/String;)V+15
v ~StubRoutines::call_stub

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.jdbc.odbc.JdbcOdbc.driverConnect(J[B[B)V+0
j sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JLjava/lang/String;)V+93
j sun.jdbc.odbc.JdbcOdbcConnection.initialize(Ljava/lang/String;Ljava/util/Properties;I)V+984
j sun.jdbc.odbc.JdbcOdbcDriver.connect(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;+129
j java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/util/Properties;Ljava/lang/ClassLoader;)Ljava/sql/Connection;+210
j java.sql.DriverManager.getConnection(Ljava/lang/String;)Ljava/sql/Connection;+15
j JdbcWithJre6.main([Ljava/lang/String;)V+15
v ~StubRoutines::call_stub

--------------- P R O C E S S ---------------

Java Threads: ( => current thread )
0x0abc2800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3400]
0x0abbdc00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1408]
0x0abbcc00 JavaThread "Attach Listener" daemon [_thread_blocked, id=3008]
0x0abb8800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3260]
0x0aba1c00 JavaThread "Finalizer" daemon [_thread_blocked, id=2320]
0x0aba1000 JavaThread "Reference Handler" daemon [_thread_blocked, id=3388]
=>0x004a6400 JavaThread "main" [_thread_in_native, id=3040]

Other Threads:
0x0ab9dc00 VMThread [id=3120]
0x0abc4000 WatcherThread [id=3108]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
def new generation total 960K, used 352K [0x02a90000, 0x02b90000, 0x02f70000)
eden space 896K, 39% used [0x02a90000, 0x02ae8350, 0x02b70000)
from space 64K, 0% used [0x02b70000, 0x02b70000, 0x02b80000)
to space 64K, 0% used [0x02b80000, 0x02b80000, 0x02b90000)
tenured generation total 4096K, used 0K [0x02f70000, 0x03370000, 0x06a90000)
the space 4096K, 0% used [0x02f70000, 0x02f70000, 0x02f70200, 0x03370000)
compacting perm gen total 12288K, used 2076K [0x06a90000, 0x07690000, 0x0aa90000)
the space 12288K, 16% used [0x06a90000, 0x06c971e8, 0x06c97200, 0x07690000)
No shared spaces configured.

Dynamic libraries:
0x00400000 - 0x00423000 c:\wd_int7\jre\bin\java.exe
0x77f80000 - 0x77ffd000 C:\WINNT\system32\ntdll.dll
0x001a0000 - 0x0020c000 C:\WINNT\SYSTEM32\SYSFER.DLL
0x7c570000 - 0x7c624000 C:\WINNT\system32\KERNEL32.dll
0x7c2d0000 - 0x7c332000 C:\WINNT\system32\ADVAPI32.dll
0x77d30000 - 0x77d9f000 C:\WINNT\system32\RPCRT4.DLL
0x7c340000 - 0x7c34f000 C:\WINNT\system32\Secur32.dll
0x00440000 - 0x00496000 c:\wd_int7\jre\bin\msvcr71.dll
0x6d7c0000 - 0x6da09000 c:\wd_int7\jre\bin\client\jvm.dll
0x77e10000 - 0x77e6f000 C:\WINNT\system32\USER32.dll
0x77f40000 - 0x77f7c000 C:\WINNT\system32\GDI32.dll
0x77570000 - 0x775a0000 C:\WINNT\system32\WINMM.dll
0x6ca60000 - 0x6ca68000 C:\WINNT\system32\LPK.DLL
0x66650000 - 0x666a4000 C:\WINNT\system32\USP10.dll
0x6bd00000 - 0x6bd0d000 C:\WINNT\system32\SYNCOR11.DLL
0x6d310000 - 0x6d318000 c:\wd_int7\jre\bin\hpi.dll
0x690a0000 - 0x690ab000 C:\WINNT\system32\PSAPI.DLL
0x6d770000 - 0x6d77c000 c:\wd_int7\jre\bin\verify.dll
0x6d3b0000 - 0x6d3cf000 c:\wd_int7\jre\bin\java.dll
0x6d7b0000 - 0x6d7bf000 c:\wd_int7\jre\bin\zip.dll
0x1f7b0000 - 0x1f7e1000 C:\WINNT\system32\ODBC32.dll
0x71710000 - 0x71794000 C:\WINNT\system32\COMCTL32.dll
0x76b30000 - 0x76b6e000 C:\WINNT\system32\comdlg32.dll
0x70a70000 - 0x70ad6000 C:\WINNT\system32\SHLWAPI.DLL
0x78000000 - 0x78045000 C:\WINNT\system32\msvcrt.dll
0x7cf30000 - 0x7d176000 C:\WINNT\system32\SHELL32.DLL
0x1f850000 - 0x1f866000 C:\WINNT\system32\odbcint.dll
0x1f8f0000 - 0x1f932000 C:\WINNT\System32\ODBCJT32.DLL
0x1b000000 - 0x1b170000 C:\WINNT\System32\msjet40.dll
0x1b5d0000 - 0x1b665000 C:\WINNT\System32\mswstr10.dll
0x7ce20000 - 0x7cf0f000 C:\WINNT\system32\ole32.dll
0x779b0000 - 0x77a4c000 C:\WINNT\system32\OLEAUT32.dll
0x1f8e0000 - 0x1f8ee000 C:\WINNT\System32\odbcji32.dll
0x1b2c0000 - 0x1b2cd000 C:\WINNT\System32\msjter40.dll
0x1b2d0000 - 0x1b2f6000 C:\WINNT\System32\MSJINT40.DLL
0x1f800000 - 0x1f818000 C:\WINNT\system32\odbccp32.dll
0x77820000 - 0x77827000 C:\WINNT\system32\VERSION.dll
0x759b0000 - 0x759b6000 C:\WINNT\system32\LZ32.DLL

VM Arguments:
java_command: JdbcWithJre6
Launcher Type: SUN_STANDARD

Environment Variables:
CLASSPATH=c:\PVSW\bin\pvjdbc2x.jar;c:\PVSW\bin\pvjdbc2.jar;c:\PVSW\bin\jpscs.jar;C:\Program Files\Rational\ClearQuest\cqjni.jar;c:\temp\jdbc_test
PATH=C:\oracle\product\10.2.0\client_1\bin;C:\Program Files\CA\Dcs\DMScripting\;C:\Program Files\CA\DCS\CAWIN\;c:\Program Files\Common Files\Pervasive Software Shared\pvswcore;C:\PROGRA~1\IBM\JRE\1.1\bin;C:\PROGRA~1\IBM\IBMCIC~1\bin;C:\oracle\ora81\bin;C:\PVSW\BIN;C:\Program Files\Borland\Delphi5\Bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\MCSII\System;C:\Centura;C:\Ca_Appsw;C:\MSSQL7\BINN;C:\Program Files\Oracle\jre\1.1.7\bin;C:\SQLLIB\BIN;C:\SQLLIB\HELP;c:\LibDISCOUNTDev;j:\Magic\Development;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\TNGSD\BIN;C:\Program Files\IBM\Personal Communications\;C:\Program Files\IBM\Trace Facility\;C:\Program Files\Rational\common;C:\Program Files\CA\DSM\bin;C:\PROGRA~1\CA\SC\CAM\bin
USERNAME=d629163
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 6, GenuineIntel



--------------- S Y S T E M ---------------

OS: Windows 2000 Build 2195 Service Pack 4

CPU:total 1 (2 cores per cpu, 1 threads per core) family 6 model 15 stepping 6, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3

Memory: 4k page, physical 2071796k(1203700k free), swap 4003904k(3281736k free)

vm_info: Java HotSpot(TM) Client VM (1.6.0_02-b06) for windows-x86, built on Jul 12 2007 01:16:14 by "java_re" with unknown MS VC++:1310

thanks,
Noga
Ninad Kulkarni
Ranch Hand

Joined: Aug 31, 2007
Posts: 787

UseCodeTags


SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
noga knaz
Greenhorn

Joined: Feb 03, 2009
Posts: 6
I will.
thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java application crashes because of ODBC
 
Similar Threads
EXCEPTION_ACCESS_VIOLATION & MSAccess
An unexpected error has been detected by HotSpot Virtual Machine:
JTable showing bug at runtime
DB CONN. - EXCEPTION_ACCESS_VIOLATION
An unexpected error has been detected by HotSpot Virtual Machine