Solved

Changing a settings file in a Java program

Posted on 2002-04-26
6
180 Views
Last Modified: 2010-03-31
Hi,
When I install a Java application, it requires a connection to a database. The flaw in this program is that it has a default database name (DSN) to which it tries to connect. Unless you happen to have that data source on your machine, it will fail. When installing this application, it never gives you the option to edit the DSN name. Can anyone suggest how I might change this? I am not a java programmer, so be gentle!. I suppose i need to change one of the source files for this.
thanks for any assistance
Mike
0
Comment
Question by:mikeandbee
6 Comments
 
LVL 7

Expert Comment

by:yoren
ID: 6971895
I would first check the documentation of this application. If this application ignores all sensibility and does not give you the option to change the DSN, read on.

You'll have to change one of two things, depending on the application. It might be reading the DSN from a properties (settings) file, or it may be embedded in the application.

The easiest way to find the problem is to unpack the source files and use an editor that lets you search for the DSN string in multiple files. If you find it in a properties file, you won't have to recompile. If you find it in the source, you'll have to run "javac <file>" for the changed file.

Yuval
0
 
LVL 92

Accepted Solution

by:
objects earned 100 total points
ID: 6972592
Two options:

1. Pass the DSN as a paramater on the program as a command line:

java -Ddsn=xyz mypackage.MyClass

2. Store the DSN in a properties files, and have your program read it from there.
0
 

Author Comment

by:mikeandbee
ID: 6977791
I can change the DSN in the properties file AFTER it has been installed, but what I want is for the program to give me the option to add/find a DSN on my system, and not hardcode the DSN into the settings file. Is it possible tochange this with little knowledge of Java? Do i need a Java programming environment to do this (which i don't have)?

thanks
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 92

Expert Comment

by:objects
ID: 6978707
> Is it possible tochange this with little knowledge of Java?

Define little.
Sounds like this would require a code change.

> Do i need a Java programming environment
to do this (which i don't have)?

Yes.
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7992289
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: objects
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8048111
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now