Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Properties File reading

 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ranchers,
I'm doing a project in JSP and MySQL. For the JSP-MySQL connection , I'm now writing the connection statments in each and every time when I want to insert,delete, update of select the database queries. If I change the MySQL root password, it will affect the coding completely.. So Instead of that I want to put properties file to store the

MySQL database
Username
Password

Please help me by sending some links where I can read and master about Properties file.

Regards

Aravind Prasad
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aravind,

I think the Java in General (beginner) is more appropriate for questions on the use of property files.

Regards, Jan
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might start by reading Java Tutorial: Properties.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm now writing the connection statements in each and every time when I want to insert, delete, update or select

I bet that's getting old, isn't it? One good guideline in OO design is to avoid duplication, which among other things means any copy paste is suspect. Are you comfortable making your own new classes? Think about a little class that does the connection work for you. It can read the configuration once, and remember it all day long.

If that much sounds worth doing, show us what you make and we'll talk about adding more nifty features.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic