Do you mean storing the connection parameters in a file and using it in servlets repeatedly?
If that is the case then you should use Properties class.
Properties p = new Properties();
p.load(new FileInputStream("db.properties"));
Class.forName(p.getProperty("driver"));
Connection con=DriverManager.getConnection(p.getProperty("url"),p.getProperty("user"),p.getProperty("password"))
store the properties in a file as
driver=
url=
user=
password=
> Do you mean storing the connection parameters in a
> file and using it in servlets repeatedly?
> If that is the case then you should use Properties
> class.
> Properties p = new Properties();
> p.load(new FileInputStream("db.properties"));
> Class.forName(p.getProperty("driver"));
> Connection
> con=DriverManager.getConnection(p.getProperty("url"),p
> .getProperty("user"),p.getProperty("password"))
> store the properties in a file as
> driver=
> url=
> user=
> password=
thanks for your reply
this code even bigger than db connecting code so why I use this if I have to spend the same time
Can v make a file and import it or other solution