This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

EJB 2.1 JDBC resource references

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Going straight to the point:

EJB 2.1
MSSQL
JBoss 5.1.0 GA

In the EJB deployment descriptor (ejb-jar.xml) I have:


In standardjboss.xml I have:


In the deploy root I have a file named mssql-ds.xml which relevant content is:


Then in the SendMail EJB I have:


Which throws an Execption because it's expecting the FROM keyword in the statement. This is falling to DefaultDS (Hypersonic) and not using the jdbc/TESTEDS.
Exception message is: java.sql.SQLException: Unexpected token , requires FROM in statement [SELECT 1]

If I lookup for the DataSource using:


It works... but things are not done like this.

Can anyone point me the right direction to get this up and running please?

Thanks in advance
 
Dimargio Guedes
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

After taking a break and coming back up to this, I found a solution.

I created a file named jboss.xml in the META-INF folder and moved inside it the contents I previously added to standardjboss.xml:



Now everything works, but I think that there should be a better way of doing this. This way I'm configuring the DataSource inside the EJB JAR, making it JBoss dependent. If I move this to another App Server things will not work again I suppose.

But for now it's ok to me.

Thanks
 
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!