Automatically connect to a DB in a swing application - database

I m working on a single user swing application that access an hsqldb database. How can i Automatically run the DB server when a user run the application.?
for example, after i finish development i will put the application into an exe file.
If the exe file is distributed to multiple users. How can the DB server run and the DB be created when the user run the exe file?
Thanks

dumb question: why not just use HSQLDB in an embedded manner, instead of a client-server? (in fact, before reading your Q I didn't realize it could be made to run in client-server mode) If you're not sharing anything, just accessing a persistence layer, it should be straightforward.

Related

Moving local Geoserver's data directory to production server unable to create new store

I have a local GeoServer running on tomcat which using a PostGIS store to get layers from the PostgreSQL database. There is a production server that runs the same version of my local GeoServer and PostgreSQL database. In order to apply changes in layers and layer groups of my local GeoServer, I copied and replaced the data directory to production GeoServer. After restarting the tomcat on the production server, Geoserver unable to load Layers and Layer Preview pages on the web interface. Trying to change the host address of the store or creating a new one, it gives me this error:
Error creating data store with the provided parameters: Failed to upgrade lock from read to write state, please re-try the configuration operation
You don't say which OS you are using or how you made the copy, but the most likely error is a permissions or ownership one.
Make sure that the user which is running GeoServer has permission to read, write and execute on the data dir. On linux machines I've seen issues with uid and gid differences between machines depending on how the copy id carried out. On Windows I've seen issues just because windows and the virus scanner feel like it.
When using the community function jdbcconfig, the same issues.
It seems that an error occurs because file locking of catalog is performed.
Since the data directory is not used by using JDBCconfig, the file lock has been improved by setting it to Lock Disable.
https://docs.geoserver.org/stable/en/user/configuration/globalsettings.html#file-locking

add data to a *.sdf file

I have create an application for windows, where i am using phone's sqlite as DB to store data. While testing the app in Emulator after the first time(i.e reinstallion of the app), the data of the DB gets erased every time.
So can any one please tell me How to:
Save the existing data of the DB before reinstalling the app.
Modify the .sdf file Manually (with out using the app)
To save the data in some other way, which will not be affected by the reinstallation of the app.
More Information regarding ways to add data to .sdf file are appreciated ...
Edit: Is it possible to browse and edit the .sdf file in phone when application gets installed
If you run the app via the Emulator, every time you close the emulator the app along with its components gets uninstalled. To prevent this , don't close the emulator everytime you run the app. Keep the emulator open, and run the program.
In the phone once the app is installed, the data is not deleted from the database and it is persisted.
The SDF can be modified using the Server Explorer in Visual Studio, add a database connection to SQL CE 3.5 and point to your sdf. You can modify the data from there.
You can also use the Isolated Storage explorer to open the SDF. http://wp7explorer.codeplex.com/

Access 2007 - accdb; options in setting up a reliable multi-user environment across multiple servers?

I am having trouble sorting through all the information / various options in regards to Access 2007 used in a multi-user environment. Here is a brief description of my current situation. At work there is the "Business LAN" which I can log on and use to monitor two other servers via remote desktop. The business LAN is strictly controlled by our IT department and no one is permitted to install any software or drivers without their consent. I do have administrative privileges on both servers though.
The two servers that I log on to using RD are used for essentially the same task, which is to monitor and control the heat to different process lines. Each server runs a different program to accomplish this task but both programs use SQL Server as a back end.
I created two access databases (one on each server because they are currently behind seperate firewalls) in order to query information from the backend SQL side of these programs and combine it with relative information I have compiled in tables in order to add more detail to the data the programs are collecting. My program is still in the debug stage but ultimately this information can then be accessed by field techs / maintenance in order to make their job easier. Maintenance staff can also add even more information based on the status of repairs etc....Last, I have created reports which can be run by Managers / Engineers who are looking for an overall status of their area.
Both access db's are split so that the back ends are seperate from the forms, queries, etc... I use an ODBC data source to import a link to SQL. I am using vba for user authentication, user logging record updates, and user / group access control. Everything works the way I intended except the fact I everyone who logs on the server will be trying to run the same copy of the front end. For example, I had a co-worker log on to the server via RD to test the program and I logged on from my desk. After logging in I could see the forms he had open. Access was already running. Without being able to install access locally (or even runtime, due to IT restrictions) on to each individuals workstation, I'm not sure what approach to take to resolve this.
Additional info, Server 1
One of the servers is considered to be the "master server" in which a number of client stations "slave servers" all communicate with. The only way to access folders on themaster server is log on to the client station and run RD.
Server 2
This server is considered to be the "historian". It communicates with a terminal server in which users log on using RD and run applications which use SQL backend which resides on the historian. I have been able to set up shares so that certain folders are visible on the historian from the terminal server.
Can anyone tell me what my best option is?
Thanks in advance.
CTN
It's really crazy the way some IT departments do everything possible to make it hard to do your job well.
You allude to users logging on via Terminal Server. If so, perhaps you can store the front ends in the user profiles of their Terminal Server logons? This assumes they're not just using the two default admininstrative Terminal Server logons, of course.
The other thing that's not clear to me is why you need a back end at all in Access/Jet/ACE -- why not just link via ODBC to the SQL Server and use that data directly? The only reason to have an independent Jet/ACE file with data tables in it in that scenario is if there is data you're storing for your Access application that is not stored in the SQL Server. You might also have temp tables (e.g., for staging complicated reports, etc.), but those should be in a temp database on a per-user basis, not in a shared back end.
Here is a suggestion how to implement what David Fenton wrote: write a simple batch script which copies your frontend from the installation path to %TEMP% (the temporary folder of the current user session) and runs the frontend from there. Something along the lines of
rem make sure current directory is where the script is
cd /d %~d0%~p0
rem assume frontend.mdb is in the same folder as the script
copy /y frontend.mdb %temp%
start %temp%\frontend.mdb
Tell your users not to run the frontend directly, only via the batch script, then everyone should get his own copy of the frontend. Or, give your frontend a different suffix in the installation path and rename it to "frontend.mdb" when copying to %temp%.

h2 & linux. how to start the database?

sorry im rather new to linux ubuntu. i have an application that i made that runs with tomcat and connects to an h2 database. it all works fine on my windows laptop. im now moving it onto my linux computer to run all the time. but im having trouble with starting the database. i have downloaded h2 from their website. and its sitting on my desktop.
the question is. how to start the database.
and is their any other commands i need to know to run and operate it.
thankyous
The H2 database supports different modes:
You can use H2 in embedded mode using a database URL of the form jdbc:h2:~/test. This is the easiest case. In that case the database is running within the same process as your application is running, and you don't have to start a separate process just for the database.
You can use H2 in server mode. In that case you need to start a separate server process. But for your case it doesn't sound like you need this, right?
H2 also supports mixed mode (half embedded / half server), and the automatic mixed mode.
For details, see the H2 documentation about Connection Modes.
Is this what you are looking for?
https://groups.google.com/forum/?fromgroups=#!topic/h2-database/r-qRnskN0eQ
Open terminal in bin directory of h2 database and write these commands...
chmod +x h2.sh
./h2.sh
Click here for more information (similar thread)...

Uploading data into remote database

What is the most secure and easier way to send approx. 1000 different records into database that is not directly accessible - MySQL database on Web provider's server - using Windows application
.
Data will be stored into different tables.
Edited:
The application will be distributed to users who have no idea what is database or putty or... They just install my application, open it, enter some data and press Submit.
Currently I'm using php to upload the generated script into webserver and there process it. I think I should also include some signature to the file to avoid some "drop..." hacks.
If you can export the data as a sql script you can just run it against the remote server using your application of choice. 1000 records wont create that big a script.
In current project on my job we have the same situation - remote (faraway) database.
I made next solution: serialization sql query into xml and putting it via HTTP to web daemon, which is running on remote server instead of open sql server. Daemon checks credentials and executes query.
As I can't execute any external programs on external server, I created following solution:
My program creates script file and calculates it's salted hash
Program sends this file together with user credentials and hash into PHP page on the server
PHP page checks the username and password, then checks hash and then executes script. Only Insert and Update commands are allowed.
Is this approach secure enough?

Resources