Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Inject DataSource  RSS feed

 
Albert Armb
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I´am trying to inject my Datasource, becuase i need a connection to the DB.
I inject PersistenceContext from my persistence.xml
The same i am trying with DataSource:

Persistence.xml






Error is, that "jdbc/mssql" could not be found.
Please help
 
J Miller
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The jta-data-source points to the JNDI name of the database this persistence unit maps to. It can't find that data source for some reason, maybe a typo? In my project, that's set up in my Websphere server admin console. If you have this set up correctly, you don't really need to create the DataSource or Connection, JPA does that for you. For example, you would just say:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!