smoke10010
07-01-2009, 02:37 AM
Hello,
I'm trying to fill an array from a mysql table. I have the SELECT working an it's pulling the data properly as well as assigning it to the array.
One thing I'm stuck on is creating the array so it's dynamic so it can allow for 10, 20, 100, or 1000 string. Here's an example of what I mean:
String strCoupons[] = new String[5];
stmt=con.createStatement();
rst=stmt.executeQuery("SELECT * FROM coupons ");
while(rst.next()){
strCoupons[i] = rst.getString(2);
i++;
}
rst.close();
Right now the problem with that is I can only load 5 strings into the array, how do I set it up so that I can load as many strings as I have stored in the database?
I guess the next question is.. what if I have 10,000,000 strings in the database, still a good idea to load the whole thing into the array?
Thanks.
I'm trying to fill an array from a mysql table. I have the SELECT working an it's pulling the data properly as well as assigning it to the array.
One thing I'm stuck on is creating the array so it's dynamic so it can allow for 10, 20, 100, or 1000 string. Here's an example of what I mean:
String strCoupons[] = new String[5];
stmt=con.createStatement();
rst=stmt.executeQuery("SELECT * FROM coupons ");
while(rst.next()){
strCoupons[i] = rst.getString(2);
i++;
}
rst.close();
Right now the problem with that is I can only load 5 strings into the array, how do I set it up so that I can load as many strings as I have stored in the database?
I guess the next question is.. what if I have 10,000,000 strings in the database, still a good idea to load the whole thing into the array?
Thanks.