h2

简易万年历

跟風遠走 提交于 2019-11-28 13:36:54
简易万年历这个案例是比较有意义的,虽然是个小demo,但涵盖的知识是一点也不少啊!需要静下心来好好理解,完全理解下来,就会觉得也没那么难,理解了这个demo,后续很多东西都知道怎么写了。好啦,先上HTMl部分的代码。 1 <body> 2 <div id="tab" class="calendar"> 3 <ul id="box"> 4 <li class="active"> 5 <h2>1</h2> 6 <p>JAN</p> 7 </li> 8 <li> 9 <h2>2</h2> 10 <p>FER</p> 11 </li> 12 <li> 13 <h2>3</h2> 14 <p>MAR</p> 15 </li> 16 <li> 17 <h2>4</h2> 18 <p>APR</p> 19 </li> 20 <li> 21 <h2>5</h2> 22 <p>MAY</p> 23 </li> 24 <li> 25 <h2>6</h2> 26 <p>JUN</p> 27 </li> 28 <li> 29 <h2>7</h2> 30 <p>JUL</p> 31 </li> 32 <li> 33 <h2>8</h2> 34 <p>AUG</p> 35 </li> 36 <li> 37 <h2>9</h2> 38 <p>SEP</p> 39 </li> 40 <li> 41 <h2>10<

Generate UUID values by default for each row on column of UUID type in H2 Database Engine

妖精的绣舞 提交于 2019-11-28 11:34:21
In the H2 database , on a table with a column of UUID data type , how do we specify that we want H2 to generate a UUID value by default when an INSERT omits that field? I know how to generate a UUID . I have read the Question, How to insert a specific UUID in h2 database? . My question is about how to ask H2 to generate the UUID value on my behalf. Thomas Mueller You can use built-in function RANDOM_UUID() : create table test(id int primary key, data uuid default random_uuid()); insert into test(id) values(1); select * from test; Note that using the UUID (or any other randomly generated data)

js中的经典案例--简易万年历

寵の児 提交于 2019-11-28 10:02:52
js中的经典案例--简易万年历 html代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style type="text/css"> * { padding: 0; margin: 0; } li { list-style: none; } body { background: #f6f9fc; font-family: arial; } .calendar { width: 210px; margin: 0 auto; padding: 10px 10px 20px 20px; background: #eae9e9; } .calendar ul { width: 210px; overflow: hidden; padding-bottom: 10px; } .calendar li { float: left; width: 58px; height: 54px; margin: 10px 10px 0 0;

Why is my embedded h2 program writing to a .mv.db file

寵の児 提交于 2019-11-28 09:35:46
I followed the quickstart guide on the h2 database website to create a new database a table and insert some data. The application runs smooth and can read and write to the database without problems. Quickstart h2 Add the h2*.jar to the classpath (H2 does not have any dependencies) Use the JDBC driver class: org.h2.Driver The database URL jdbc:h2:~/test opens the database test in your user home directory A new database is automatically created Now i want to look at the data with the web-frontend h2 console but everytime I try to open my database it just creates a new database. After a long

Store pictures in H2 database spring boot thymleaf

萝らか妹 提交于 2019-11-28 07:17:49
问题 Good day. I want to store an image in an h2 database, then retrieve and display the same image in an html page. I am using spring boot and file upload method, but I am getting errors in the binding results Here are the pages/classes: Category.java package com.vishal.project.entities; @Entity @Table(name="category") public class Category implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy= GenerationType.IDENTITY) @Column(name="ID") private

Why we need a connection pooling for JDBC? [closed]

巧了我就是萌 提交于 2019-11-28 06:29:28
What are the benefits of using a JDBC connection pooling tool like DBCP or c3p0 ? in case of a small CRUD application with one user, can we just create one connection session as a singleton ? PS : I'm building a small javafx application back-ended with tiny h2 database (5 tables). 0x6C38 From Jon Skeet's answer to What is the benefit of Connection and Statement Pooling? : Creating a network connection to a database server is (relatively) expensive. Likewise asking the server to prepare a SQL statement is (relatively) expensive. Using a connection/statement pool, you can reuse existing

insert a BLOB via a sql script?

只愿长相守 提交于 2019-11-28 04:31:31
I have an H2 database ( http://www.h2database.com ) and I'd like to insert a file into a BLOB field via a plain simple sql script (to populate a test database for instance). I know how to do that via the code but I cannot find how to do the sql script itself. I tried to pass the path , i.e. INSERT INTO mytable (id,name,file) VALUES(1,'file.xml',/my/local/path/file.xml); but this fails. Within the code (java for instance), it's easy to create a File object and pass that in, but directly from a sql script, I'm stuck... Any idea ? David For testing, you can insert literal hex bytes or use the

Executing script file in h2 database

大兔子大兔子 提交于 2019-11-28 03:54:13
First of all I would like to say am new to h2 database. I need to execute a sql script file in h2 database. I have a script file test.sql and I want to execute this in h2 database. Is it possible? You can use the RUNSCRIPT SQL statement : RUNSCRIPT FROM 'test.sql' or you can use the RunScript standalone / command line tool : java -cp h2*.jar org.h2.tools.RunScript -url jdbc:h2:~/test -script test.sql You can also use the RunScript tool within an application: RunScript.execute(conn, new FileReader("test.sql")); If you are using spring-boot and spring-test with H2 it will automatically look for

View content of embedded H2 database started by Spring

馋奶兔 提交于 2019-11-28 03:27:36
I would like to view in a web browser the content of the H2 database started by Spring thanks to the following configuration: <jdbc:embedded-database id="dataSource" type="H2" /> <jdbc:initialize-database data-source="dataSource"> <jdbc:script location="classpath:db/populateDB.sql"/> </jdbc:initialize-database> I searched for the JDBC URL in the logs: DEBUG o.s.j.d.SimpleDriverDataSource - Creating new JDBC Driver Connection to [jdbc:h2:mem:dataSource;DB_CLOSE_DELAY=-1] So that I could fill the connection form as follows: But unfortunately, the db is still empty, whereas it shouldn't due to