[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - How to use H2 database from Jboss

sdsani do-not-reply at jboss.com
Mon Feb 16 22:47:13 EST 2009


Hi,

I am trying to configure H2 database from Jboss and have done following.

1. Created h2-ds.xml file and copied into 
      C:\jboss-5.0.0.CR2\server\default\deploy\jca.
2. Copied h2.jar file at following location.
      C:\jboss-5.0.0.CR2\server\default\lib
3. Now when i start my server i see following message in console.
      Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=H2DS' to JNDI name 'java:H2DS'

However, when i try to connect using following code.

Properties properties = new Properties();
		properties.setProperty InitialContext.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");

properties.setProperty(InitialContext.PROVIDER_URL, "jnp://localhost");

InitialContext ic = new InitialContext(properties);
		
		Connection con = null;
		if (ic != null) {
			DataSource ds = (DataSource) ic.lookup("H2DS");
			con = ds.getConnection();
		}


I am getting following error.
21:44:22,389 INFO  [STDOUT] Error Data : H2DS not bound

Please advice.

Sani

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4210565#4210565

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4210565



More information about the jboss-user mailing list