Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

NoClassDefFoundError re JDBC

Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am learning JDBC from the book "Core Java2 Volumn II".
I installed the PointBase Mobile Edition database under the directory which I already put in CLASSPATH,the Java program and its properties file are in the same subdirectory and that subdirectory is under the same directory as the database's.
The compile is fine. But there is always a runtime exception stating that NoClassDefFoundError:filename. How to solve this problem?I am totally lost.Please help!
Thank you!
Frances Fang
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forget about the title of this question. I have more detailed info about it. I debugged and found out where the problem is but I don't know why.
The code caused the problem is as follows, this is a method which will be called in main(),the main() handled exceptions:-
public static Connection getConnection()
throws SQLException, IOException
{ Properties props = new Properties();
String fileName = "";
FileInputStream in = new FileInputStream(fileName);
String drivers = props.getProperty("jdbc.drivers");
if (drivers != null)
System.setProperty("jdbc.drivers", drivers);
String url = props.getProperty("jdbc.url");
String username = props.getProperty("jdbc.username");
String password = props.getProperty("jdbc.password");
DriverManager.getConnection(url, username, password);

The SQLException was thrown by DriverManager.getConnection(url,username,password),the error messages are as follows:-
the SQLState is :08001;
the error message is :no suitable driver
the vendor-specific info is: 0
In the corresponding proprieties file,it is:--
jdbc.url=jdbc ointbase:corejava
I put the directory AA in classpath via
The pointbase is in c:\AA,the program and its properties file are in c:\AA\B\C. Is this a problem or am I missing something here? Please help!

Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic