5 messages in com.mysql.lists.javaRE: getColumns(...) returns empty Res...| From | Sent On | Attachments |
|---|---|---|
| David M. Karr | 23 Aug 2001 21:43 | |
| Ext-...@nokia.com | 23 Aug 2001 22:33 | |
| Venu | 23 Aug 2001 23:04 | |
| David M. Karr | 25 Aug 2001 22:38 | |
| David M. Karr | 26 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.
-- =================================================================== David M. Karr ; Best Consulting dmk...@earthlink.net ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail java...@lists.mysql.com
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.




