سؤال

I need to use h2 in my project and want to connect with JNDI pool. How should I configure my JBoss/Tomcat server or my maven configuration to be able do something like here:

Context initContext = new InitialContext();
ds = (DataSource) initContext.lookup("java:/comp/env/jdbc/ttDS"); 
...

I can't copy h2-*.jar driver to my JBoss ./lib directory as has no access.

My database is memory-located.

هل كانت مفيدة؟

المحلول

You should either include the driver in your pom.xml so that maven installs it, or you should copy it into your project manually before you deploy it.
You may find the below articles usefuly:
https://www.openshift.com/kb/kb-e1087-how-to-include-libraries-jar-files-in-your-java-application-without-using-maven https://www.openshift.com/kb/kb-e1086-how-to-use-the-pre-configured-mysqlds-and-postgresqlds-data-sources-in-the-java

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top