Recently I was asked for a programming assignment for a job interview to produce a CRUD application using Sqlite, Spring, and Maven, so I have the setup with resources directory. I put my db (crud.db) into the resources directory; and in the spring context.xml file, defining a datasource I was trying to give the connection string.
jdbc:sqlite:crud.db
Unfortunately I was getting that the only table in the file (Person) didn't exist, yet I could open the file using the Database explorer (SqliteBrowser). The way I ended up fixing it was writing into the DAO class whenever a connection was acquired, it used string manipulation to get the right absolute path and do it that way.
How can I do it in the context.xml though? I tried putting crud.db in the WEB-INF with the context.xml and web.xml files but no success.
I want to be able to pass it off embedded in the WAR file and on another machine I'll have no idea what the absolute URL will be. Is the ONLY way to define the context through code? I hope not.
-Thanks!
Aucun commentaire:
Enregistrer un commentaire