当前位置: 技术问答>java相关
help!help!我的JDBC~~~~~~~~``
来源: 互联网 发布时间:2015-02-27
本文导语: 各位大侠,我快没脾气了!!! 小妹我正在学习JDBC,可是第一个程序就是PASS不了!我装的是JDK1。3,cLASSPATH设置的是set ClassPath=.;c:jdklibdt.jar;c:jdklibtools.jar;c:jdkjrelibrt.jar 用32位ODBC设数据源“PEOPEL”,以及我的程序: i...
各位大侠,我快没脾气了!!!
小妹我正在学习JDBC,可是第一个程序就是PASS不了!我装的是JDK1。3,cLASSPATH设置的是set ClassPath=.;c:jdklibdt.jar;c:jdklibtools.jar;c:jdkjrelibrt.jar
用32位ODBC设数据源“PEOPEL”,以及我的程序:
import java.sql.*;
public class Lookup {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
String dbUrl = "jdbc:odbc:people";
String user = "";
String password = "";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection(dbUrl, user, password);
// Statement s = c.createStatement();
}catch(ClassNotFoundException e)
{
System.out.println(e);
System.exit(0);
}
}
} ///:~
如果我把Connection c = DriverManager.getConnection(dbUrl, user, password);这句屏蔽了就没出错。换上了就会有出错提示:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6d4488eb
Function name=(N/A)
Library=(N/A)
NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.
Current Java thread:
at sun.jdbc.odbc.JdbcOdbc.driverConnect(Native Method)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Lookup.main(Lookup.java:16)
Dynamic libraries:
0x7CBC0000 - 0x7CBDD000 C:WINDOWSSYSTEMIMAGEHLP.DLL
Local Time = Tue Dec 04 09:52:41 2001
Elapsed Time = 2
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.3.1_01 mixed mode)
#
WHY?难道还有装什么吗?
小妹我正在学习JDBC,可是第一个程序就是PASS不了!我装的是JDK1。3,cLASSPATH设置的是set ClassPath=.;c:jdklibdt.jar;c:jdklibtools.jar;c:jdkjrelibrt.jar
用32位ODBC设数据源“PEOPEL”,以及我的程序:
import java.sql.*;
public class Lookup {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
String dbUrl = "jdbc:odbc:people";
String user = "";
String password = "";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection(dbUrl, user, password);
// Statement s = c.createStatement();
}catch(ClassNotFoundException e)
{
System.out.println(e);
System.exit(0);
}
}
} ///:~
如果我把Connection c = DriverManager.getConnection(dbUrl, user, password);这句屏蔽了就没出错。换上了就会有出错提示:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6d4488eb
Function name=(N/A)
Library=(N/A)
NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.
Current Java thread:
at sun.jdbc.odbc.JdbcOdbc.driverConnect(Native Method)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Lookup.main(Lookup.java:16)
Dynamic libraries:
0x7CBC0000 - 0x7CBDD000 C:WINDOWSSYSTEMIMAGEHLP.DLL
Local Time = Tue Dec 04 09:52:41 2001
Elapsed Time = 2
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.3.1_01 mixed mode)
#
WHY?难道还有装什么吗?
|
如果不行,重新装win98:(
|
我的机器运行正常啊。那就不是程序的问题,有可能你的路径不对,还有,数据源检查一下。
我的路径:(仅作参考)
classpath=c:jdk1.3.0_02lib;c:jdk1.3.0_02bin我的jdk装在c盘,程序也放在c盘下文件夹里,如果再不行,编译后
你用:java -cp . 你的程序名(不要加.java)试试,
我的路径:(仅作参考)
classpath=c:jdk1.3.0_02lib;c:jdk1.3.0_02bin我的jdk装在c盘,程序也放在c盘下文件夹里,如果再不行,编译后
你用:java -cp . 你的程序名(不要加.java)试试,