Boa Tarde estou tendo problema com DAO! ele nao consegue encontrar minha TO!
vou postar meus fontes ALguem poderia postar um DAO e um Factory pra eu comparar e achar onde estou errando!
DAOpackage java.DAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.Factory.Factory;
import java.TO.Beans;
public class ValorDAO {
public ValorDAO(){};
private Connection conection;
public void getConexao()throws SQLException {
conection = Factory.getConnection();
}
public void insere(Beans to)throws SQLException {
Connection con = Factory.getConnection();
PreparedStatement stmt = this.conection.prepareStatement (" insert into dados (Valor) values (?)");
stmt.setString(1,to.getValor());
stmt.execute();
conection.commit();
stmt.close();
}
}
package java.Factory;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Factory {
public Factory(){};
public static Connection getConnection()throws SQLException {
try {
Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection("jdbc:mysql://localhost:3306/DAO", "root", "221105");
}
catch(ClassNotFoundException ex){
throw new SQLException (ex.getMessage());
}
catch(Exception e){
throw new SQLException (e.getMessage());
}
}
}
Valew Obrigado!
PS: Estou tentando fazer uma conexao com JSP