Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

My android app is using an udb file. My problem is on an UPDATE statement, when i execute it the first time everything works properly but when I do it the second time (I execute the prepared SQL statement and the query string is still clean), I get this error:

09-27 15:07:35.920: WARN/System.err(19311): com.ianywhere.ultralitejni12.implementation.JniException: UltraLiteJ Error[-305]: I/O error 200017 -- transaction rolled back

Any helping idea in what might be the reason? thank you in advance

asked 27 Sep '11, 09:10

devdevoteam's gravatar image

devdevoteam
155510
accept rate: 0%

retagged 28 Sep '11, 12:48

Graham%20Hurst's gravatar image

Graham Hurst
2.7k11843

A -305 error indicates that there was a problem during I/O operations. Are you seeing this issue only with UPDATEs i.e., SELECT, INSERT, DELETE statements all seem to work ok? Can you run a ulvalidate (on the desktop) against this db?

(27 Sep '11, 10:24) Chris Keating

yes, the other query are working and also an update query is working but only the first time. When i do that 2 times, the second time is not working...

(27 Sep '11, 10:27) devdevoteam

How are you connecting to the database? I think that the most likely causes for an I/O error are writing to an unmounted file system or attempting to write to a file locked by another thread or process.

(27 Sep '11, 17:01) William Clardy

Thanks for your reply. What do you mean with "How are you connecting to the database?" You would like to know all the methods I use?

(28 Sep '11, 08:35) devdevoteam

furthermore, is there any documentation for android dev using afaria sybase in their application?

(28 Sep '11, 10:10) devdevoteam

That I/O error number indicates that UltraLite read a page from the database file and found unexpected data in the page header. If there's not another explanation, it indicates the storage medium corrupted the data -- that is, returned something different than what was written.

If you can reproduce this problem with a new database, please submit the repro to Sybase as a bug report.

As Chris mentioned, you can run the ulvalid tool against the database to see if it thinks anything is wrong. Copy the database back to your PC, and run 'ulvalid -v -c dbf=mydatabase.udb'.

permanent link

answered 28 Sep '11, 14:04

Tim%20McClements's gravatar image

Tim McClements
2.0k1830
accept rate: 35%

For the query sequence which is throwing an exception, do they use the same connection, or does each iteration create its own connection to the database? If the latter, does the connection string specifify a database name or a file name? In other words, is it possible that the second update could be fouling when it tries to write to a still-locked file or file segment?

(Caveat: I haven't worked with Ultralite on Android yet, but I'm presuming that a file-based connection may not automatically detect whether it or not it can really write to the file -- I just have vague recollections of Linux growing fur and fangs when it came to mixing file locks and multi-threaded processes.)

permanent link

answered 28 Sep '11, 11:23

William%20Clardy's gravatar image

William Clardy
6115
accept rate: 0%

1

My problem was an error in the classes I use. While I projected the app in such a way as I open the connection only at the beginning and use a singleton class for this; I figured out that some classes open the connection again! Fixing it I dont get the same problem. Thanks a lot for your help/time

PS: My question about documentation-for-android-dev-using-afaria is still valid.

(29 Sep '11, 03:01) devdevoteam
Replies hidden

Glad you got it:) - Is there any answer that seems acceptable?

For the Afaria question, I'd recommend a new question on its own (and no, I don't know the answer...)

(29 Sep '11, 03:38) Volker Barth

yes, the W.Clardy comment was helpful.

For the Afaria question, I am going to post a new question soon.

Thanks

(29 Sep '11, 04:13) devdevoteam

this is what I do

*query="UPDATE ..."; try { statement=DB_conn.prepareStatement(query); result=statement.execute(); DB_conn.commit(); statement.close(); } catch(ULjException e) { e.printStackTrace(); }

    return result;*
permanent link

answered 27 Sep '11, 10:09

devdevoteam's gravatar image

devdevoteam
155510
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×79
×72
×38

question asked: 27 Sep '11, 09:10

question was seen: 4,894 times

last updated: 29 Sep '11, 04:32