Hi William Brogden: First thanks for the reply, this is what i want to do in my java program. I have few java program, they are using the same value for this three parameter. 1. this.driverName 2. this.conString 3. this.sql this.driverName="oracle.jdbc.driver.OracleDriver"; this.conString="jdbc racle:thin:admin/user@backup..com.sg:1521 rcl"; this.sql="select * from Table1"; So I want to save this three parameter value in a text file, so every time I want to change it, I only need to change the text file, so all the java program will be change. So how should I retrieve this parameter value from this text file? Or any other ways can slove this problem? cheers Eric
Hi , Keep these string values in a file say "c:\myinput.txt", and open this file using "FileReader" class. Pass this Reader objects to "BuffredReader". e.g. code is... BufferedReader bd= new BufferedReder(new FileReader("c:\myinput.txt")); Now use "readLine" Method of BufferedReader to get the each line. Still better way is to keep all your input in XML file and use XML parser to get the required tag values. If you have Tomcat as servlet runner, you have to set up all its parameters in XML file only. Bye. Regards, Holla.
hi, make properties file instead of text file. this is very simple. and then in your program retreive like this Properties pr=new Properties(); String fname=new Properties("yourfile.properties"); FileInputStream in=new FileInputStream(fname); prop.load(in); String driver=prop.getProperty("this.driverName"); String con=prop.getProperty("this.conString"); and then u can make use of these strings anywhere like DriverManager.getConnection(con); hope this would help. vikas
Eric, Go for .properties method. A sample MIS.properties file which I use is regds maha anna
Joined: Dec 21, 2000
Hi, vikas sahni, Frank Carver, maha anna �CRaghavendra Holla : Thank you very much for all your replies. I have been slove my problem. Thanks again. You are really a Java Expert. I hope this forum will keep going, and hope more people join in to this forum. cheers Eric