• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

More than one applications in Jboss?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Im a newbie to JBOSS, forgive me if it is a stupid question.

can i run more applications in JBOSS? if it is possible how can i relate the each application to separate database?
suggest me some documents for jboss which has these details..



Thanks all
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes you can run multiple applications on a single server. Each application will configure and use its own datasource.
 
senthilkumar ap
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply..
you meant "its own datasourse".. so i cant configure each application with its own "database"?
and could you suggest some documents or examples to how to configure?
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

senthilkumar ap wrote:
you meant "its own datasourse".. so i cant configure each application with its own "database"?



Typically in a JavaEE environment, database access is done through datasources. However if you have some custom way of accessing a database, you can continue doing that. It's finally upto the application on how it connects to the right database (the connection url).


and could you suggest some documents or examples to how to configure?



See this

 
senthilkumar ap
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually my application is Struts with Ejb integrated, i configure the database for the first application in postgres-ds.xml file.. so if want to run one more application configured with separate database or datasource then what should i do?
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you're accessing the database through a datasource, as described in the postgres-ds.xml file. If you look in that file, it will have an entry which specifies the JNDI Name for the datasource (note that the name of the file itself doesn't matter - it is the JNDI name inside the file that is used).

If you want another datasource that operates on a different database, just create another datasource file with a different JNDI name.

Then, in each application, just reference the correct datasource (by its JNDI name).

Note that multiple applications can certainly use the same datasource if you want them to. You don't have to have a different datasource for each application. However, if each application really uses a different database, then you will need to have separate datasource files.

 
senthilkumar ap
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks your reply, i understood what you are coming to say.. so i can create another one file which may have the name like postgres1-ds.xml and i can specify the different JNDI name there.. am i right?
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

senthilkumar ap wrote:Thanks your reply, i understood what you are coming to say.. so i can create another one file which may have the name like postgres1-ds.xml and i can specify the different JNDI name there.. am i right?


That's right. You can create as many as you like.

Also, if you have two applications which need to access the same database, they can share a datasource if you like - or use separate datasources if you need that for some reason.
 
senthilkumar ap
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again Thanks,
Could you tell how the JBOSS will pick up postgres-ds.xml's if i have more than one? will it read every postgres-ds compulsorily ?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can have multiple *-ds.xml files (hence the use of the term "*-ds.xml" to describe them). You can name them anything you like (for example, one-ds.xml, two-ds.xm, etcl) but a typically recommended pattern is to include the database type, and at times the database name or datasource name, in the file name (example: postgresql-accounting-ds.xml). Note that this naming convention is preferred over numbering the files; in other words I recommend against using postgreslq1-ds.xml, postgresql2-ds.xml, etc. Not that it would not work, but by using a more descriptive name you can tell them apart more easily.

The application server will open and deploy every *-ds.xml file in the deploy directory.
 
senthilkumar ap
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peter Johnson ,Mark E Hansen and Jaikiran Pai,
Finally i got what i was looking for, bec of you all,

Thanks again

 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remember to mark your topic as Resolved.
 
reply
    Bookmark Topic Watch Topic
  • New Topic