• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

myCon not recognised

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.
The following code is just a little utility to read data from a DAT file and put it in an access database.

(Its nothing special, I'm sure you guys have a better way of doing this.)
I am getting an error when I compile that it doesnt recognise myCon.
------- Compiler Output ------
UpdateAccessUtility.java:58: cannot resolve symbol
symbol : variable myCon
location: class UpdateAccessUtility
Statement stm = myCon.createStatement();

Any ideas? I have declared it in the same class.
Thanks guys
regards
Ian
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ian
You declare adn intialize myCon in a try block so that the variable is local to that block. Move the declaration outside of the block and you'll be ok with that part. You're going to need to catch the SQLException that can be thrown by that statement though. All you catch is an IOException after that try block.
hope that helps
reply
    Bookmark Topic Watch Topic
  • New Topic