• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

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: 43027
76
  • 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: 43027
76
  • 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 ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic