Forums Register Login

packing an acces file with my jar

+Pie Number of slices to send: Send
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 ?
+Pie Number of slices to send: Send
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???
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1475 times.
Similar Threads
Get com.sun.net.httpserver package
Jar files & JarOutputStream
Jdbc driver not found when putting an application in a jar-file
Using MS ACCESS in a jar file
Adding Database to application
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:19:37.