|
hi
i am using jrun and for my servlets i have to make
a DB connection(mysql) .i want to make this connection initially when the
servlet is first loaded.
i am giving initial parameters ia a file
called
jrun/jsm-default/services/jse/properties/servlets.properties
and the code in servlets.properties file
is
--------------------------------------------------------
servlet.MsgBoard.code=MsgBoard
servlet.MsgBoard.args=Driver=xxxxxxx servlet.MsgBoard.preload=false --------------------------------------------------------
above MsgBoard=servlet name and Driver=xxxxxxx is the argument
where Driver is argument name and xxxxxxx is argument value
in servlet i try to retrive this init parameter as
public void init(ServletConfig
config) throws ServletException]
{ super.init(config); try { m_szDBDriver = getParameter(config, "Driver", "interbase.interclient.Driver"); } catch(Exception e) { e.printStackTrace(); } }
public String getParameter(ServletConfig
servletConfig, String szName, String szDefaultValue)
{ String szValue = servletConfig.getInitParameter(szName); return szValue != null ? szValue : szDefaultValue;} and i am printing variable m_szDBDriver but the output i get is default value "interbase.interclient.Driver" can anyone help me thanks raj
|
