aspose file tools*
The moose likes JDBC and the fly likes Code in database corrupts data. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Code in database corrupts data." Watch "Code in database corrupts data." New topic
Author

Code in database corrupts data.

Chris Swanson
Greenhorn

Joined: Nov 30, 2009
Posts: 15
I am writing a Java application used as an assistance to for learning new languages. However, I am having some problems with inserting code. I am currently inserting small chunks of Perl code into the database, and this insertion is causing data to become corrupt. It doesn't happen all of the time, and is very difficult to detect where the problem is located. Is there a fix for such a problem?

Just to make things clear, I have SQL Jet, a wrapper class for SQ Lite, as my databasing solution.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2510
    
  10

Hi Chris,

Can you provide some concrete info:

How do you insert?
What do you insert?
How does the corrupted table look like (column typesd?)
How does good data look like in your table?
How does corrupted data look like in your table?
Did you get any errors , or are there errors in your application logs?

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Chris Swanson
Greenhorn

Joined: Nov 30, 2009
Posts: 15
This program is composed of lessons, and each lesson is composed of cards. These cards are used for different functions in the process of learning. Each card has a section assigned to it, and users move through the different sections in order. However, a corrupted table will have issues in the way the sections are ordered.

How do you insert?


This is the code for the database I am inserting into:




This is the code for the actual insertion of the data:



This function simply increments all of the cards which are in a list by 1, and then places the new card in the designated location. It's pretty much a simple list data type within a database.

I did not observe any problems with the insertion operator when I inputted raw text, but I started to have problems when I began inserting code.

What do you insert?

I began having problems when I started taking HTML documents from the book Learning Perl and placing it into the database. What happens is when something goes wrong with the database, the insertion operator has an error. The cursor for the insertion operator will consistently skip over a card for when it iterates over the values. This causes two cards to be represented within the database as the same section.

How does the corrupted table look like (column typesd?)

Each table has the following: Cardtype STRING, Question TEXT, Answer TEXT, Section INT.

How does good data look like in your table?

An uncorrupted table will have the section fields in order:

1
2
3
4
5

How does corrupted data look like in your table?

Corrupt data will have sections out of order:

1
2
3
3
5

Did you get any errors , or are there errors in your application logs?

Trying to delete a table that has been corrupted will often produce the CORRUPT error message from the Sql Jet engine. Moving data around in a corrupted table does not report any errors in itself.

Any suggestions are welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Code in database corrupts data.