I'm stuck in the final stage of a project I've been working for the last weeks. I'm trying to get Processing to display a map I've made with TileMill, which is stored in a .mbtiles SQLite database. So far it has worked pretty fine running the app in the IDE, but when deploying the Applet in my website the DB isn't found. I believe it's because I'm trying to use a URL to get the DB.
I'm using Unfolding Maps. One of its classes uses the sqlitejdbc driver to get the DB. This is my code. If you take a look at the strings JDBC_CONN_STRING_TABLE and JDBC_CONN_STRING_TABLE, those are the ideal paths to connect to the DB. The local one works. The URL doesn't.
Which do you think would be the best way to access the database? Thanks!!
I can be wrong, but SQLite is mostly designed to be used on a local system. I searched a bit, and found only paths to specify where the DB file is. I have found no URL syntax. If you need to access the base from an applet, perhaps you need to transfer the data to a more conventional database, like MySQL.
So I've taken a look at the source of the JDBC driver and it looks as though when the file is called, to fetch the DB it uses getAbsolutePath() to obtain the complete path of the file. It works fine in the Processing IDE because it's calling the files from my computer, and there's no issue with that. But when I upload the code it denies the access as, because of the
getAbsolutePath() function, the applet is trying to find the file in the user's directories, instead of the webserver's.
-Port the DB to MySQL. This wouldn't give too much trouble if the DB didn't have image BLOBs inside, which make the transfer tricky. If anyone knows how to do this I'd love some starting points.
-Find a way to read the DB without using JBDC. I know there are libraries for Java but I don't know how to use them in Processing.
-Change the code in the driver so that ti doesn't turn the relative path into a relative one. This could potentially casue a lot of problems, plus I don't know how to do it/compile the source into a new jar, etc.
-Find a way to still point at the DB using the getAbsolutePath() restriction. I've no idea how to do this, but it seems like there's the possibility of accessing a DB stored in the memory, typing ::memory:: and the name of the DB in the path field.
Any comments will be much appreciated :)
Leave a comment on fdansv's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic