• Post Reply Bookmark Topic Watch Topic
  • New Topic

packing an acces file with my jar  RSS feed

 
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have swing application that uses an access database.
if I want to package my appliction into an executable jar format, then can I package this database(access file) along with my application ?
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
I guess you can as the jar is just a zip file so you can put whatever you want in it. However, if maybe you are using JDBC to do queries on the database I think the user will still have to extract it from the jar and set up an ODBC datasource on their PC. Not sure how you'd get around that But I'm not a JDBC expert so maybe someone else has a suggestion for accessing the DB inside the jar???
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot access the Access database from inside the jar as Access could never find it there to access it.
You would indeed also need to set up an ODBC reference on the client machine, but any halfway decent installation program should be able to help you do that.
It can also put the mdb somewhere for the reference to find (Access ODBC references refer to a physical file location so it needs the file location anyway) and create a shortcut to launch your jar from the desktop.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
You can jar up just about any ol' files you want to include in your executable JAR.
As mentioned, if you're wanting an Access database engine on the client machine to make use your Access database file, you'll have some more work ahead.
Depending what you're trying to do, you might prefer to make use of an embedded database system like hsqldb.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even using hsql the datafiles themselves will need to be outside the jar, certainly when they're not to be read-only (hsql might support reading a readonly database that resides inside a jar, you'd have to look that up).
A better mechanism would be to include a function in the installer or program which creates the actual database on the fly during installation or when first run.
This can use a datafile which CAN reside inside the jar and create the database based on that file outside the jar.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!