• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol

 
Joe Lemmer
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I'd be grateful if someone could point out to me where I'm going wrong with the following code. I have one very basic JDBC test program that seems to work fine, but another very similar program where I have the following errors when I try to compile:

cannot find symbol:
symbol: class Statement
location: class Jdbc11
Statement stmt;

cannot find symbol:
symbol: class Connection
location: class Jdc11
Connection con = DriveManager.getConnection("jdbc:mysql://localhost/mysql", "root", "secret");

cannot find symbol:
symbol: variable DriveManager
loction: class Jdbc11
Connection con = DriveManager.getConnection("jdbc:mysql://localhost/mysql", "root", "secret");

Here's the full code for the program that does NOT work:



and just for comparison, here's the code for the program that does work:



Cheers

Joe Lemmer
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure about the first two, but the last one is explained by a spelling mistake.
 
Joe Lemmer
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf

Thanks for the reply.

I've changed the spelling mistake, but I still get the same three errors.

My other program still works though. Very Confusing!

Regards

Joe
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange. I just copied it verbatim, and it compiles fine (after correcting the typo).

It's especially odd since Connection, Statement and DriverManager are all in the same package, so one would expect the compiler to be able to find all of them, or none.
 
Joe Lemmer
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right. Well at least it compiles on your machine Ulf. It must be something very basic that I'm missing. Think I'll try just typing it in again.

Thanks for your help. :-)
[ November 08, 2008: Message edited by: Joe Lemmer ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic