Hello, I am a current Java student and am having a problem when I run my compiled program from an in chapter lab assignment called "Stock Tracker". I receive a message from a dialog box "Cannot locate sun.jdbc.odbc.jbcOdbc Driver. Class not found exception creating database object. Following are a list of files that make up the whole program...

Files copied over from the previous chapter's java files:
Activator.class
PasswordException.class
PasswordExpiredException.class
PasswordInternalException.class
PasswordInvalidException.class
PasswordSizeException.class
PasswordUsedException.class
Password.java (modified from previous chapter)

Java source code files provided by the author of the book:
STAction.java
STLogon.java
StockTracker.java
User.java
UserMaintFrame.java

Files created in chapter for this excercise:
MakeDB.java
StockTrackerDB.java

Created a database called "StockTracker" in Microsoft Access through Control panel- administrative tools - Data sources (ODBC)- system DSN tab - Add - Microsoft Access Driver *.mdb - create database. The database is stored in the same file as all the above files.

In order to test the program, we must run the STLogon.java file. All the files compiled sucessfully. The following are the steps which I have taken to double check my work...

1. Double checked the settings for the database in my control panel
2. Wrote a sample program off the web to see if that could connect through the database driver - the program ran sucessfully.
3. Printed the 2 files which I hand coded (MakeDB.java and StockTrackerDB.java) and checked for any entry errors.
4. Copied the files to a flash drive and tried to run the program on another machine. Receievd the same error.

The only other thing I could think of is maybe there is an issue with the way the java files were compiled or possibly using the wrong jdk. I installed TextPad which came with my text book on a cd. Later on, I installed NetBeans with a more current jdk (for troubleshooting purposes). All the files were compiled in TextPad since the installation of NetBeans. I then saved all those compiled files to a flash drive and copied them on another machine which only has TextPad on it. I guess I could try recompiling on the other machine which only has TextPad installed. BTW, both machines have Oracle Express Edition and Microsoft Visual Basic installed on them. I even tried signing in on both machines as an Administrator. There is no way to sign in as Administrator. However, both accounts on both machines have administrative rights.

If any additional source code or files are needed to verify my entries, I would be happy to pass it along. The connection string is coded in the MakeDB.java file.

Any advice would be greatly appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.