Browse Source

http://www.finedevelop.com:2016/browse/DEMO-2670

新增10.0从数据读取frm决策报表,编码格式改为utf-8
pull/2/head
Leo.Cai 5 years ago
parent
commit
397bfa1d66
  1. 4
      src/main/java/com/fr/demo/ReadfrmFromDatabase.java

4
src/main/java/com/fr/demo/ReadfrmFromDatabase.java

@ -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();

Loading…
Cancel
Save