Win a copy of Learn Spring Security (video course) this week in the Spring forum!
    Bookmark Topic Watch Topic
  • New Topic

the question is about JDBC/ODBC MS Access

 
david hw wang
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Report post to moderator
at first I posted it on General(beginner), but I think here is better

thank you

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

runtime java.lang.NoClassDefFoundError when trying jdbc
---------------
Hi, I am fresh new in java and, when I try to connect with Access Database, I got the runtime Error (compiled fine)

It bothered me three days, and I am really tired,

Thank you first

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

that's what I have done:

jdk 1.4

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

CLASSPATH:
e:\sun\appserver;E:\Sun\Tomcat 5.5\webapps\tsf\WEB-INF\classes

JAVA_HOME:
e:\sun\appserver\jdk

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

tools.jar in e:\sun\appserver\jdk\lib

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

built up a dababase with access : test.mdb
with one table customer (two colums: cust_id,cust_name)

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

setup odbc in winXP homeEdition


control pannel --> administrative tools --> data source(ODBC)-->
system DSN--> Mrcrosoft Access Driver(*.mdb) -->
with dataSourceName : testconnect ; and I put the description;
select database :test.mdb;
advanced option with loginName tester ;password: tester

-------------------
then I copied the following from internet:

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

import java.sql.*;

class JdbcTest1{

public static void main(String args[]){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc dbc:testconnect";
Connection conc = DriverManager.getConnection(url, "tester","tester");
Statement stmt=conc.createStatement();
ResultSet rs=stmt.executeQuery("select * from customer");

while(rs.next()){
String s1=rs.getString("cust_id");
String s2=rs.getString("cust_name");
System.out.println(s1+"\t"+s2);
}
rs.close();
stmt.close();
conc.close();
}//try
catch(Exception e){
System.out.println(e);
}//catch
}//main
}
-------------------------------
javac JdbcTest1.java fine
---------------------------------
java JdbcTest1
Exception in thread main java.lang.NoClassDefFoundError: JdbcTest1

-------------------------------
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Report post to moderator
I think this was better where originally posted. Please continue the discussion there.
 
    Bookmark Topic Watch Topic
  • New Topic