h2

2019 SDN上机第4次作业

£可爱£侵袭症+ 提交于 2019-11-27 15:36:01
1.安装OpenDayLight控制器,启动并安装插件 2.用Python脚本搭建如下拓扑 代码如下: from mininet.topo import Topo class MyTopo(Topo): def __init__(self): # initilaize topology Topo.__init__(self) # add hosts and switches h1 = self.addHost('h1') h2 = self.addHost('h2') h3 = self.addHost('h3') s1 = self.addSwitch('s1') # add links self.addLink(h1, s1, 1, 1) self.addLink(h2, s1, 1, 2) self.addLink(h3, s1, 1, 3) topos = {'mytopo': (lambda: MyTopo())} pingall的结果: 3. ODL DLUX下发流表实现hardtimeout ODL内部设置: h2 ping h3: 实验结果:h2在20s内ping不通h3,20s后恢复 4.借助Postman调用ODL北向接口下发 安装postman,并直接解压,进入postman界面: 借助Postman,将JSON报文复制到Body内,将其Send

Spring Boot + Mybatis + Redis as L2cache

北战南征 提交于 2019-11-27 15:24:01
1.背景 Spring-Boot因其提供了各种开箱即用的插件,使得它成为了当今最为主流的Java Web开发框架之一。Mybatis是一个十分轻量好用的ORM框架。Redis是当今十分主流的分布式key-value型数据库,在web开发中,我们常用它来缓存数据库的查询结果。 本篇博客将介绍如何使用Spring-Boot快速搭建一个Web应用,并且采用Mybatis作为我们的ORM框架。为了提升性能,我们将Redis作为Mybatis的二级缓存。为了测试我们的代码,我们编写了单元测试,并且用H2内存数据库来生成我们的测试数据。通过该项目,我们希望读者可以快速掌握现代化Java Web开发的技巧以及最佳实践。 本文的示例代码可在Github中下载: https://github.com/JerryOrange/Spring-Boot-Mybatis-Redis-as-L2cache 2.Spring Boot 接下来,我们要编写Web API。假设我们的Web工程负责处理商家的产品(Product)。我们需要提供根据product id返回product信息的get接口和更新product信息的put接口。首先我们定义Product类,该类包括产品id,产品名称name以及价格price: public class Product implements Serializable { /

Start H2 database programmatically

北战南征 提交于 2019-11-27 15:11:04
问题 I'm coding a server-client application in Java and I need to implement a local database on the server side and I decided to go for H2 database engine. One more thing to add is that I usa TCP connection to start and run the database. This is what I put together so far: Class.forName("org.h2.Driver"); Server server = Server.createTcpServer(DB_PATH).start(); Connection currentConn = DriverManager.getConnection(DB_PATH, DB_USER, DB_PASSWORD); Where the connection string is jdbc:h2:tcp://localhost

Tomcat doesn't stop. How can I debug this?

孤者浪人 提交于 2019-11-27 14:56:42
I have a Tomcat 7 running in Linux that I start via $CATALINA_HOME/bin/startup.sh and shutdown via $CATALINA_HOME/bin/shutdown.sh from /etc/init.d All is ok except 1 problem. Sometimes tomcat does not stop. Although I stop it and I see in catalina.out logs that is going down, if I do ps -ef I can still see the process running. What could be the problem? How can I debug this? My feeling is, that this is related to threads. So the parts that are suspicious are the following: 1) I use Log4j's LogManager to detect if the log4j configuration has been changed, but I do Log4jManager.shutdown on a

h2 (embedded mode ) database files problem

假装没事ソ 提交于 2019-11-27 14:41:38
There is a h2-database file in my src directory (Java, Eclipse): h2test.db The problem: starting the h2.jar from the command line (and thus the h2 browser interface on port 8082), I have created 2 tables, 'test1' and 'test2' in h2test.db and I have put some data in them; when trying to access them from java code (JDBC), it throws me "table not found exception". A "show tables" from the java code shows a resultset with 0 rows. Also, when creating a new table ('newtest') from the java code (CREATE TABLE ... etc), I cannot see it when starting the h2.jar browser interface afterwards; just the

What is the proper way to close H2?

女生的网名这么多〃 提交于 2019-11-27 14:41:33
问题 This is related to this post. I think I am having problem with H2 meaning that it does not close properly. I suspect this since I see myDB.lock.db when I shutdown tomcat and the process does not stop. I use Tomcat's connection pooling and the url to the database is: url="jdbc:h2:file:/opt/myOrg/tomcat/webapps/MyApplication/db/myDatabase;SCHEMA=myschema" From the doc close H2: Usually, a database is closed when the last connection to it is closed.... By default, a database is closed when the

Start the H2 database in server mode via Spring

给你一囗甜甜゛ 提交于 2019-11-27 13:11:29
问题 I'm trying to start the H2 database in server mode (I want it to run in a different process) via Spring. Currently I'm using java Runnable.exec to start the h2 database (using the command: " java -cp h2.jar org.h2.tools.Server ") I know that there is a way to do it via Spring. I tried to add the following to the spring configuration, but it didn't work (it didn't start the H2 database): <bean id="org.h2.tools.Server" class="org.h2.tools.Server" factory-method="createTcpServer" init-method=

How to run H2 database in server mode?

偶尔善良 提交于 2019-11-27 11:29:02
How to start H2 database in server mode. I need to start it from my application.I tried the following code: server = Server.createTcpServer().start(); Here is the properties for the connection: javabase.jdbc.url = jdbc:h2:tcp://localhost:9092/nio:~/source/db/database/db;AUTO_SERVER=TRUE javabase.jdbc.driver = org.h2.Driver javabase.jdbc.username = sa javabase.jdbc.password = When I run the program I got the following error: client.db.exception.DAOException: org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process". Possible solutions: close all other connection

How in H2DB get sql dump like in MySql?

坚强是说给别人听的谎言 提交于 2019-11-27 11:25:37
I have some questions about H2DB. I have H2DB database which stores data in files, I have 3 files test.18.log.db, test.data.db, test.index.db. I want get sql dump file like when I use mysqldump. Is it possible? Yes, there are multiple solutions. One is to run the SCRIPT SQL statement : SCRIPT TO 'fileName' Another is to use the Script tool : java org.h2.tools.Script -url <url> -user <user> -password <password> Then, there are also the RUNSCRIPT statement and RunScript tool. By the way, you should consider upgrading to a more recent version of H2. With newer versions, the two files .data.db and

Can I have H2 autocreate a schema in an in-memory database?

旧街凉风 提交于 2019-11-27 10:54:36
(I've already seen the H2 database In memory - Init schema via Spring/Hibernate question; it is not applicable here.) I'd like to know if there's a setting in H2 that will allow me to auto-create a schema upon connecting to it. If it helps, I'm only interested in the in-memory case. H2 supports various semicolon-separated modifiers at the end of the URL, but I didn't find one for automatically creating a schema. Is there such a feature? Yes, H2 supports executing SQL statements when connecting . You could run a script, or just a statement or two: String url = "jdbc:h2:mem:test;" + "INIT=CREATE