2012-01-30 6 views
0

두 번째 루프에서이 문을 실행하면 내 프로그램에서 치명적인 오류가 발생합니다. Statement stmt = conn.createStatement();. 이 원인은 무엇입니까? 메서드를 통해 연결을 전달할 수 있습니까? 이 프로그램은이 루프를 통해 실행 : 여기연결 메서드로 인해 JRE에서 치명적인 오류가 감지되었습니다.

public static Connection open_connection() throws Exception{ 

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
    String sDBQ = "C:/Documents and Settings/mike/Desktop/stock/data/AW.mdb"; 

    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + sDBQ + ";DriverID=22;READONLY=false"; 
    Connection conn = DriverManager.getConnection(database ,"",""); 

    return conn; 
} 

를 오류입니다 :

Connection conn = open_connection(); 

for(int aa = 0;aa<symbols.length;aa++){ 
    String[][] dub_array = parse(symbols[aa]); 
    autowave(dub_array,19,14,symbols[aa],conn); 
} 

open_connection은 다음과 같습니다

# 
# A fatal error has been detected by the Java Runtime Environment: 
# 
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c90100b, pid=3584, tid=8668 
# 
# JRE version: 7.0_02-b13 
# Java VM: Java HotSpot(TM) Client VM (22.0-b10 mixed mode, sharing windows-x86) 
# Problematic frame: 
# C [ntdll.dll+0x100b] 
# 
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows 
# 
# An error report file with more information is saved as: 
# C:\Documents and Settings\mike\Desktop\stock\stock\hs_err_pid3584.log 
# 
# If you would like to submit a bug report, please visit: 
# http://bugreport.sun.com/bugreport/crash.jsp 
# The crash happened outside the Java Virtual Machine in native code. 
# See problematic frame for where to report the bug. 
#  
+0

비스타/윈도우 7을 사용하고 있습니까? – kosa

+0

@thinksteep 아니오, XP – Mike

+0

Vista/Windows에 알려진 문제가있는 것 같습니다. 도움이되는 경우이 링크를 확인하십시오. http://java.com/en/download/help/exception_access.xml – kosa

답변

0

My program is encountering a fatal error when executing this like a second time a loop executes this statement Statement stmt = conn.createStatement(); autowave(dub_array,19,14,symbols[aa],conn); Try to create only one statement object before loop, then use it in loop. JdbcOdbcDriver with MS Access is lame and will meet unexpected issue sometimes.

관련 문제