|
|
@ -23,14 +23,14 @@ public class ReadfrmFromDatabase extends Formlet { |
|
|
|
Form form= new Form(); |
|
|
|
Form form= new Form(); |
|
|
|
String name = reportletRequest.getParameter("reportname").toString(); |
|
|
|
String name = reportletRequest.getParameter("reportname").toString(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
// 定义数据连接(根据你实际数据库信息进行修改)
|
|
|
|
// 定义数据连接(根据你实际数据库信息进行修改)
|
|
|
|
String driver = "com.mysql.jdbc.Driver"; |
|
|
|
String driver = "com.mysql.jdbc.Driver"; |
|
|
|
String url = "jdbc:mysql://localhost:3306/test"; |
|
|
|
String url = "jdbc:mysql://localhost:3306/test"; |
|
|
|
String user = "root"; |
|
|
|
String user = "root"; |
|
|
|
String pass = "123456"; |
|
|
|
String pass = "123456"; |
|
|
|
Class.forName(driver); |
|
|
|
Class.forName(driver); |
|
|
|
Connection conn = DriverManager.getConnection(url, user, pass); |
|
|
|
Connection conn = DriverManager.getConnection(url, user, pass); |
|
|
|
// 从数据库中读模板
|
|
|
|
// 从数据库中读模板
|
|
|
|
String sql = "select B from report where A = '" + name |
|
|
|
String sql = "select B from report where A = '" + name |
|
|
|
+ "'"; |
|
|
|
+ "'"; |
|
|
|
Statement smt = conn.createStatement(); |
|
|
|
Statement smt = conn.createStatement(); |
|
|
|