• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cannot find symbol

 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic