aspose file tools*
The moose likes JDBC and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Exception in thread "main"" Watch "Exception in thread "main"" New topic
Author

Exception in thread "main"

B Crosthwaite
Ranch Hand

Joined: Oct 22, 2008
Posts: 39
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

Joined: Oct 13, 2005
Posts: 40041
    
  28
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

Joined: Oct 22, 2008
Posts: 39
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

Joined: Oct 13, 2005
Posts: 40041
    
  28
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

Joined: Oct 22, 2008
Posts: 39
Bang on the money Campbell thanks.

-Ben
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40041
    
  28
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
 
subject: Exception in thread "main"