h2

How to use H2 as embedded database in Postgres-compat mode, from jruby/rails

自古美人都是妖i 提交于 2019-12-06 10:48:55
问题 I'd like to launch a jruby/rails app to use Postgres. But I'd like to use H2 in Postgres compatibility mode when running in development and test. Its no problem bringing up the app in H2, or in postgresql, but how do I configure to run the postgresql adaptor, using an embedded H2 database? For example: something like this: database.yml development: # adapter: jdbch2 # database: db/development/database adapter: postgresql encoding: unicode database: database # driver: org.h2.Driver url: jdbc

Play! framwork: running `h2-browser` works, but the webpage is not available

坚强是说给别人听的谎言 提交于 2019-12-06 09:47:32
问题 When I run the command activator h2-browser it opens the browser with the following url: 192.168.1.17:8082 But I get (using Chrome): This webpage is not available The weird thing is it actually worked before. The only thing I changed since then is the JAVA_OPTS in order to enable debugging. I reinstalled Java and I think now there's no environment variable JAVA_OPTS . Anyway, why is it happening? Update What is even more weird is that when I press view-source I get a webpage with this

php接口安全设计浅谈

故事扮演 提交于 2019-12-06 08:02:05
php接口安全设计浅谈 接口的安全性主要围绕Token、Timestamp和Sign三个机制展开设计,保证接口的数据不会被篡改和重复调用,下面具体来看: (1)Token授权机制 :( Token是客户端访问服务端的凭证)-- 用户使用用户名密码登录后服务器给客户端返回一个Token( 通常是UUID ),并将Token-UserId以键值对的形式存放在缓存服务器中。服务端接收到请求后进行Token验证,如果Token不存在,说明请求无效。 (2)时间戳超时机制 :( 签名机制保证了数据不会被篡改 )用户每次请求都带上当前时间的时间戳timestamp,服务端接收到timestamp后跟当前时间进行比对,如果时间差大于一定时间( 比如5分钟 ),则认为该请求失效。 时间戳超时机制是防御DOS攻击的有效手段。 (3)签名机制 :将 Token 和 时间戳 加上其他请求参数再用MD5或SHA-1算法(可根据情况加点盐)加密,加密后的数据就是本次请求的签名sign,服务端接收到请求后以同样的算法得到签名,并跟当前的签名进行比对,如果不一样,说明参数被更改过,直接返回错误标识。 /** * @desc 接受参数处理 */ private function dealParam(){ //接受header参数--系统参数 $systemParam=getAllHeadersParam(); /

Hibernate H2 database relative path

陌路散爱 提交于 2019-12-06 07:29:49
I have an H2 database file calls "test.db". The file is located in my application directory: "myApp/resources/test.db". I'm not able to get this works for me.So, what's the correct way to refere to a relative path. Here is the configuration of my hibernate.cfg.xml. <property name="connection.driver_class">org.h2.Driver</property> <property name="connection.url">jdbc:h2:file:/test</property> <property name="connection.username">test</property> <property name="connection.password">1234</property> <!-- SQL dialect --> <property name="dialect">org.hibernate.dialect.H2Dialect</property> The error

Insert Java byte[] object into an H2 table and then retrieve it again

非 Y 不嫁゛ 提交于 2019-12-06 07:24:54
I'm trying to insert a Java byte[] into an H2 database table and then retrieve it again, but i am not achieving success. According to this page , the BINARY data type maps directly to a byte[]. So my understanding is i can write the byte[] variable directly to the column, but it is resulting in an exception when i try to retrieve it again. Here is a SSCCE that illustrates my problem. What am i doing wrong here? PS: You need to have an H2 database installed to run this code. package coza.modh.fxplatform.examples.bytearray; import javax.swing.*; import java.sql.Connection; import java.sql

Make Oracle last_day function be compatible with H2 database

我是研究僧i 提交于 2019-12-06 07:24:30
I am writing integration testing and I want to test my sql queries by using a H2 database. In production these queries are running against an Oracle database. I have to run this query I have tries to use the compatibility mode SELECT last_day(MY_CURRENT_DATE) from MY_TIME by using the oracle compatibility mode jdbc:h2:mem:default;MODE=Oracle;DB_CLOSE_DELAY=-1 but I receive this error: org.h2.jdbc.JdbcSQLException: Function "LAST_DAY" not found; SQL statement: SELECT last_day(MY_CURRENT_DATE) from MY_TIME [90022-176] It just seems that the compatibility mode does not cover the vendor-specific

docker swarm 修改集群ip

て烟熏妆下的殇ゞ 提交于 2019-12-06 07:20:56
概述 事情是这样的,我在树梅派上运行着docker swarm的集群原来的ip是192.168.0.113,之后因为搬家,然后ip变成了192.168.11.113,接着的事情大家肯定可以想出来,就是node和manager肯定连接不上了。所以我直接把node移出集群,然后重新加入,但是那时候的join token的命令是下面这样子的 ╰─➤ docker swarm join-token worker To add a worker to this swarm, run the following command: docker swarm join --token SWMTKN-1-0shhd0b7uwajhgymxgpp1nv5u17jvcup9vvmhnqkg77ds57e5h-57e7hvjaxaagxtxddz416q5z2 192.168.0.113:2377 当时我就直接把最后的ip修改为192.168.11.113这样把node加入集群,没错,的确可以加入,但是不知道为什么,node还是往192.168.0.113去连接,导致报错 ╰─➤ tail -f daemon.log 1 ↵ Jul 4 08:07:16 pi-slave dockerd[21221]: time="2018-07-04T08:07:16.316088897Z" level=info

How to fake ENUM columns in the H2 database for play unit testing?

本小妞迷上赌 提交于 2019-12-06 07:18:34
问题 I have a set of Play! unit tests that I have been running against an H2 database. I have added some enum columns to my model, and the tests now fail because of the sql statements used to create my model tables. The error message is: 14:42:10,435 ERROR ~ Unknown data type: "ENUM"; SQL statement: Some searching shows that there are ways to emulate enums in H2 (eg: http://groups.google.com/group/h2-database/search?group=h2-database&q=enum&qt_g=Search+this+group) Setting Play to use the H2Dialect

简易万年历案例

允我心安 提交于 2019-12-06 06:43:18
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 7 <title>Document</title> 8 <style type="text/css"> 9 /* 自行设置样式 */ 10 * {margin: 0;padding: 0;} 11 li {list-style: none;} 12 .calendar {width: 300px;border: 1px solid grey;margin: 20px auto;background: lightgrey;padding-bottom: 10px;} 13 .calendar ul {width: 280px;height: 310px;margin: 10px auto;overflow: hidden;} 14 .calendar ul li {width: 70px;height: 70px;border: 1px solid grey;float: left

Integrate H2 database with Android [closed]

南笙酒味 提交于 2019-12-06 05:11:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Is there any tutorial for integrating H2 database with Android and to start working on it? I'm searching for guide to do this. Thanks. 回答1: The Android documentation in H2 is the only documentation I know about. 来源: https://stackoverflow.com/questions/7204785/integrate-h2-database-with-android