ciao a tutti. sono alle prese con java e crystal report 11 in ambiente netbeans. riesco a visualizzare un report con i dati presenti all'interno, quando invece vado a riempire il report con i dati presenti su un database viene fuori qst errore "errore nella ricerca del nome JNDI (nome server)". Il database che uso è sqlexpress 2008 r2.
sono due classi che ho trovato sul web e ho cambiato semplicemente i dati relativi al database. qualche idea? Grazie in anticipo.codice:import com.crystaldecisions.sdk.occa.report.lib.*; import javax.swing.*; public class JRCViewReportLogon { private static final String REPORT_NAME = "C:\\lavoro\\report.rpt"; //Database credentials for the report's datasource. private static final String USERNAME = "xx"; private static final String PASSWORD = "xxxx"; public static void launchApplication() { try { com.crystaldecisions.sdk.occa.report.application.ReportClientDocument reportClientDoc = new com.crystaldecisions.sdk.occa.report.application.ReportClientDocument(); reportClientDoc.open(REPORT_NAME, 0); reportClientDoc.getDatabaseController().logon(USERNAME, PASSWORD); new ReportViewerFrame(reportClientDoc); } catch(ReportSDKException ex) { System.out.println(ex); } catch(Exception ex) { System.out.println(ex); } } public static void main(String [] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { launchApplication(); } }); } } import com.crystaldecisions.sdk.occa.report.lib.*; import com.crystaldecisions.ReportViewer.*; //Java imports. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ReportViewerFrame extends JFrame { //Initial window frame properties. private final int XPOS = 75; private final int YPOS = 50; private final int WIDTH = 750; private final int HEIGHT = 600; //Crystal Report thick-client viewer object that will be embedded into the JFrame. private ReportViewerBean reportViewer = new ReportViewerBean(); //This report will be viewed in the thick-client viewer. private com.crystaldecisions.sdk.occa.report.application.ReportClientDocument reportClientDoc = new com.crystaldecisions.sdk.occa.report.application.ReportClientDocument(); /** * Constructs and launches the new frame. */ public ReportViewerFrame(com.crystaldecisions.sdk.occa.report.application.ReportClientDocument reportClientDoc) throws Exception { //Initialize frame properties. this.setResizable(true); this.setLocation(XPOS, YPOS); this.setSize(WIDTH, HEIGHT); this.setTitle("Crystal Report Java Viewer"); //Add GUI components to the frame including the ReportViewerBean. addComponents(); //Add GUI listeners to the frame. addListeners(); //Set the report that the ReportViewerBean will display. this.reportClientDoc = reportClientDoc; reportViewer.setReportSource(reportClientDoc.getReportSource()); reportViewer.init(); reportViewer.start(); //Display the frame. this.setVisible(true); } /** * Utility function for adding GUI components to frame. Created to separate * the constructor logic of the frame from logic for adding visual * components. This function will add the ReportViewerBean to the frame. */ private void addComponents() { //Create new panel and add the ReportViewerBean to it. Container cp = getContentPane(); cp.setLayout(new BorderLayout()); cp.add(reportViewer); } /** * Utility function for adding GUI listeners to the frame. Created to separate * the constructor logic of the frame for adding listeners. */ private void addListeners() { //This window listener will capture the event of the ReportViewerFrame being closed. If this //frame is closed, then it is a good practice to then close the report being displayed, which the //quit() method will handle. addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { quit(); } }); } /** * Close frame and report being viewed. */ public void quit() { try { //Release report. reportClientDoc.close(); System.exit(0); } catch(ReportSDKException ex) { ex.printStackTrace(); } } }![]()

