Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Derby Embedded Database: errors in connection code

 
Malcolm Johnson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've coded connection code for an embedded db in NetBeans. Something is wrong with my return connection. Any ideas? I added color=red to the code that is generating the errors, but it is appearing in code. See lines 21, 39, 70, 100, 122, and 144. When trying to compile, I'm getting an error which reads, "cannot find symbol
symbol: variable connection
location: class ProductDB"

This is my first time working with Derby.

 
Wayan Saryada
Ranch Hand
Posts: 105
IntelliJ IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the error said that the compiler cannot find the symbol, in this case the connection. For example, in the getProducts() method you tried to access variable named connection but you've never declare this variable. Before using the connection variable you need to declared it, for example:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic