• 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

Need help to solve JDBC problem

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings everyone,
Please do not be put off by the length of this question, it's quite easy to follow and understand, I assure you..........
I am developing this appliation that uses JDBC_ODBC and I am getting an exception querying the database using this application if I try to look up the contents of 2 columns. It only works when I try to look up one column.
Here's some of the code:
First there's this the GUI that accepts user inputs and then passes it on to the JDBC application.

And then the part of the JDBC application that uses what's passed into the constructor of the DisplayDetails class.

All works fine this way. But when I pass in the two entered values into the constructor (which sould really be the case), problems arise.
When at the bottom of the CustomerValidation.java constructor, the two values that are supposed to be passed are passed into the constructor of DisplayDetails.java, are pssed like this:

and in display details, you have:

How can I eliminate this exception and get this application to work the way it should?
I should also add that the database is in MS Access and the first two columns are the PinNumber and AccNo.The AccNo column is the primary key in the database.
Any useful suggestions would be welcome.
Thanks.
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
look at the following line from your example...
ResultSet resultSet = statement.executeQuery("SELECT * FROM Customers WHERE AccNo="+ userAccNo + "AND PinNumber= "+pin );

I think the error is because you are missing a space before the 'AND'

should be :

try that.
chris
 
Femi Alla
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks so much Chris .
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic