• 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

Database error: Variable information not available, source compiled without -g option

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a NetBeans app that displays a database just fine: I use Statement.executeQuery() to get a ResultSet
and use the ResultSet to fill a form with the data from a record. I can scroll back and forth and each
record displays just fine.

The database represents a Library and has tables for Books and Authors. For the Books, I run a select that
selects all Books; for the Author's I run a select that selects all authors. Both of these selects work
properly and give no errors

I have added a JPanel in a JDialog to add a new record. The JPanel holds the imput components the user will
use to input the new record's data and is properly displayed on the JDialog.

I am adding a book to a Library and have a JComboBox that holds the names of all the authors; the user will
select an existing author from the combo as the author of the new book. (There's also a button for them to
add a new author for the book.) This means I again need to run a select that selects all authors to fill the
combo.

The select I run on the add panel is called by the same executeQuery() in the same method that runs the
Authors form query.

Here is the code that runs all of the querys in the app.



Sounds simple? What's my problem?

When I run the query on the add dialog panel, I get the error:
Variable information not available, source compiled without -g option
It fails on line 7 and never reaches the catch block.

The debugger complains about a null pointer at the line that calls my executeQuery() method but execution
stops at line 7 and never gets past the call and anyway, I check for a non-null ResultSet for executeQuery()
before I do any thing with the ResultSet.

Finally, there's nothing wrong with the SQL passed in in line 8: I copied out SQL's value and ran it in an execute
SQL window and it worked perfectly.

Any ideas why this is happening in this one class?
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there anything else in your logs?
Even without the line numbers it should provide the basic stack trace and error.

In your catch blocks you should be printing the stack trace (<exception>.printStackTrace()), not just logging the error message. You lose a lot of information if you don't do that.

One thing that I would question is passing around ResultSets. That's generally a source of resource leaks. Especially since you don't have any way of closing that Statement you create. Eventually you'll hit a resource wall (usually the database cursors).
 
Rosie Fairfield
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well,

Once again I goofed up.

I finally looked at the Connection variable con in line 7 of my code in my original post.
It's null.

My dialog panel is a subclass of the JPanel that holds my executeQuery() so it has the base class's
Connection variable con used in the method.

Turns out I passed the Connection to my dialog panel but didn't initialize its Connection variable so
when I got to that line, the base panel had a null connection.

Now that I fixed that, it's working fine.

As for the possible leak you mentioned, I close the query after I use it to fill the combo.

Thank you for replying.
 
reply
    Bookmark Topic Watch Topic
  • New Topic