I can't insert a new client
Hi to all! I'am peruvian and I work in java recently
I work in a j2ee application for the university. I use ubuntu edgy, sun application server 9, mysql 5 and mysql connector/j 3.0.17.
My connection class is it:
---------------------------------------------------------------------------------------------------------------------------------------
public MysqlConeccion() {}
public DataSource devolverConeccion() throws NamingException{
return null ;
}
private DataSource getJdbcClientes_db() throws NamingException {
Context c = new InitialContext();
return (DataSource) c.lookup("java:comp/env/jdbc/clientes_db");
}
-------------------------------------------------------------------------------------------------------------------------------
and I work with my DAOCliente and I insert a new cliente with this method, getting the datasource in this form:
-------------------------------------------------------------------------------------------------------------------------------
public int insertarCliente(Cliente cliente) throws Exception {
RowSet row=new JdbcRowSetImpl(ds.getConnection());
String sql="insert into cliente(apellidos,nombres) values(?,?)";
row.setCommand(sql);
row.setString(1,cliente.getApellidos());
row.setString(2,cliente.getNombres());
row.execute() ;
return 1;
}
-----------------------------------------------------------------------------------------------------------------------
When I execute the method and it throws an exception, that its message is it:
Can not issue data manipulation statements with executeQuery()
What method of my rowSet allow me to insert a new row???
Subject
Written By
Posted
I can't insert a new client
January 23, 2007 09:18PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.