小编Sac*_*hin的帖子

通过JDBC在Oracle中选择和更新一百万行的性能很差

我有一个超过100万行的用户表(Oracle 11g数据库),其中包含纯文本的所有用户密码,我试图使用SHA512算法(哈希和盐)进行哈希.从下面开始是我的Java类从用户表读取所有记录,哈希并更新回用户表.

  • 我正在为SELECTUPDATE查询使用预准备语句
  • 我已将准备好的语句提取大小设置为1000(setFetchSize(1000))
  • 我已将auto commit属性设置为false
  • 使用批处理方法进行批量更新
try {
    ps = con.prepareStatement("update user set password=? where ID=?");
    psSel = con.prepareStatement("select ID, password from user");
    psSel.setFetchSize(1000);
    rs = psSel.executeQuery();
    String hashPassword = null;
    while (rs.next()) {
        long id = rs.getLong(1);
        String pwd = rs.getString(2);
        hashPassword = <<CALL TO PASSWORD HASHING UTIL>>;
        ps.setString(1, hashPassword);
        ps.setLong(2, id);
        ps.addBatch();

      //Every 5000 records update and commit
        if(++count % batchSize == 0) {
            ps.executeBatch();
            con.commit();
        }

    }
    ps.executeBatch();
    con.commit();
} …
Run Code Online (Sandbox Code Playgroud)

java oracle jdbc oracle11g batch-processing

5
推荐指数
1
解决办法
1166
查看次数

用于演示 spring-boot 项目的 mvnw.cmd 无法在 Windows 中工作

2.3.0从 Spring Initializr 到我的 Windows8.1操作系统生成了一个简单的演示项目(版本),下面是基本结构

\n\n
C:.\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80src\n    \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80main\n    \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80java\n    \xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80com\n    \xe2\x94\x82   \xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80example\n    \xe2\x94\x82   \xe2\x94\x82           \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80demo\n    \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80resources\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80test\n        \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80java\n            \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80com\n                \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80example\n                    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80demo\n
Run Code Online (Sandbox Code Playgroud)\n\n

我尝试运行mvnw.cmd clean并收到以下错误:

\n\n
C:\\Users\\Downloads\\demo\\demo>mvnw.cmd clean\n"}" was unexpected at this time.\n
Run Code Online (Sandbox Code Playgroud)\n\n

下面是 powershell 中的相同输出

\n\n
PS C:\\Users\\Downloads\\demo\\demo> .\\mvnw.cmd clean\n"}" was unexpected at this time.\nPS C:\\Users\\Downloads\\demo\\demo>\n
Run Code Online (Sandbox Code Playgroud)\n\n

我发现问题发生在mvnw.cmd文件中的以下几行中:

\n\n
powershell -Command "&{"^\n    "$webclient = new-object System.Net.WebClient;"^\n    "if (-not ([string]::IsNullOrEmpty(\'%MVNW_USERNAME%\') -and [string]::IsNullOrEmpty(\'%MVNW_PASSWORD%\'))) {"^\n    "$webclient.Credentials = new-object System.Net.NetworkCredential(\'%MVNW_USERNAME%\', …
Run Code Online (Sandbox Code Playgroud)

spring-boot spring-initializr maven-wrapper

5
推荐指数
1
解决办法
2095
查看次数