Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Validation Message and JVM

Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi All,

I have few questions

Q.1 If user is starting application in standalone mode and when he has to specify the database file location , let say if user does not specify the database file location file properly then should we give Alert message "Please specify the database file"?
Our application should be designed only for the database file given to us (specific to our assignment)?
Let say if user specify other file that also ends with .db(but not the database file whatever Sun has given) then still should we give aler message "Please specify the database file" ?
or our application should be designed for all the database file those have extension .db ?

In standalone mode can we run more than one instance of application (ApplicationRunner which is starting point to start the applicaton )on one JVM ?

Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't let the user proceed without specifying the database location.

I'm disabling the Ok button in my JOptionPane and enable it only when the file exists, is readable and writable and has the proper magic cookie in its header.
Posts: 2292
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Pramod!

Partner, for Q1, here's what I did: when the user provides the database location in standalone mode, the first thing that I do is verify if the given file exists; if so, I proceed and verify if the given file has the right "magic cookie". So you end up having to make assumptions here. For instance, I assumed that the right database file must have the same magic cookie value as the one present in the database that was provided to me, but I already saw some people that ignored this value. If the magic cookie value present in the given file matches the magic cookie value of the database that was provided to me, then everything proceeds normally, otherwise, I show a message dialog, informing that the provided database is invalid. And I chose to hardcode this value, so I could verify it every time the application starts.

For the other question, I assumed that only one instance of the application would be running at a time.
Posts: 11604
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi pramod,

Q1. you should be able to process each valid database-file. So i let user choose any *.db file and if that's a valid file (not empty, correct magic cookie, readible file, writable file,...) server or standalone client will start. otherwise error message is shown.

Q2. my instructions clearly tell me

You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.

[edit] I see that i was beaten in speed by Axel and Roberto
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic