Mysql: list tables
Hello
I need to print out a list of tables in my mySQL database.
My code:
<%@ page language="java" import="java.sql.* " %>
<html>
<body>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql:///billeder", "password", "username");
DatabaseMetaData dmd = con.getMetaData();
ResultSet rs = dmd.getTables("billeder", null, null, null);
%>
</html>
</body>
Is this ok? and what else do I need?
I cant figure out how to printout tthe list of tables?
[627 byte] By [
karsea] at [2007-10-2 23:34:55]

[nobr]<%@ page language="java" import="java.sql.* " %>
<html>
<body>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://billeder", "user", "password");
DatabaseMetaData dmd = con.getMetaData();
String[] tableTypes ={"TABLE"};
ResultSet tables = dmd.getTables(null,null,null,tableTypes);
while (tables.next() )
{
String str = tables.getString(3);
String oneLine = "Table " + str;%>
<%= oneLine %> </br>
<%}
con.close();
%>
</html>
</body>
[/nobr]