|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Reg. Two Sql connection for scripted data source and sql connection terminationHi,
I am using BIRT 2.2.0 . I have created a class that access mysql database and returns some data. This class I am using for a scripted data source. Now the problem that I am facing are : 1. For every creation of report , two database connection are made to the database. I am not able to figure out why ? 2. After the report is rendered , those connection do not terminate and continue indefinitely and are closed only after I close eclipse. Thus connections keep on gathering and after sometime databases server crashes. I guess their is no error with the class file. Evern so it is as follows package BIRT; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class Mysqlclass { public List<String[]> data() { Connection con = null; ArrayList <String[]> result = new ArrayList <String[]>(); try { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/DB"; // Get a connection to the database for a // user named auser with the password // drowssap, which is password spelled // backwards. con = DriverManager.getConnection(url, "root","password"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select UserLogin,StatType from table"); while(rs.next()) { String[] result1 = {"",""}; result1[0]= rs.getString("UserLogin"); result1[1]=rs.getString("StatType"); result.add(result1); } } catch (Exception e) { e.printStackTrace(); System.out.println("Exception: " + e.getMessage()); } finally { try { if (con != null) con.close(); } catch (SQLException e) { System.out.println("Error with closing the collection"); } } return result; } } Any help will be greatly appreciated. Regards, Shivam Agarwal _______________________________________________ birt-report-designer-dev mailing list birt-report-designer-dev@... https://dev.eclipse.org/mailman/listinfo/birt-report-designer-dev |
|
|
RE: Reg. Two Sql connection for scripteddata source and sql connection terminationHi, Shivam Please post your
question in the birt news group at Eclipse or at http://www.birt-exchange.org/forum/
. This mailing list
is for discussion of development of the BIRT project. Br, wenfeng From: birt-report-designer-dev-bounces@...
[mailto:birt-report-designer-dev-bounces@...] On Behalf Of Shivam Hi, _______________________________________________ birt-report-designer-dev mailing list birt-report-designer-dev@... https://dev.eclipse.org/mailman/listinfo/birt-report-designer-dev |
| Free embeddable forum powered by Nabble | Forum Help |