Galera sou novo aki e noob em Java estar acontecendo o seguinte tenho essas classes
[code] package UI;
import java.sql.SQLException;
import Model.Cliente;
import Repositorio.RepositorioClienteMysql;
public class Test {
/**
* @param args
* @throws SQLException
*/
public static void main(String[] args) throws SQLException {
// TODO Auto-generated method stub
Cliente client = new Cliente();
client.setIdCliente("01");//"TurmaLpooABc");
client.setNomeCliente("nome");
RepositorioClienteMysql rep = new RepositorioClienteMysql();
rep.inserir(client);
System.out.print("Cliente inserido com sucesso");
}
}[/code]
repositorio
[code]package Repositorio;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import Conexao.ConnectionFactory;
import Model.Cliente;
public class RepositorioClienteMysql {
private Connection conn;
private static final String SQL_INSERIR = “insert into cliente values (?,?)”;
public void inserir(Cliente cliente) throws SQLException{
this.conn = ConnectionFactory.getConnection();
PreparedStatement prs = this.conn.prepareStatement(SQL_INSERIR);
prs.setString(1, cliente.getIdCliente());
prs.setString(2, cliente.getNomeCliente());
prs.execute();
this.conn.close();
}
}[/code]
Modelo
[code]package Model;
public class Cliente {
private String idCliente;
private String nomeCliente;
public String getIdCliente() {
return idCliente;
}
public void setIdCliente(String idCliente) {
this.idCliente = idCliente;
}
public String getNomeCliente() {
return nomeCliente;
}
public void setNomeCliente(String nomeCliente) {
this.nomeCliente = nomeCliente;
}
}[/code]
Conexão
[code]package Conexao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionFactory {
public static Connection getConnection() throws SQLException {
try {
Class.forName(“com.mysql.jdbc.Driver”);
return DriverManager.getConnection(“jdbc:mysql://localhost:3306/zemamao”,“root”,“root”);
} catch (ClassNotFoundException e) {
throw new SQLException(e.getMessage());
}
}
}
[/code]
Estar dando esse erro
Exception in thread “main” java.sql.SQLException: com.mysql.jdbc.Driver
at Conexao.ConnectionFactory.getConnection(ConnectionFactory.java:13)
at Repositorio.RepositorioClienteMysql.inserir(RepositorioClienteMysql.java:18)
at UI.Test.main(Test.java:23)
Alguem pode me ajudar