473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

ResultSet columns

40
Hi all,

I have a ResultSet object and I want to get the nbr of columns it has. It's easy to find the number of rows by using the absolute(int row) and the getRow() methods. Is there anything similar to find the nbr of columns? Any relevant code or advice would help.

Thanks a lot
Nov 5 '08 #1
3 1764
JosAH
11,448 Expert 8TB
Get the column count(s) from the ResultSetMetaData (you can get that from the
ResultSet itself).

kind regards,

Jos
Nov 5 '08 #2
stack
40
Yep, it worked. Thanks!!

stack
Nov 5 '08 #3
itsraghz
127 100+
But ensure you minimize the operations on ResultSetMetaData. It is the costliest operation you do! Read out the API carefully - if you are using it in Production environment.
Nov 6 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Steve | last post by:
Hi, I have a web application where there are a number of columns a user can sort on (price, item etc). The database itself is HUGE (around 6 million rows) and even with all the indexing it slows...
0
by: Comcast News | last post by:
Hi , We are facing a java issue. We are looping thru a resultset which has about 40 K records. The process terminates abnormally after about 20-25K records. The Query fetches has 400 columns. We...
0
by: RoyalScorpion | last post by:
hi guys, i get an updatable resultset from a connection then used it to insert a new row but the result set doesn't chane after insertion, i mean the no of rows before insertion is the same after...
1
by: Sulla | last post by:
I ran into an interesting "problem" the other day when I was working on a very simple zip code utility function. I have a table in Oracle with the following columns: zipcode, state, latitude,...
5
by: xixi | last post by:
hi, we are running db2 udb on v8.1, i am using jdbc sql, is there anyway to create a sql saying i want to get the last record of resultset? i try to open a big resultset and point the cursor to the...
0
by: Eckard Buchner | last post by:
Hi, we have a query that returns only a few rows, but has a lot of columns in group by clause. In some cases we receive an SQL Exception. Here is the trace setString (1, 20040928001) called...
4
by: _link98 | last post by:
Problem: java ResultSet cursor from SQL/PL stored-procedure is FORWARD_ONLY. Is it possible to have ResultSet cursors from SQL/PL procedures to scroll forward and backwards? Perhaps I am missing...
6
by: joerg | last post by:
Hello world, my program connects to a db2 database and needs to find out the column names and data types for a specific table. The code works fine with mysql and derby, but returns an empty...
3
by: John | last post by:
Hi I have an sql statement in a string variable SQLStr and I also have an oledbconnection Conn with my database. What can I do from here to run the sql and get a handle to the resultset in my...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.