Results 1 to 2 of 2
  1. #1
    sidious is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default problem with jasper report

    Hi everyone,

    I've the following problem. I've tried to execute my java application, but an error occured(Error executing SQL statement for : java_report). Here is the code :

    Java Code:
     
            public class Conn {
    	
    	public static final String DB_URL = "jdbc:jtds:sqlserver://127.0.0.1";
    	public static final String DB_USERNAME = "sa";
    	public static final String DB_PASSWORD = "student";
    	public static final String DB_DRIVER = "net.sourceforge.jtds.jdbc.Driver" ;
    
    
    	public static void main(String[] args) throws JRException, ClassNotFoundException {
    		
    		try{
    			
    			Class.forName(DB_DRIVER);
    			Connection conn=DriverManager.getConnection(DB_URL,DB_USERNAME,DB_PASSWORD);
    			Map<String, Object> mpParams = new HashMap<String, Object>();
    			mpParams.put("DRZ_OZNAKA", "SRB");
    			JasperDesign jasperDesign = JRXmlLoader.load("java_report.jrxml");
    			JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
    			JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
    			mpParams,
    			conn);
    						
    			JasperViewer.viewReport(jasperPrint);
    			
    			}
    			catch(Exception ex) {
    			String connectMsg = "Could not create the report " + ex.getMessage();
    			System.out.println(connectMsg);
    			}
    	}
    }
    I've also imported all(I suppose so) .jar files(jasperreports,commons-beanutils,commons-collections,commons-digester,commons-logging). Also, besides these .jar files, I installed jtds compiler, because some people said that I need it to, and unfortunately the same problem occured.
    Here is also my sql query in iReport 1.3.3(just for testing) :
    Java Code:
    select * from Drzava
    where DRZ_OZNAKA = $P{DRZ_OZNAKA}
    Thanks for help in forward ! :)

  2. #2
    sidious is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default

    I found a mistake. I Fogot to put a name of database.
    public static final String DB_URL = "jdbc:jtds:sqlserver://127.0.0.1/RAF_PBP";

    Thx anyway

Similar Threads

  1. Jasper report problem
    By anilkumar_vist in forum Advanced Java
    Replies: 0
    Last Post: 12-07-2010, 05:13 AM
  2. jasper report problem
    By realosso in forum New To Java
    Replies: 3
    Last Post: 06-22-2010, 12:51 PM
  3. jasper report ,jasper report jar files and maven dependencies.
    By rajuchacha007 in forum Advanced Java
    Replies: 1
    Last Post: 04-09-2010, 09:15 AM
  4. Problem With Dimension of Jasper Report
    By Prashant.surwade in forum Advanced Java
    Replies: 3
    Last Post: 09-19-2009, 03:29 PM
  5. Problem in running jasper report in servlet
    By khadaree in forum Java Servlet
    Replies: 1
    Last Post: 07-16-2009, 10:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •