<%@ page language="java" import="java.sql.*" %>
<%
java.sql.Connection Conn;
java.sql.Statement Stmt;
java.sql.ResultSet Rst;
String con_string="jdbc:mysql://localhost:3306";
con_string=con_string+"/soft?user=javauser;password=javadude";
Class.forName("com.mysql.jdbc.Driver");
Conn = DriverManager.getConnection(con_string);
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//String url="jdbc:odbc:lsd";
//Connection con=DriverManager.getConnection(url);
DatabaseMetaData dbmd=Conn.getMetaData();
ResultSet rs=dbmd.getTables(null,null,"%",null);
//ResultSet rs=dbmd.getTables(null,null,"news",null);
while(rs.next()){
out.print("table-name: "+rs.getString(3)+"
");
}
%>
上面jsp文件的输出结果:
table-name: admin
table-name: count_num
table-name: good
table-name: jivethreadaddon
table-name: soft
table-name: tuijian
table-name: type
table-name: type_parent</td> <td width="256" valign="top" class="ArticleTeitle">
</td> </tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle">