Hey everybody,

i am writing a "database based" application. i organized my GUI with different frame- and panelobjects, which need database information (connection, uernames etc). is it possible, to define those information in an external files and just import these data (like in php)?

i tried a solution with an external class, but i don't like it. more work than use..


i hope you got my problem ;)


ty

Are this data about connection to absolute (never to change, then why not to hard code it) or user may have option to edit them when need it(do not forget about security, something like encrypted file)?
And yes, you can use external file.

Hey,

there are 2 problems
number one: i'm using the database in ~6 different ways/on 6 different frames.
That causes a lot redundat code.
nr 2: in my case, these data never change, but if someone is using my application on another computer, the data may change (sql server adress, user names etc)

how can i use external files? as i said, the sql-class object is not optimal.

thanks

Hey,

there are 2 problems
number one: i'm using the database in ~6 different ways/on 6 different frames.
That causes a lot redundat code.
nr 2: in my case, these data never change, but if someone is using my application on another computer, the data may change (sql server adress, user names etc)

how can i use external files? as i said, the sql-class object is not optimal.

thanks

Use java.util.Properties class. Read about store and load from java documentation.

Another way is to use ResourceBundle class of java.util package.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.