Jump to content
  • Advertisement
Sign in to follow this  
leggyguy

[java] My Error: Class.forName("com.hxtt.sql.dbf.DBFDriver")

This topic is 4843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I am popping some code from college onto my home pc. The code is fine, and working at college, but I cannot load the driver, and I am wondering why. Is there something I need to do to get this to work, other than simply compiling it? I am trying to connect to a database, and using these lines.

	  String driver  = "com.hxtt.sql.dbf.DBFDriver";
	  String db      = "c:/jfiles";
	  String url     = "jdbc:DBF:/" + db;

	  String sql;

      sql = "create table "+ "flight" +"( " 
      + "ref     VARCHAR (5)  NOT NULL, "
      + "name   VARCHAR(10)  NOT NULL, "
      + "destination  VARCHAR(30) , "
	  + "numseats    INT (5) )";


	  try
	  {
	  	     Class.forName(driver);
			 Connection con = DriverManager.getConnection(url);
			 System.out.println("Connected to Dbf database " + db);
			 Statement stmt = con.createStatement();
    			stmt.executeUpdate(sql);

				stmt.close();
				con.close();
	  }
	  catch (ClassNotFoundException cnfe)
	  {
		  System.out.println("Error in loading driver: " + cnfe.getMessage());
	  }
And the code is running, but I get a print up of: "Error in loading driver: com.hxtt.sql.dbf.DBFDriver" which means I am having a problem finding the driver, I guess. Is that right? Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by leggyguy
And the code is running, but I get a print up of: "Error in loading driver: com.hxtt.sql.dbf.DBFDriver" which means I am having a problem finding the driver, I guess.

Is that right? Any help is appreciated.


That's correct. Make sure DBF_JDBC30.jar is in your classpath. If you don't have that JAR file, it looks like you can download it from here.

-Halo7

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!