aspose file tools*
The moose likes JDBC and the fly likes the question is about JDBC/ODBC MS Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

the question is about JDBC/ODBC MS Access

david hw wang
Greenhorn

Joined: Mar 14, 2006
Posts: 7
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

Joined: Aug 31, 2004
Posts: 11343

I think this was better where originally posted. Please continue the discussion there.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: the question is about JDBC/ODBC MS Access