2

I have an App which receives a SQLite database to read some data and export it as an CSV. I'm trying to upload it to Google App Engine but I faced a huge problem which I think makes it impossible to use the GAE for this app.

The problem is that since on the GAE I can't write to the FileSystem, I can't open the JDBC Connection to the SQLite file and therefore I can't read the data to convert to CSV. I've been looking for other options such as Google Cloud Storage, but I don't want to use my only "free trial" of it on this application, and actually I don't want to have to pay ever for this app after the Free Trial ends, so this is not an option.

After a lot of research, my only guess is that I might be able to load the database straight from the InputStream as I received it from the upload form I'm using to get it, however, this is a 100% lucky guess and I've not been able to find anything about this approach online, but I just don't want to believe it can't be done with any of the existing JDBC libraries to SQLite and I'm hoping somebody here will tell me how to do it.

If the InputStream approach is not possible, but you know some other way to open a SQLite DB in GAE to READ ONLY, and then dispose it, feel free to comment as well...

If there is another option like "don't use JDBC, use a socket connection with a pipe to open the connection with the InputStream", I'd also like to hear that, it does not HAVE to be done with JDBC.

Thanks

hectorg87
  • 753
  • 1
  • 7
  • 24

2 Answers2

2

JDBC in general needs sockets, so it will not work on GAE.

I'd try to dump SQLite to CSV, upload the file to GAE, then parse CSV contents and insert into database.

Community
  • 1
  • 1
Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • Thanks, but this is not the desired behavior of my app, I want it to be the SQLite to CSV "dumper", and the just return the CSV to the user "as is". – hectorg87 Jun 22 '12 at 13:21
  • **"I have an App which receives a SQLite database to read some data and export it as an CSV"** – hectorg87 Jun 22 '12 at 13:49
  • “JDBC in general needs sockets” doesn't apply to SQLite, which instead needs a native library. – Donal Fellows Jun 27 '12 at 08:16
  • @DonalFellows, what do you mean by "a native library"? I'd like to know more, maybe you can give me a link or something. Thanks! – hectorg87 Jun 27 '12 at 10:22
  • 1
    @hectorg87 SQLite is a server-less DB — no socket required — but it is written in C as it uses some fairly complex I/O in order to get commits working correctly, so it needs a native library as part of its JDBC “connector” (which is actually the DB engine itself). – Donal Fellows Jun 28 '12 at 14:39
  • @DonalFellows Ok ok, I get it. After you're post I've read a lot more about SQLite, so now I now what you mean. Thank you! – hectorg87 Jun 29 '12 at 07:56
2

The short answer is "it can't be done". At least not with current JDBC implementations, and implementing one that would work could be extremely difficult, I went to the SQLite Users Mailing List and in the end that was the conclusion.

You can follow the thread here but before you have to register to the mailing list because is private.

hectorg87
  • 753
  • 1
  • 7
  • 24