• 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

postgresql error: The column name userName was not found in this ResultSet

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've used JDBC to connect to postgresql and created table user on DB. I am using below code to fetch data from user table.
I have two columns i.e. userName and password. I've tried text, character, character varying datatypes but getting error "The column name userName was not found in this ResultSet.
". Please help.

Here's the code snoppet:





 
Ranch Hand
Posts: 460
6
Netbeans IDE Oracle Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But for the column password get you the same error?

 
Dana Ucaed
Ranch Hand
Posts: 460
6
Netbeans IDE Oracle Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure that the column username is String?

 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Those are good questions, Dana.

I'm going to suggest that Shubhendu could look at the getMetaData() method of ResultSet, which returns an object which can tell you what the names of the ResultSet's columns are, among many other things. That might lead to a better understanding of what's going on.
 
Shubhendu Pramanik
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dana Ucaed wrote:Are you sure that the column username is String?
Yes Dana. For password field also I am getting the same error.
My concern is what  is the String equivalent  datatype of String (userName and password) on PostgreSQL. I've tried below datatypes for userName as well as password resp and getting same error:

text, character, character varying.

 
Shubhendu Pramanik
Greenhorn
Posts: 4
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ohh.. This is my stupid mistake... I had to use schemaName.tableName on the SQL query... instead I used only user...

Sorry guys... and thanks for the reply...
 
Dana Ucaed
Ranch Hand
Posts: 460
6
Netbeans IDE Oracle Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, the problem is name of table written wrong.

The error was from another line above.

Success!
 
reply
    Bookmark Topic Watch Topic
  • New Topic