File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main"

 
B Crosthwaite
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I have battled through the last 2 weeks installing tomcat and MySQL on my Mac. Now i feel like i am at the final hurdle, and yet again I am stumbling.

I am following this tutorial to connect to MySQL database:
http://lxuser.tripod.com/apache/jdbc_mysql.html

When installing the connector i placed the .jar file in $JAVA_HOME/lib/ext

Then I used this simple piece of code to test if it all works:


The code compiles ok. When i run the code i get this error in the terminal window:


Please could someone point me in the rite direction, I would appritiate any help

Thanks,
-Ben
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That usually means you haven't got the .class file in the same directory as what is "current."
Use the dir command (DOS/Windows) or ls (*nix) from your terminal, to see that the JDBCTest.class file is actually in your directory.
If it is, try
java -cp . JDBCTest
A little more about that Exception here.
[ October 31, 2008: Message edited by: Campbell Ritchie ]
 
B Crosthwaite
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Campbell, thanks for the reply.

Yeah that seemed to do the trick thanks. However now I have got a error on the next part of my code

when I compile and run, I get this message in the terminal:


My guess is that this part is the problem:

However I thought this bit was correct, do you know how I would check to see if it was correct?

If this is not the issue then any help would be appreciated

Thanks,
-Ben
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Port 8080 doesn't look right.

Which DBMS is it? MySQL? To the MySQL Handbook �19.4. Example 19.1 seems to show what you require. Try that.

And I trust you haven't posted a real password?
 
B Crosthwaite
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bang on the money Campbell thanks.

-Ben
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome

Not so much a case of knowing it, as knowing where to copy from.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic