In the persistence.xml configuration file, we have data source got it from web server configuration file, and created by server like Jboss or tomcat.
I just wonder how to create this same data source via Java stand-alone application?
I have Java standalone application embedded Jetty server running with JPA module. Question is how to setup or create data source from my Java application just like web server; which called by persistence.xml?
You can use DataSource such as C3P0. So instead of getting it from the JNDI, you can configure the datasource information in the persistence.xml, e.g.
I assume you use Hibernate
SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
Joined: Dec 02, 2009
I know this method, I just don't want users to modify persistence.xml directly. I plan to provide customized format ot properties file, so users can easily change database parameters when application is running their environment. I just wonder how to create data source Java programming just like Java web application server.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to create datasource for standalone application using JPA