OK, So I am really close, All I need to do now is get the data type for each
column (like VarChar(2), etc.

I see from the docs a getTypeInfo(), but that doesn't look correct.

What is the right command? I must be blind, I don't see one?

hmm, I must be blind.

Can anyone tell me?

-Jason




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Karl
Meissner
Sent: Wednesday, August 14, 2002 11:05 AM
To: [EMAIL PROTECTED]; fredt; hsqldb-developers
Subject: Re: [Hsqldb-developers] MetaData example?


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




-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
hsqldb-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers

Reply via email to