Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use datasource in a non-tomcat project?

 
rick collette
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, guys:

I am stuck here with this problem. I created a Java project on
Eclipse, the reason is I have to use my own framework that won't
fit into a Tomcat project. But we are using Tomcat to run our application. Now I have to create datasource for Hibernate to use. If this is a tomcat project, I can set up DB2 datasource in Tomcat's server.xml. But it seems I cannot access this datasource set up in server.xml and web.xml using Hibernate code or JDBC code. I am wondering if there is a workaround for this?

regards,
[ February 02, 2006: Message edited by: rick collette ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you'll have better luck with this question in the JDBC forum.
Moving.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to set up a non-JNDI data source. Check your driver/DB documentation on how to instantiate the data source class with the related data you need, eg database name, port number, etc. Once you have the data source, you can then get the Connection.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic