毕设错误3

今天在写毕设的时候,偶然出现了这个错误,如下:

1
2
Error executing DDL  via JDBC Statement

遇见错误后,我做了这些事:

  1. 检查MySQL版本。
  2. 打开MySQL的Line Command,将出错误的MySQL复制进MySQL Line Command,找到出错原因对应的错误码。
  3. 上网查询对应的出错信息,比对最初的错误信息。
Read more »

开始使用

使用Vue.js

  1. 下载
    Vue.js官网将其下载至本地,通过script 标签引入。

    1
    <script src="js/vue.js"></script>
  2. 使用npm
    npm 是一个非常有用的JavaScript 包管理工具,通过npm 可以非常迅速地使用、安装和升级Vue.js 。

    1
    2
    3
    4
    // 安装
    npm install --global vue-cli
    // 测试
    vue -V
  3. 使用CDN
    这里推荐使用Bootstrap 的CDN 加速服务,地址为https://www.bootcdn.cn

    1
    <script src="https://cdn.bootcss.com/vue/2.6.10/vue.common.dev.js"></script>

    注:关于Vue的读法(读音 /vjuː/,类似于 view)。

Read more »

毕设错误1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server:
port: 8080

spring:
thymeleaf:
cache: false
prefix: classpath:/templates/
suffix: .html
encoding: UTF-8
servlet:
content-type: text/html
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/human
username: root
password: root
jpa:
hibernate:
ddl-auto: update
show-sql: true

Read more »

毕设错误2

下面这个真的是让我一头雾水,翻译了之后才理解,原来是在新版的com.mysql.jdbc.Driver这个已经被替换了,现在开始使用com.mysql.cj.jdbc.Driver,因此就要给MySQL服务器设置时区。
所以才有了接下里的错误:

1
2
java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. 
You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
Read more »

如题目所属,这是我遇到的问题,以此记录一下,不说上异常:

1
2
3
4
5
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'persistenceExceptionTranslationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfiguration.class]: Initialization of bean failed;
nested exception is java.lang.IllegalStateException:
No persistence exception translators found in bean factory.
Cannot perform exception translation.

这个是在我写练习Demo时遇到的错误,经过反复的琢磨之后,才发现,是在引入Dubbo时,由Dubbo引入的Spring包与SpringBoot引入的Spring包发生了冲突,所以修改pom.xml文件,

Read more »

1. 冒泡排序

1. 原理

临近的数字两两进行比较,按照从小到大或者从大到小的顺序进行交换,这样一趟过去后,最大或最小的数字被交换到了最后一位,然后再从头开始进行两两比较交换,直到倒数第二位时结束,其余类似看例子例子为从小到大排序。

Read more »

Git作为一种分布式的代码管理工具,在github上的代码管理都需要在本地配置对应的SSH key密钥,这样才能推送代码。

设置Git的username和email

1
2
$ git config --global user.name "YOUR USERNAME"
$ git config --global user.email "YOUR EMAIL"
Read more »

1. 第一个版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.util.*;
import java.math.*;

//寻找阿姆斯特朗数
public class LookforNumber
{

public Scanner scanner = new Scanner(System.in);

public static void main(String[] args){
LookforNumber ln = new LookforNumber();
ln.number();
}

public void number(){//计算三位,四位,五位的阿姆斯特朗数
System.out.println("这是在求阿姆斯特朗数(n=3时,为水仙花数):");
System.out.println("请输入要求数的位数:");
int n = scanner.nextInt();
int a=0,b=0,c=0,d=0,e=0;
int x = (int)Math.pow(10,n-1);
int y = (int)Math.pow(10,n);
for(;x<y;x++){
for(int z=1;z<=n;z++){
switch(z){
case 1 : a = x/(int)Math.pow(10,n-z);break;
case 2 : b = x/(int)Math.pow(10,n-z)%10;break;
case 3 : c = x/(int)Math.pow(10,n-z)%10;break;
case 4 : d = x/(int)Math.pow(10,n-z)%10;break;
case 5 : e = x/(int)Math.pow(10,n-z)%10;break;
default : break;
}
}
if(x == (int)Math.pow(a,n)+(int)Math.pow(b,n)+(int)Math.pow(c,n)
+(int)Math.pow(d,n)+(int)Math.pow(e,n)){
System.out.print(x + " ");
}
}
System.out.println();
System.out.println("上述都是阿姆斯特朗数。");
}
}
Read more »

Hibernate

使用HibernateORM需要引入以下的包:

1
2
spring-boot-starter-data-jpa
mysql-connector-java

下面是Hibernate的详细配置信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#数据库使用的驱动类
hibernate.connection.driver_class=com.mysql.jdbc.Driver
#数据库连接地址
hibernate.connection.url=jdbc:mysql://localhost:3306/db
#数据库连接的用户名
hibernate.connection.username=user
#数据库连接的密码
hibernate.connection.password=password
#使用JNDI数据源连接数据库 -> 请看下一个JNDI配置
hibernate.connection.datasource=java:comp/env/jdbc/TestDb
#数据库使用的方言,将操作转为对应的SQL语句
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
#是否打印SQL语句
hibernate.show_sql=true
javax.persistence.validation.mode=none
#在 log 和 console 中打印出更漂亮的 SQL语句
hibernate.format_sql=true
#设置在Hibernate数据库连接池中的连接数量,这里我们一般使用c3p0连接池
hibernate.connection.pool_size=3

Read more »