This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Dynamic 2d array size? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Dynamic 2d array size?" Watch "Dynamic 2d array size?" New topic

Dynamic 2d array size?

Derek Rose

Joined: Apr 21, 2013
Posts: 10
i have a 2d array that i am filling with data from an sql database. I would like the table to only be as big as the size of the database. 24 rows fit in the JScrollPane before the auto scroll starts so 24 as a default could be do i change it so i dont get an out of bounds exception once i go past 24?

i tried to make a loop that went through the results first and stored an index value...but then the table displays blank.

then use length instead of 24

But just displays a blank is the correct size table though
Derek Rose

Joined: Apr 21, 2013
Posts: 10
sorry, dumb mistake i fixed it
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43949
Derek Rose wrote:i have a 2d array . . .
No, you haven’t. You have an array of arrays, which is different. And better.

Never use == true or == false.
What a strange loop! Was that what you had to fix?
Derek Rose

Joined: Apr 21, 2013
Posts: 10
I needed to execute a different query for each loop. And I started learning Java last month and your the third person to tell me my logic is weird. That's just the way the solution comes to me haha
Have you checked out Aspose?
subject: Dynamic 2d array size?
It's not a secret anymore!