I'm trying to bundle PostgreSQL into my Windows application.
I have downloaded a binary PostgreSQL and created lots of tables under the new schema.
I was wondering if I could just copy the current database into the directory user would select.
Question:
Do I have to run 'initdb' in my installer? If that is the case, I think the current schema/tables are removed so I should run the external sql file which includes all of table creation commands. Is that correct?
What is the simplest way for me to bundle my current schema/tables into the user environment through Windows installer steps.
Add:
I realized that I couldn't just copy the current database into other system as it depends on the OS user in Windows.
I will run 'initdb' in my Installer and also run a table creation script.
Related
How can I create script version update function like in datalife engine cms ? For example customer has version 1.0 and I have created version 1.5. And I want the user to be able to update the script version directly from admin panel. How can I do it ?
Notice: This is my own solution.
#Guilherme Soster has provided the basics on how to do it. However if you do not want to do it yourself you can check my php-updater solution. You can define what you want to add (overwrite or add) and delete as well as scripts you want to run in a YAML file.
well, basically you'll have to store the user system's version in some config file or database and have a server where you keep the latest version of your scripts.
Then when the user request to check for updates (or each time that the software runs) your update script should hit the server and get the latest version number, compare it with the one your user has stored and if the user one is inferior the script should download the new scripts from the server (usually to a temp directory). Now all that the update script has to do is remove the old scripts and move the new ones to the directories where they belong. Finally the update script should update the version in the confi file/database.
I've added a custom application to my installer project and use it as recovery tool if something went wrong during update or if the new application data contains any bugs.
So far so good, restoring files and database works, but I can't figure out how to restore the version number. How can I implement this?
You would have to restore the file .install4j/i4jparams.conf in the installation directory. It contains the version number, also the file .install4j/response.varfile if you query installer variables in your code.
My Install4j configuration has no problem updating my executable and replacing the old instance.
However, my windows user profile is building up with each instance of the downloaded executable file:
install_1.0.0.exe
install_1.0.1.exe
install_1.0.2.exe
If I update to version 1.0.3, then I will see install_exe_1.0.3.exe stored here as well.
Is it possible for Install4j to delete this file upon update completion?
FWIW, this also occurs with Install4j updates. I have the following files in my user profile:
install4j_windows_5_1_10_with_jre.exe
install4j_windows_5_1_11_with_jre.exe
install4j_windows_5_1_12_with_jre.exe
install4j_windows_5_1_13_with_jre.exe
As of install4j 5.x, there is no clean-up mechanism for downloaded update installers, but you could build one yourself.
The place to add logic for deleting old installers would be in the updater. Each time a new installer is downloaded, you would have to save the download path to a persistent storage, such as the Java preferences store. When the updater is started, you could then load those saved paths and delete them.
I created a simple desktop application that uses embedded database(derby) from netbeans.After adding two entries into the table inside the ide and running it again works perfect.But when i double click the executable jar file outside the ide an empty database is shown what might be the reason? I would also like to know how to make this run on client machine.I tried adding the jar and lib files into a folder and converting it into a rar file but i don't find the jar file after extracting.I am new to this and any help would be appreciated.thanks in advance
There are two common reasons why you find that you are getting an empty database unexpectedly:
You are saying ';create=true' and using a relative database name, meaning that you are giving Derby permission to create the database fresh if it doesn't exist, and then your Derby system home directory is changing from run to run, so you are ending up creating new copies of the database each time, in different current directories.
You are using a different username when you connect to the database. Since the username with which you connect implicitly specifies the schema in which your tables reside, using a different username causes you to see a whole different set of tables, or, depending on how you look at it, an empty database.
Regarding jars and rars and such, the crucial thing is to manage your CLASSPATH properly. You need to have the Derby code in your CLASSPATH at runtime. There are a large variety of ways to make this happen, so you'll need to be quite explicit about the particulars of your situation in order for others to give you much help.
I have a small windows app and am trying to use SQL CE for the local datastore. I have had a couple of problems deploying it. I am using ClickOnce deployment.
First question:
In the Publish properties -> Application Files I have it set to Data File(Auto), Required, Include. However, it doesn't seem to be included? When I navigate to the location that Click Once installs to its not there?
Second:
Click once creates a new directory in the User\Local\Apps directory, with the app files and SDF file in when I update the app and release a new version I don't want to start with a new database. All the data in the existing database will be lost? The just doesn't seem to make sense?
What is the procedure around this?