Ver Mensaje Individual
  #926 (permalink)  
Antiguo 04/10/2007, 18:09
Xesar
 
Fecha de Ingreso: septiembre-2007
Mensajes: 3
Antigüedad: 16 años, 7 meses
Puntos: 0
Re: Jasper Report + iReport + NetBeans 4

Cita:
Iniciado por Xesar Ver Mensaje
tengo el mismo codigo pero me aparece esto
estoy trabajando desde eclipse

import java.sql.*;
import java.util.*;
import java.lang.*;
import javax.swing.*;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.export.*;
import net.sf.jasperreports.engine.util.*;
import net.sf.jasperreports.view.*;

public class informe extends JFrame{
static Connection conn = null;
public informe()
{

}

private static Connection conexion() throws ClassNotFoundException, SQLException
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException e) {
System.out.println("My JDBC Driver not found.");
System.exit(1);
}
try {
conn = DriverManager.getConnection("jdbc:odbc:Refaccionar ia_Del_Sureste"," ", " ");
System.out.println("Si se conecta.");
}
catch (SQLException e) {
System.out.println("Error de conexión: " + e.getMessage());
System.exit(4);
}
return conn;
}

public static void main(String[] args)
{
try
{
String filename = "C:\\julio.jasper";
String filepdf = "C:\\julio.pdf";
String xmlfile = "C:\\julio.jrxml";


//JasperDesign jd = JRXmlLoader.load(xmlfile);
JasperReport report = JasperCompileManager.compileReport(xmlfile);
JasperPrint print = JasperFillManager.fillReport(filename,new HashMap(),conexion());
JasperExportManager.exportReportToPdfFile(print,fi lepdf);
JasperViewer.viewReport(print,false);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}


me aparece
si se conecta
java.lang.NullPointerException