Results 1 to 19 of 19
  1. #1
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Autostart jar and database

    I finished preparing a database application in Netbeans and now I want to create the autostart jar.
    I'll give it to a friend of mine for deploying on Windows. What happens if I need to modify the application after some time? I mean how does it deal with the database, 'cause in the meanwhile the database in my friend's pc will have changes. How does the new jar that I'll create deal with the old database?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Autostart jar and database

    You'll need to come up with a mechanism for updating the database as part of an upgrade.
    Not knowing the structure of your system it's hard to say, but you could simply have a db version (or app version) and a set of upgrade scripts you run to get from a->b->c->d. Those scripts would have to handle the existence of data in the database, of course.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Autostart jar and database

    I see. Is there a more simple mode to deploy my application in the computer where it will be executed? It is pretty small and I have just 3-4 forms in my app.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Autostart jar and database

    I was simply answering the "modification" part, at least related to databases.
    Deploying, there are lots of options. JNLP (ie web start), an installer, or simply supplying a zip containing the 'dist' folder from Netbeans.
    It all depends on the actual contents of the project. You say it has a database, which I presume is an embedded one?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Autostart jar and database

    I'd prefer giving all the folder. How can I create the 'dist' folder?
    I don't know if the db is an embedded one. I think it is, because I followed the instructions for creating a db from Netbeans.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Autostart jar and database

    Netbeans creates a dist folder, for desktop apps.
    It's under the project directory.
    Should contain the project jar, and a lib directory with any dependent jars.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Autostart jar and database

    I made a "clean and build" and now I have the 'dist' folder as you described it. Which is the db file? I just want to understand which files to change if I'll modify the application after a certain period of time, of course without modifying the current values of the db.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Autostart jar and database

    That all depends on your database.
    I have no idea what database you are using, or how it's been set up.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Autostart jar and database

    Well, I don't know what to answer. Just followed the instruction in this website:

    Java For Complete Beginners - Databases

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Autostart jar and database

    Java DB then.
    And it's setup as a server, so it's not going to be part of your app but a separate thing your app talks to.
    Unless at some point later on it talks about an embedded db, of course.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Autostart jar and database

    Yes, but what about the application running on another host? What should I do?

  12. #12
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Autostart jar and database

    As I said I followed the instructions on Java For Complete Beginners - Databases to create my db.
    What if I export the db in another format, easier to handle as separated from the application's files. How can I do that?
    Then, I can just change the connection string to connect my application to the new created db.

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Autostart jar and database

    Do you know where your database itself is being stored?
    Do you have the current connection string?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  14. #14
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Autostart jar and database

    Quote Originally Posted by Tolls View Post
    Do you know where your database itself is being stored?
    Do you have the current connection string?
    Java Code:
    jdbc:derby://localhost:1527/CityHall
    
    org.apache.derby.jdbc.ClientDriver
    
    jdbc:derby://localhost:1527/CityHall
    I used JavaDB virtual server to create the db and the tables. Just like showed in http://www.homeandlearn.co.uk/java/j...databases.html

    The problem is that I have no idea where to find the db file. dont know where is it stored ...
    Last edited by drimades; 03-09-2012 at 03:27 PM.

  15. #15
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Autostart jar and database

    I have no idea where it will place them.
    Somewhere under your netbeans workspace possibly.

    This really doesn't feel terribly transportable.
    Ensuring the end-user starts up the Derby server and all that.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  16. #16
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Autostart jar and database

    I see. For now the tables are empty as I am in test phase.
    I can try to recreate the database and connect with another driver (maybe MySQL). Which one offers good portability?
    Is there a way to get the SQL of the tables I've created, so I can recreate the db from scratch.

  17. #17
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Autostart jar and database

    Derby is portable, but it should be embedded, not a server.
    There's no point doing it as a server if it's only for a single desktop app.

    I don't use any IDE auto-generation stuff, so I have no idea how to get at the scripts.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  18. #18
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Autostart jar and database

    Solved.

    I changed the connection string from jdbc:derby://localhost:1527/CityHall to jdbc:derby:CityHall and I just put the db folder in the same folder of the jar file.

  19. #19
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Autostart jar and database

    I think (without checking), but that's using Derby embedded instead of as a server.
    Which is great.
    :)
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Client-Database vs Client-Server-Database Setup
    By xxSLRxx in forum New To Java
    Replies: 5
    Last Post: 01-06-2012, 09:53 AM
  2. Relational Database or Object Database?
    By mattlindsay in forum New To Java
    Replies: 8
    Last Post: 09-24-2011, 06:44 PM
  3. Autostart if program isn't started
    By Kruptein in forum AWT / Swing
    Replies: 0
    Last Post: 08-07-2009, 07:03 PM
  4. Replies: 2
    Last Post: 02-11-2009, 04:43 AM
  5. Database in a PDA
    By percivalwcy in forum JDBC
    Replies: 2
    Last Post: 08-08-2007, 03:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •