I happen to use meta data go fetch column names
import java.sql.*;
public synchronized ResultSet execute(
String expression)
throws SQLException
{
// note in a real system you need only connect at
// start time
Connection conn = DriverManager.getConnection(
"jdbc:hsqldb:db/sqldb", // URL of db -
it is relative to the present working directory
"sa", // username
""); // password
public Statement st=null;
public ResultSet rs=null;
st = conn.createStatement(); // statements only
need be created once too
// run the query
rs = st.executeQuery( expression );
if( rs == null ) {
System.out.println( "no result" );
return null;
}
// do meta stuff
ArrayList column_name = new ArrayList();
ResultSetMetaData meta = rs.getMetaData();
int N = meta.getColumnCount();
for(i=0; i<N; ++i) {
column_name.add( i, meta.getColumnLabel( i+1 ) );
// note that the first column is numbered 1 not 0
}
return rs;
}
--- "J. Todd Slack" <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Is there a meta data example available?
>
> What I want to do is get the datatype of fields in
> the database. Like
> Varchar(2), etc. And base this information on how
> large to make my
> textfields, etc
>
> Any help is appreciated.
>
> Thanks,
>
> -Jason
>
>
>
>
>
-------------------------------------------------------
> This sf.net email is sponsored by: Dice - The
> leading online job board
> for high-tech professionals. Search and apply for
> tech jobs today!
> http://seeker.dice.com/seeker.epl?rel_code=31
> _______________________________________________
> hsqldb-developers mailing list
> [EMAIL PROTECTED]
>
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers
=====
Karl Meissner
...........................................................
: Meissner Software Development, LLC :
: "Software development and project management services." :
: http://wwww.meissnersd.net/resume.htm :
...........................................................
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
hsqldb-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers