Jump to content
JasperReports Library 7.0 is now available ×

Newbie: Please helpp with JDBC-Problems


Recommended Posts

By: Matthias Bechtel - matzehd

Newbie: Please helpp with JDBC-Problems

2003-10-08 00:08

Hello NG,

 

I installed myself Jasperreport and run the Webapps.

Unfortunately I found no documentation or examples of JDBC Connects.

I tried to convert that example WebappReport.xml on MySQL.

 

Without documentation however unfortunately not successfully. Perhaps someone would be so friendly and can give oneself a tip.

 

The 1. Question generally: Is it correctly that automatically the report without indication in the XML the data from the WebappDataSource does load? If, here my changes. I get either the error message: java.sql.SQLException: NO suitable more driver

or:

getOutputStream() has already called for this response been

 

Many thanks in ahead.

Matze

 

WebappDataSource:

 

public class WebappDataSource implements JRDataSource

{

private Connection dbCon;

private Statement stmt;

private ResultSet rs;

private String sql;

private Object[][] data = new Object [100][4];

private int index = -1;

 

public WebappDataSource()

{

try

{

Class.forName("org.gjt.mm.mysql.Driver");

dbCon = DriverManager.getConnection(("jdbc:mysql://192.168.0.1;databasename=eBogen"),"root","");

stmt = dbCon.createStatement();

sql = "select * from address";

rs = stmt.executeQuery(sql);

index = 0;

while (rs.next())

{

data[index][0] = rs.getString("City");

data[index][1] = rs.getString("Id");

data[index][2] = rs.getString("Name");

data[index][3] = rs.getString("Street");

index++;

}

}

catch (Exception sqlex) {System.out.println(sqlex);}

}

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...