/*
* Applet1.java
*
* Created on 11 de Agosto de 2006, 10:15
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
/**
*
* @author Fernando Silva (xxxxx)
*/
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.jfree.chart.*;
import org.jfree.data.jdbc.JDBCPieDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.jdbc.*;
public class Applet1 {
public static Connection con;
public Applet1 realData(){
//JDBCPieDataset data = null;
DefaultPieDataset data = null;
String url = "jdbc:mysql://localhost/cmuf";
//Connection con;
try {
Class.forName("com.mysql.jdbc.Driver");
}//fim do try
catch (ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}//fim do catch
try {
con = DriverManager.getConnection(url, "UsuarioBD", "Password");
data = new JDBCPieDataset(con);
String sql = "Select local, carga, autocod, data FROM dados";
//PreparedStatement data1 = con.preparedStatement("Select local, carga, autocod, data FROM dados");
data.executeQuery(sql); [b]//ERRO NESSA LINHA[/b]
con.close();
}//fim do try
catch (SQLException e) {
System.err.print("SQLException: ");
System.err.println(e.getMessage());
}//fim do catch
catch (Exception e) {
System.err.print("Exception: ");
System.err.println(e.getMessage());
}//fim do catch
return data; [b]// ERRO NESSA LINHA[/b]
}//fim do Objeto
public static void main(String args[]) {
Applet1 test = new Applet1();
test.realData();
}
}//fim da classe
não consigo compreender os dois data.executeQuery(sql); E return data;erros apresentados em relação aos objetos SQL, alguém sabe?? Obrigado!