aspose file tools*
The moose likes JDBC and the fly likes how to use datasource in a non-tomcat project? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to use datasource in a non-tomcat project?" Watch "how to use datasource in a non-tomcat project?" New topic
Author

how to use datasource in a non-tomcat project?

rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
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

Joined: Dec 11, 2004
Posts: 13410

I think you'll have better luck with this question in the JDBC forum.
Moving.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
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.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to use datasource in a non-tomcat project?