This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Using ResultSet.getString( ) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using ResultSet.getString( )" Watch "Using ResultSet.getString( )" New topic
Author

Using ResultSet.getString( )

Ravi Singh
Ranch Hand

Joined: Aug 02, 2004
Posts: 51
When using the result set methods getInt(), getString() etc to get the values returned from the database do the database column types have to be of type number or varchar2 respectively?

Or, do the methods attempt to parse the value of the database column as a string (for the getString() method) or as a int (for the getInt() method)?
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
The JDBC specification dictates the mappings between JDBC types and Java types. In addition, the JDBC driver can perform some type conversions if you ask for another type using getString() and so on. There's a table in the JDBC spec; an appendix, if I'm not mistaken.

- Peter
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using ResultSet.getString( )
 
Similar Threads
how to display an integer field as blank in the form
How to Convert Long to String
Problem with JDBC
how to retreive image from database in JSP
compiled or not compiled