• Post Reply Bookmark Topic Watch Topic
  • New Topic

Database at first launch  RSS feed

 
Buddhi Vikasitha
Greenhorn
Posts: 17
Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm developing a single user(single PC) application so I want my database related to the application to be created when the program runs for the first time on a different computer, so i don't need to create my database for a second time. Please help me with this, Thanks, Hope you understand![/size]
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
umm...help you with what, exactly? You didn't ask an actual question, so it's kind of hard to know what kind of help you need.

We find it works best when you TellTheDetails, and ShowSomeEffort.

So please tell us what EXACTLY you are looking for help with.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would not make creating the database part of the program, but as a separate script.
 
Buddhi Vikasitha
Greenhorn
Posts: 17
Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:umm...help you with what, exactly? You didn't ask an actual question, so it's kind of hard to know what kind of help you need.

We find it works best when you TellTheDetails, and ShowSomeEffort.

So please tell us what EXACTLY you are looking for help with.


I'm developing a single user application(like a store management software), normally i have to put the database in to the hard disk while doing codes. In this way i have to create the database manually once i put this into another computer. i need the database to be created when it runs for the first time but i have do not understand how to do it. So i need help from the beginning of this task. Thanks! sorry for my bad English.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Buddhi Vikasitha wrote:I'm developing a single user application(like a store management software), normally i have to put the database in to the hard disk while doing codes. In this way i have to create the database manually once i put this into another computer. i need the database to be created when it runs for the first time but i have do not understand how to do it. So i need help from the beginning of this task. Thanks! sorry for my bad English.

I hate to say, but that post contains so many inaccuracies it's difficult to know where to begin, but the most basic are:
1. "i have to create the database manually once i put this into another computer" - so, is this a "single user" app or not?
2. "i need the database to be created when it runs for the first time" - No you don't. All you need to do is include an empty database in your jar.

I'll leave the rest of the misconceptions to others, but I will say this: If you don't understand the basics of deployment, why are you even considering copying your code to other systems?

Sorry if it sounds harsh, but there it is: I used to be a Security Administrator - and I wouldn't let anything like your solution within a mile of my systems.

Winston
 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 143
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


replace <p> with your mysql root password.
replace <dbName> with your Database Name.
replace <path for backup file> with your Database Backup file.

and you should able to manage exceptions.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime.exec()? That looks like a reliable way to make a confusing situation very confusing.

Create the database using its command‑line interface. Load the basic database from a .sql file. Then use the usual JDBC connectors to run it.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is premature to talk about how one would deal with mysql when it's not clear that that is the DB that will be used. What's more, it's not clear if any DB server is even available on (or to) the target machine. To me it sounds like a use case for something like Hsqldb or Derby. Let's wait for Buddhi Vikasitha to clarify this point before speculating further.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!