Hello to all! I know well how to access database and its tables from sql server in Netbeans, But know I need to access a report from sql server in Netbeans. For example if I have a table named "MyTable" in sql server 2008 and then I ran a query on that table and then I made a report for that qeury and named that report "MyReport". Now I want to access that report from my Netbeans IDE by using java code and then want to display that report in table format in my JForm . Is there any java code by which we can access only reports from sql server? if so, please guide me. I shall be thankfull to you

Dani AI

Generated

As ’s question and the follow-ups show, “a report” can mean very different things depending on the authoring tool. As noted, first identify where the report was created and stored (SSRS, Crystal, Jasper/BIRT, RDLC, etc.). If it’s published to a SQL Server Reporting Services server the definition and metadata live in the report server database and SSRS exposes programmatic rendering (modern REST API and the older SOAP ReportExecutionService). SSRS REST APIs (learn.microsoft.com)

If the goal is simply to display the same tabular data in a Swing form, the easiest, most robust option is to re-run the SQL from Java (JDBC) and populate a JTable. That avoids report-server auth, HTML rendering quirks and version differences. A compact helper to convert a ResultSet into a DefaultTableModel is often all you need:

public static DefaultTableModel buildTableModel(ResultSet rs) throws SQLException {
    ResultSetMetaData md = rs.getMetaData();
    int cols = md.getColumnCount();
    Vector<String> colNames = new Vector<>();
    for (int i = 1; i <= cols; i++) colNames.add(md.getColumnName(i));
    Vector<Vector<Object>> data = new Vector<>();
    while (rs.next()) {
        Vector<Object> row = new Vector<>();
        for (int i = 1; i <= cols; i++) row.add(rs.getObject(i));
        data.add(row);
    }
    return new DefaultTableModel(data, colNames);
}

If you must use the server-rendered report (layout, charts, formatting), call the report server APIs to render to CSV/Excel/HTML/PDF and then display or parse the result in Java. SSRS’s REST and ReportExecution endpoints support rendering; CSV/Excel is easiest to convert back into a JTable, HTML requires a modern renderer (JavaFX WebView over JEditorPane). SSRS REST docs · ReportExecution.Render (learn.microsoft.com)

If you prefer embedding a Java reporting engine or reauthoring the report, consider JasperReports or Eclipse BIRT for native Java report generation and viewing. JasperReports · Eclipse BIRT (jaspersoft.com)

Troubleshooting tips: test REST renders in Postman first (auth is the most common blocker), prefer CSV/Excel for table data, and avoid directly querying ReportServer internals in production — use the supported APIs.

Recommended Answers

All 2 Replies

so, if I get it straight: You read all the data from the database
then you create a report based on that data
then you want to read all the data of that report (the data you already had)
and display that data?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.