Re: BindAddress via JDBC
Hi, I see... I guess in this case there is no other way than to manually set the address. It's a bit unfortunate, maybe it could be solved in some way. If somebody has an idea - patches are always welcome. Regards, Thomas -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Re: BindAddress via JDBC
If I don't set it, communication from my app to the local H2 db uses the company network, which is required for startup. However, upon disconnecting (losing wireless coverage) which happens on occasion, subsequent calls to the db errored out during development. If this should fail over by default, then maybe my implementation is not letting go properly. I'm still learning and wouldn't be surprised if I've built some pieces improperly. -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Re: BindAddress via JDBC
Hi, I wonder why you need to set the property... As my application must be able to function off-network, I cannot be bound to the company IP By default, the listener is bound to all available network adapters, meaning you should not need to set this property. What happens if you don't set the property? Or do you set it just for security? Regards, Thomas -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Re: BindAddress via JDBC
System.setProperty(h2.bindAddress, 127.0.0.1); On 13 October 2011 21:44:41, beetle wrote: Hmm, pehaps adding it as a straight property in the config is not appropriate, so i tried adding it to the URL as such: property name=connection.urljdbc:h2:C:\journal\H2DB \HNDLDATA;IFEXISTS=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=5;BINDADDRESS=127.0.0.1/ property however, this throws the following error msg: org.h2.jdbc.JdbcSQLException: Unsupported connection setting BINDADDRESS. I guess this parameter cannot be set on the URL string like the other H2 params? So, how can I get this recognized? -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Re: BindAddress via JDBC
Ahhh, thank you Noel. I had conveniently (or inconveniently) forgotten that this was a JVM property when I read thru the documentation. Setting this directly as listed above just prior to creating my session object worked as advertised. Sometimes we just need someone to point out the obvious for us to see it. :) Thanks again -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
BindAddress via JDBC
I am having some trouble picking up the BindAddress property when building my connection using JDBC in a standalone Java Swing application. I'm guessing that I am not implementing it quite right and am looking for a little guidance. Below is a snippet from my hibernate config file and no frills session factory class. Everything works great except for enforcing the bindaddress. As my application must be able to function off-network, I cannot be bound to the company IP. I'm using v1.3.155 on an XPsp3 tablet. Any help is appreciated. hibernate-configuration session-factory property name=h2.bindAddress127.0.0.1/property property name=connection.driver_classorg.h2.Driver/property property name=connection.urljdbc:h2:C:\journal\H2DB \HNDLDATA;IFEXISTS=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=5/property property name=connection.username/property property name=password/property !--property name=hibernate.dialectorg.hibernate.dialect.H2Dialect/property -- property name=hibernate.dialectcom.merck.handel.model.dms.service.CustomH2Dialect/ property property name=defaultAutoCommittrue/property !-- configuration pool via c3p0-- property name=c3p0.acquire_increment1/property property name=c3p0.idle_test_period10/property !-- seconds -- property name=c3p0.max_size3/property property name=c3p0.max_statements10/property property name=c3p0.min_size1/property property name=c3p0.timeout60/property !-- seconds -- mapping resource=com/merck/handel/model/dms/domain/ UserSession.hbm.xml / mapping resource=com/merck/handel/model/dms/domain/ Jsample.hbm.xml / ( additional mappings removed ) /session-factory /hibernate-configuration session factoy class snippet --- /** * Configures and provides access to Hibernate sessions, tied to the * current thread of execution. Follows the Thread Local Session * pattern, see {@link http://hibernate.org/42.html }. */ public class HibernateSessionFactory { /** * Location of hibernate.cfg.xml file. * Location should be on the classpath as Hibernate uses * #resourceAsStream style lookup for its configuration file. * The default classpath location of the hibernate config file is * in the default package. Use #setConfigFile() to update * the location of the configuration file for the current session. */ private static String CONFIG_FILE_LOCATION = classpath:/H2/ hibernate.cfg.xml; private static final ThreadLocalSession threadLocal = new ThreadLocalSession(); private static Configuration configuration = new Configuration(); private static org.hibernate.SessionFactory sessionFactory; private static String configFile = CONFIG_FILE_LOCATION; static { try { configuration.configure(configFile); sessionFactory = configuration.buildSessionFactory(); } catch (Exception e) { System.err.println( Error Creating SessionFactory ); e.printStackTrace(); } } private HibernateSessionFactory() { } /** * Returns the ThreadLocal Session instance. Lazy initialize * the codeSessionFactory/code if needed. * * @return Session * @throws HibernateException */ public static Session getSession() throws HibernateException { Session session = (Session) threadLocal.get(); if (session == null || !session.isOpen()) { if (sessionFactory == null) { rebuildSessionFactory(); } session = (sessionFactory != null) ? sessionFactory.openSession() : null; threadLocal.set(session); } return session; } -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Re: BindAddress via JDBC
Hmm, pehaps adding it as a straight property in the config is not appropriate, so i tried adding it to the URL as such: property name=connection.urljdbc:h2:C:\journal\H2DB \HNDLDATA;IFEXISTS=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=5;BINDADDRESS=127.0.0.1/ property however, this throws the following error msg: org.h2.jdbc.JdbcSQLException: Unsupported connection setting BINDADDRESS. I guess this parameter cannot be set on the URL string like the other H2 params? So, how can I get this recognized? -- You received this message because you are subscribed to the Google Groups H2 Database group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.