h2

h2 mixed mode connection problem

六月ゝ 毕业季﹏ 提交于 2019-11-30 22:59:38
I start h2 database in a servlet context listener: public void contextInitialized(ServletContextEvent sce) { org.h2.Driver.load(); String apprealPath = sce.getServletContext().getRealPath("\\"); String h2Url = "jdbc:h2:file:" + apprealPath + "DB\\cdb;AUTO_SERVER=true"; LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); StatusPrinter.print(lc); logger.debug("h2 url : " + h2Url); try { conn = DriverManager.getConnection(h2Url, "sa", "sa"); } catch (SQLException e) { e.printStackTrace(); } logger.debug("h2 database started in embedded mode"); sce.getServletContext()

H2 database In memory - Init schema via Spring/Hibernate

故事扮演 提交于 2019-11-30 22:32:34
I have a Spring/Hibernate application with H2 database and I have a few issues with configuring H2 to run in an embedded mode (in memory): 1. I want spring to start the H2 database so I created the following Spring beans: <bean id="org.h2.tools.Server" class="org.h2.tools.Server" factory-method="createTcpServer" init-method="start" destroy-method="stop"> <constructor-arg value="-tcp,-tcpAllowOthers,true,-tcpPort,8043" /> </bean> <bean id="org.h2.tools.Server-WebServer" class="org.h2.tools.Server" factory-method="createWebServer" init-method="start"> <constructor-arg value="-web,-webAllowOthers

06-列表渲染-for.html

被刻印的时光 ゝ 提交于 2019-11-30 22:31:13
<div id="root"></div> <script src="./react.js"></script> <script src="./react-dom.js"></script> <script src="./babel.min.js"></script> <script type="text/babel"> var arr = ['aaa','nnnn','ccc'] //此时展开是没有标签得,希望套上标签 // const el=(<div>{arr}</div>) // var h2s=[] // for(var i=0;i<arr.length;i++){ // h2s.push(<h2>{arr[i]}</h2>) // //arr[i]要加{},否则不是变量,会显示3个arr[i] // // h2s.push(<h2>arr[i]</h2>) // } var h2s=arr.map(function(curVal,index){ return <h2>{curVal}</h2> }) //{}是支持map语句得,for循环是不支持得 const el=(<div>{h2s}</div>) ReactDOM.render(el,document.getElementById('root')) </script> 来源: https://www

05-jsx-{}数组自动展开.html

浪尽此生 提交于 2019-11-30 22:31:07
<div id="root"></div> <script src="./react.js"></script> <script src="./react-dom.js"></script> <script src="./babel.min.js"></script> <script type="text/babel"> var arr=[ <h2>hello</h2>, <h2>world</h2>, <h2>aa</h2>, ] //{}有把数组展开得作用 const el=<div>{arr}</div> //如果el=({arr})就不可以,jsx只能有一个顶层元素 //将el指定得元素渲染到id为root上 ReactDOM.render(el,document.getElementById('root')) </script> 来源: https://www.cnblogs.com/lucy-xyy/p/11643251.html

Confluence 6 嵌入的 H2 数据库

99封情书 提交于 2019-11-30 21:43:39
为了让你的 Confluence 在安装成功后就可以使用而不需要使用任何外部的数据库,Confluence 使用一个嵌入的 H2 数据库。 当你选择对 Confluence 进行评估和测试的时候,H2 数据库是默认被启用的。 嵌入的 H2 数据库存储在你 Confluence 的 home 目录中 <confluence-home>/database 。 嵌入 H2 数据库仅仅支持你对 Confluence 进行评估和测试,如果你决定将 Confluence 用作生产环境的话,你必须整合到 supported 外部数据库中。 希望找到你现在是否在使用嵌入的数据库,进入 > 基本配置( General Configuration) > 问题检查和支持工具(Troubleshooting and support tools) . https://www.cwiki.us/display/CONFLUENCEWIKI/Embedded+H2+Database 来源: oschina 链接: https://my.oschina.net/u/2344080/blog/1824204

How to start H2 TCP server on Spring Boot application startup?

我只是一个虾纸丫 提交于 2019-11-30 20:30:49
I'm able to start the H2 TCP server (database in a file) when running app as Spring Boot app by adding following line into the SpringBootServletInitializer main method: @SpringBootApplication public class NatiaApplication extends SpringBootServletInitializer { public static void main(String[] args) { Server.createTcpServer().start(); SpringApplication.run(NatiaApplication.class, args); } } But if I run the WAR file on Tomcat it doesn't work because the main method is not called. Is there a better universal way how to start the H2 TCP server on the application startup before beans get

convert unix timestamp to H2 timestamp

喜欢而已 提交于 2019-11-30 20:11:01
How do I convert unix timestamp value like 1348560343598 to H2 Timestamp ? One of my tables contains these unix timestamps in a BIGINT(19) column and I need to convert them to a column of type TIMESTAMP . Ok, using the following formula works: select DATEADD('SECOND', 1348560343, DATE '1970-01-01') Just remember to divide the timestamp with 1000. Using 'MILLISECOND' doesn't work, you will get Numeric value out of range . 来源: https://stackoverflow.com/questions/16012138/convert-unix-timestamp-to-h2-timestamp

Spring JavaConfig: Add mapping for custom Servlet

亡梦爱人 提交于 2019-11-30 19:49:07
In a javaconfig-based Spring 4.0 project, how can I add a mapping for a certain URL to a Servlet other than the Spring DispatcherServlet. Im my case I want to use h2console from H2 database which is provided through the servlet org.h2.server.web.WebServlet Edit: In the upcoming Spring Boot 1.3 the h2console can be enabled with a configuration parameter: http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-sql-h2-console Enabling it is as simple as adding these two lines to your application.properties : spring.h2.console.enabled=true spring.h2.console.path

Stored Procedure in H2 Database

喜你入骨 提交于 2019-11-30 19:26:57
I am new to database and recently started writing test cases for H2 database. I want to know how to test a stored procedure in Eclipse. I have seen the following: http://www.h2database.com/html/features.html#user_defined_functions How to CREATE PROCEDURE in H2 The sample code given in the h2database link, "CREATE ALIAS NEXT_PRIME AS $$ String nextPrime(String value) { return new BigInteger(value).nextProbablePrime().toString(); } $$; " Where should this be declared?and how to run it? PS - I have the H2 JAR file and am testing it. If someone can tell me how to write a simple stored procedure in

Spring + JUnit + H2 + JPA : Is it possible to drop-create the database for every test?

為{幸葍}努か 提交于 2019-11-30 19:09:14
To keep the independency between the JUnit tests, I need to create the database at the beginning of every test, and destroy it at the end of every test. The database should be created in memory ( H2 database ) by executing SQL queries that exist in a SQL file (Native insert queries...). Defining my keys-values in a properties file and respecting JPA specification (persistence.xml), how can I create-drop database for every JUnit test using annotations/injections? Thank you a lot! Will Keeling You should be able to use Spring's embedded database configuration to specify an H2 datasource (also