You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ashish Kulkarni <as...@gmail.com> on 2007/09/26 20:56:21 UTC

ibatis in web application

Hi
I need some information about using ibatis in web application, i am using
sql maps for java. i have SqlMapConfig.xml and SqlMapConfig.properties file
under src folder,
SqlMapConfig.properties has database connection information,

Now the question is when i create the war file, i do not know what database
it is going to connect, so normally i would install this war file and then
change the SqlMapConfig.properties file ( which is under WEB-INF\classes)
after installing it on application server.

Is this the right way to do it, since i am having issues in doing so with
weblogic,
What is the standard practise, or do i have to create war file after i get
the database information, which will be very difficult.


Ashish

Re: ibatis in web application

Posted by Ashish Kulkarni <as...@gmail.com>.
Hi
I don't mind restarting the web
application, but in weblogic, some times the temp files are deleted,
so i loose all the changes done to the properties file, this is very weird
situation, as it works fine in websphere, tomcat, but causing issue with
weblogic,
Does any one face this situation,

Ashish


On 9/26/07, Kenny Pearce < kenny.pearce@hxti.com> wrote:
>
> What you are doing should work fine. However, depending on where you
> initialize your ibatis client in your servlet code, you may have to
> restart your web application after modifying the file.
>
> Ashish Kulkarni wrote:
> > Hi
> > I need some information about using ibatis in web application, i am
> > using sql maps for java. i have SqlMapConfig.xml and
> > SqlMapConfig.properties file under src folder,
> > SqlMapConfig.properties has database connection information,
> >
> > Now the question is when i create the war file, i do not know what
> > database it is going to connect, so normally i would install this war
> > file and then change the SqlMapConfig.properties file ( which is under
> > WEB-INF\classes) after installing it on application server.
> >
> > Is this the right way to do it, since i am having issues in doing so
> > with weblogic,
> > What is the standard practise, or do i have to create war file after i
> > get the database information, which will be very difficult.
> >
> >
> > Ashish
> >
> >
> >
>
> --
> Kenny Pearce
> Hx Technologies
>

Re: ibatis in web application

Posted by Kenny Pearce <ke...@hxti.com>.
What you are doing should work fine. However, depending on where you 
initialize your ibatis client in your servlet code, you may have to 
restart your web application after modifying the file.

Ashish Kulkarni wrote:
> Hi
> I need some information about using ibatis in web application, i am 
> using sql maps for java. i have SqlMapConfig.xml and 
> SqlMapConfig.properties file under src folder,
> SqlMapConfig.properties has database connection information,
> 
> Now the question is when i create the war file, i do not know what 
> database it is going to connect, so normally i would install this war 
> file and then change the SqlMapConfig.properties file ( which is under 
> WEB-INF\classes) after installing it on application server.
> 
> Is this the right way to do it, since i am having issues in doing so 
> with weblogic,
> What is the standard practise, or do i have to create war file after i 
> get the database information, which will be very difficult.
> 
> 
> Ashish
> 
> 
> 

-- 
Kenny Pearce
Hx Technologies

Re: ibatis in web application

Posted by Jeff Butler <je...@gmail.com>.
That's what a resource reference is for!  You use a constant resource
reference and then you can change the actual JNDI name after
building/installing the WAR.

Jeff Butler



On 9/26/07, Ashish Kulkarni <as...@gmail.com> wrote:
>
> Hi
> I do not know the JNDI name when creating war file also, so i will have to
> change it after installing web application anyway,
>
> Ashish
>
> On 9/26/07, Christopher Lamey <cl...@localmatters.com> wrote:
> >
> > Hello,
> >
> > Another route is to configure your database connection information via a
> > DataSource in JNDI.  Then your webapp just references the JNDI name
> > (something like java:/comp/env/jdbc/OrderDS) and you can change it as
> > you
> > like outside the webapp.
> >
> > Lookup JNDI DataSource in your weblogic docs to see more.
> >
> > Cheers,
> > Chris
> >
> > On 9/26/07 12:56 PM, "Ashish Kulkarni" < ashish.kulkarni13@gmail.com>
> > wrote:
> >
> > > Hi
> > > I need some information about using ibatis in web application, i am
> > using
> > > sql maps for java. i have SqlMapConfig.xml and SqlMapConfig.propertiesfile
> > > under src folder,
> > > SqlMapConfig.properties has database connection information,
> > >
> > > Now the question is when i create the war file, i do not know what
> > database
> > > it is going to connect, so normally i would install this war file and
> > then
> > > change the SqlMapConfig.properties file ( which is under
> > WEB-INF\classes)
> > > after installing it on application server.
> > >
> > > Is this the right way to do it, since i am having issues in doing so
> > with
> > > weblogic,
> > > What is the standard practise, or do i have to create war file after i
> > get
> > > the database information, which will be very difficult.
> > >
> > >
> > > Ashish
> >
> >
>

Re: ibatis in web application

Posted by Ashish Kulkarni <as...@gmail.com>.
Hi
I do not know the JNDI name when creating war file also, so i will have to
change it after installing web application anyway,

Ashish

On 9/26/07, Christopher Lamey <cl...@localmatters.com> wrote:
>
> Hello,
>
> Another route is to configure your database connection information via a
> DataSource in JNDI.  Then your webapp just references the JNDI name
> (something like java:/comp/env/jdbc/OrderDS) and you can change it as you
> like outside the webapp.
>
> Lookup JNDI DataSource in your weblogic docs to see more.
>
> Cheers,
> Chris
>
> On 9/26/07 12:56 PM, "Ashish Kulkarni" <as...@gmail.com>
> wrote:
>
> > Hi
> > I need some information about using ibatis in web application, i am
> using
> > sql maps for java. i have SqlMapConfig.xml and SqlMapConfig.propertiesfile
> > under src folder,
> > SqlMapConfig.properties has database connection information,
> >
> > Now the question is when i create the war file, i do not know what
> database
> > it is going to connect, so normally i would install this war file and
> then
> > change the SqlMapConfig.properties file ( which is under
> WEB-INF\classes)
> > after installing it on application server.
> >
> > Is this the right way to do it, since i am having issues in doing so
> with
> > weblogic,
> > What is the standard practise, or do i have to create war file after i
> get
> > the database information, which will be very difficult.
> >
> >
> > Ashish
>
>

Re: ibatis in web application

Posted by Christopher Lamey <cl...@localmatters.com>.
Hello,

Another route is to configure your database connection information via a
DataSource in JNDI.  Then your webapp just references the JNDI name
(something like java:/comp/env/jdbc/OrderDS) and you can change it as you
like outside the webapp.

Lookup JNDI DataSource in your weblogic docs to see more.

Cheers,
Chris

On 9/26/07 12:56 PM, "Ashish Kulkarni" <as...@gmail.com> wrote:

> Hi
> I need some information about using ibatis in web application, i am using
> sql maps for java. i have SqlMapConfig.xml and SqlMapConfig.properties file
> under src folder,
> SqlMapConfig.properties has database connection information,
> 
> Now the question is when i create the war file, i do not know what database
> it is going to connect, so normally i would install this war file and then
> change the SqlMapConfig.properties file ( which is under WEB-INF\classes)
> after installing it on application server.
> 
> Is this the right way to do it, since i am having issues in doing so with
> weblogic,
> What is the standard practise, or do i have to create war file after i get
> the database information, which will be very difficult.
> 
> 
> Ashish