Hi, I am trying write a program to input and output data from a microsoft access file with java.sql class and the swing class.
basically i am on the first stage, trying to figure out different parts.
the first thing i would like to know is:
(assume it is already connected to the db with some data and column names are also there) i have a method to go into the database and get the columnNames and places them to a Vector.
as below:
public Vector getColumnNames() throws SQLException
{
ResultSet rs = null;
Vector columnNames = new Vector();
try
{
ResultSetMetaData rsmd = rs.getMetaData();
for(int i=1; i<rsmd.getColumnCount(); i++)
{
columnNames.addElement(rsmd.getColumnName(i));
}
}
catch(SQLException sqlex)
{
sqlex.printStackTrace();
}
return columnNames;
}
//// does it look right? compiling was fine
***my first question is, how do i see the elements in the vector?
i tried to set the return columnNames result to a new vector but apparently it is not the right way.
public static void main(String args[])
{
DataHolder dh = new DataHolder();
Vector columns = new Vector();
columns.addElement(dh.getColumnNames);
} /// this has compiling error
is it possible to set a new Vector = a Vector returned by a method?
and how do i print out each element in the vector?
thank you