I have a 2D String array populated with the following method in my Main class:
public static String[][] dbTable() throws SQLException
{
String[][] dbTable = null;
table = conn.createStatement();
String sql = "select * from Java_Test_Profiles";
ResultSet rs = table.executeQuery(sql);
rs.last();
int rowNumb = rs.getRow();
ResultSetMetaData rsmd = rs.getMetaData();
int columnS = rsmd.getColumnCount();
rs.beforeFirst();
dbTable= new String[rowNumb][columnS];
int i=0;
while(rs.next() && i<rowNumb && rowNumb<100)
{
for(int j=0;j<columnS;j++)
{
dbTable[i][j] = rs.getString(j+1);
}
i++;
}
return dbTable;
"dbTable" is passed between several classes, and I was wondering how I can create a copy of this for editing. I want to do this because i need to "re-load" the contents of the array back to their original state. I have tried to call main.dbTable()
but that returns exactly what has already been edited, not what is contained within the database.