SQLite to load a map
i've been using the SQLite JDBC driver in order to load maps and filenames from an SQLite *.s3db file. locally, it works fine.
as soon as i upload it to my webserver (which is on my local network, controlled by me), it just blanks out and sits there.
java.lang.NoClassDefFoundError
at org.sqlite.Conn.<init>(Conn.java:11)
at org.sqlite.JDBC.connect(JDBC.java:38)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MapPanel.grabTiles(MapPanel.java:40)
at MapPanel.setup(MapPanel.java:22)
at processing.core.PApplet.handleDisplay(PApplet.java:1281)
at processing.core.PGraphics.requestDisplay (PGraphics.java:564)
at processing.core.PApplet.run(PApplet.java:1450)
at java.lang.Thread.run(Unknown Source)
the particular chunk of code in question is this:
publicvoid grabTiles()
{
try{
String fileName ="curse.s3db";
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+fileName);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from tiles__map");
...
and the line in particular:
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+fileName);
note - "fileName" is "curse.s3db" .. i have also tried "./curse.s3db" and various urls referencing the db file on the remote server or my local hard drive, depending on the test.
this even happens when i run the applet in an index.html file in my own local hard drive, in the same directory as everything else that should be necessary.
again.. locally, everything works like magic. as soon as i try to embed it, it breaks.
is there some parameter i need to pass to it in the HTML tag that i don't know about in order to tell it where to find everything else?
i've tried signing the applet, though i doubt it should be necessary to load files from the same directory the applet is being run from on the remote server. i'm not touching anything client side.
any help would be greatly appreciated, as i really want to get an SQLite database file working with my game. for what i need to use it for, it is a much better alternative to MySQL or similar packages.
the directory on the remote server is basically like this:
images/
curse.s3db
curse.jar
index.html
..same as it is on my local machine.. and if i were to double-click the .jar on my local machine, it runs fine without any errors. as soon as i try to run it remotely (and load the files remotely rather than from my own pc) it doesn't know where to look for curse.s3db.
[3047 byte] By [
haliphaxa] at [2007-11-26 19:42:57]

# 2
edit: i misunderstood your question when i first typed this message, but it still adds more information. to answer your question, though: the library for native java access to sqlite's JDBC driver was extracted and placed in the curse.jar archive. i can run a local test running it as an application (and not as an applet embedded in a webpage) without any driver files being in my working directory and the native code will take care of everything. however, this is what is not working on the server side tests.
the web server holds everything. literally. everything.
the client simply accesses the HTML file and is given the applet. the client does not (or at least should not) need to have the applet, any of the image files, or the DB file on their computer.
so.. the DB file will be loaded from the server by the applet. the program has no trouble loading files from the working directory of the applet on the sever side (the images/ folder holds *.jpg files that display just fine). it has to be something to do with the path that jdbc:sqlite: uses by default..
# 10
on second thought.. no, it doesn't work. it now properly loads the JDBC driver, but i cannot find a way to tell JDBC to look for the database on the remote server.
the current working directory for the applet defaults to my Desktop folder, and that is where JDBC looks for curse.s3db.
i am going to try using "jdbc:sqlite:http://192.168.0.4/curse/curse.s3db" and see if it makes any bit of difference.. although that means that the database will probably be cached locally and read.
that's fine with me, though. i don't want any of the client apps changing the database at all.. that is what the server daemon will be for.
i'll let you know how using http:// works out.
# 11
using the following code
Connection conn = DriverManager.getConnection("jdbc:sqlite:http://192.168.0.4/curse/curse.s3db");
now produces this error:
java.sql.SQLException: out of memory
at org.sqlite.DB.throwex(DB.java:252)
at org.sqlite.NestedDB.open(NestedDB.java:47)
at org.sqlite.Conn.<init>(Conn.java:36)
at org.sqlite.JDBC.connect(JDBC.java:38)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MapPanel.grabTiles(MapPanel.java:39)
at MapPanel.setup(MapPanel.java:22)
at processing.core.PApplet.handleDisplay(PApplet.java:1281)
at processing.core.PGraphics.requestDisplay(PGraphics.java:564)
at processing.core.PApplet.run(PApplet.java:1450)
at java.lang.Thread.run(Unknown Source)
MapPanel.grabTiles(MapPanel.java:39) is the same as when it was :40.. the code has just changed slightly and so has the placement of that statement.