Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help to solve JDBC problem

 
Femi Alla
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • 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.
 
Chris Brat
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • 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: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks so much Chris .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic