5 messages in com.mysql.lists.javaRE: getColumns(...) returns empty Res...
FromSent OnAttachments
David M. Karr23 Aug 2001 21:43 
Ext-...@nokia.com23 Aug 2001 22:33 
Venu23 Aug 2001 23:04 
David M. Karr25 Aug 2001 22:38 
David M. Karr26 Aug 2001 11:37 
Subject:RE: getColumns(...) returns empty ResultSet
From:Ext-...@nokia.com (Ext-@nokia.com)
Date:08/23/2001 10:33:25 PM
List:com.mysql.lists.java

Hi!

I have not used getColumns so I can not comment on that. I assume what you want to do is to get information on the columns of your table. I have done that with code like:

Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql); ResultSetMetaData meta = rs.getMetaData(); int colcount = meta.getColumnCount(); for (i=0;i<colcount;i++) { System.out.println("Column " + i + " name is " +meta.getColumnName(i+1)); }

This gets information on all columns in your query (String sql)

regards Kaarle

What exactly do I need to send to "getColumns()" in order to get it to work? I can't seem to find a straight answer anywhere.

I have a Connection, so I called "getCatalog()", so I assume I can use that as the first argument, but I don't understand what the "schemaPattern" is, or how I can use it. I've supplied my table name (is it case-insensitive?), and then I'm not sure what to provide for the "columnNamePattern" if I just want to get all columns.

I've tried several variations of "null" and "" in various positions, and I get an empty ResultSet each time.

Is there a good place where this is really documented?

I'm using mm.mysql 2.0.6, mysql 3.23.39, JDK 1.3.1, and Win2k.

To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java@lists.mysql.com instead.