[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-java
Subject:    Re: "Delete" bug from MySQL ???
From:       Christian Mack <mack_kn () gmx ! de>
Date:       2000-10-28 18:34:04
[Download RAW message or body]

Edilmar Alves wrote:
> 
> Hi,
> 
> I have a servlet with NT4 + Apache + JServ 1.1 + MySQL 3.23 + JB3 C/S.
> Then, I would like to run this code:
> 
> String IdCliente = "";
> try { IdCliente = request.getParameter("IdCliente"); } catch (Exception e) { }
> try {
>     SQL = "Delete From Cliente Where IdCliente = " + IdCliente;
>     DatabaseFranquia.executeStatement(SQL); <==== PROBLEM HERE!!!
>     SQL = "Load Data Infile 'c:/temp/cliente.txt" +
>         " Replace Into Table Cliente" +
>         " Lines Terminated By '\\r\\n'";
>     DatabaseFranquia.executeStatement(SQL); <==== THIS WORKS FINE!!!
> } catch (Exception e) {
>     e.printStackTrace();
> }
> 
> I would like to delete all records from this IdCliente and, after,
> insert some new records from Cliente.txt table.
> 
> The "Delete" SQL doesn't work, arising an error from MySQL like this:
> "ERROR 1034: Incorrect key file for table: 'prodservcliente'. Try to repair it"
> 
> But, if I change the code for this:
> ...
>     SQL = "Delete From Cliente"; <==== NO "WHERE" CLAUSE!!!
>     DatabaseFranquia.executeStatement(SQL); <==== NO PROBLEM HERE!!!
> ...
> 
> it works fine !!!
> 
> What's the problem with my MYI key file ??? Or with my code ???

Hi Edilmar

It's a problem with your key file.
Stop mysqld and repair it with myisamchk.

Your first SQL statement tries to localize the records with some ID over the keyfile.
Your second SQL statement will not search for records in the table.
Instead it will drop the entire table and recreate it (= no key actions involved).

Tschau
Christian

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail java-thread1717@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail java-unsubscribe@lists.mysql.com instead.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic