mysql: The target table of the UPDATE is not updatable

目标是批量更新目标表部分字段的数据
操作内容:
1.创建临时表

drop table if exists tempTableXXX 
create table tempTableXXX ( TEMP_ID int not null, BM  varchar(14) )

2.把数据存入临时表
3.把临时数据中的数据存入目标表

update targetTableXXX ,(select * from tempTableXXX ) b set BM=b.BM where b.TEMP_ID=targetTableXXX.ID

4.删除临时表

drop table if exists tempTableXXX 

出现问题:

The target table of the UPDATE is not updatable

原因是update的字段在targetTableXXX中不存在=.=

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Java 核心技术 卷1 Index Chapter 1: An Introduction to Java 1 Java As a Programming Platform 2 The Java “White Paper” Buzzwords 2 Java Applets and the Internet 7 A Short History of Java 9 Common Misconceptions about Java 11 Chapter 2: The Java Programming Environment 15 Installing the Java Development Kit 16 Choosing a Development Environment 21 Using the Command-Line Tools 22 Using an Integrated Development Environment 25 Running a Graphical Application 28 Building and Running Applets 31 Chapter 3: Fundamental Programming Structures in Java 35 A Simple Java Program 36 Comments 39 Data Types 40 Variables 44 Operators 46 Strings 53 Input and Output 63 Control Flow 71 Big Numbers 88 Arrays 90 Chapter 4: Objects and Classes 105 Introduction to Object-Oriented Programming 106 Using Predefined Classes 111 Defining Your Own Classes 122 Static Fields and Methods 132 Method Parameters 138 Object Construction 144 Packages 15 The Class Path 160 Documentation Comments 162 Class Design Hints 167 Chapter 5: Inheritance 171 Classes, Superclasses, and Subclasses 172 Object: The Cosmic Superclass 192 Generic Array Lists 204 Object Wrappers and Autoboxing 211 Methods with a Variable Number of Parameters 214 Enumeration Classes 215 Reflection 217 Design Hints for Inheritance 238 Chapter 6: Interfaces and Inner Classes 241 Interfaces 242 Object Cloning 249 Interfaces and Callbacks 255 Inner Classes 258 Proxies 275 Chapter 7: Graphics Programming 281 Introducing Swing 282 Creating a Frame 285 Positioning a Frame 288 Displaying Information in a Component 294 Working with 2D Shapes 299 Using Color 307 Using Special Fonts for Text 310 Displaying Images 318 Chapter 8: Event Handling 323 Basics of Event Handling 324 Actions 342 Mouse Events 349 The AWT Event Hierarchy 357 Chapter 9: User Interface Components with Swing 361 Swing and the Model-View-Controller Design Pattern 362 Introduction to Layout Management 368 Text Input 377 Choice Components 385 Menus 406 Sophisticated Layout Management 424 Dialog Boxes 452 Chapter 10: Deploying Applications and Applets 493 JAR Files 494 Java Web Start 501 Applets 516 Storage of Application Preferences 539 Chapter 11: Exceptions, Logging, Assertions, and Debugging 551 Dealing with Errors 552 Catching Exceptions 559 Tips for Using Exceptions 568 Using Assertions 571 Logging 575 Debugging Tips 591 Using a Debugger 607 Chapter 12: Generic Programming 613 Why Generic Programming? 614 Definition of a Simple Generic Class 616 Generic Methods 618 Bounds for Type Variables 619 Generic Code and the Virtual Machine 621 Restrictions and Limitations 626 Inheritance Rules for Generic Types 630 Wildcard Types 632 Reflection and Generics 640 Chapter 13: Collections 649 Collection Interfaces 650 Concrete Collections 658 The Collections Framework 689 Algorithms 700 Legacy Collections 707 Chapter 14: Multithreading 715 What Are Threads? 716 Interrupting Threads 728 Thread States 730 Thread Properties 733 Synchronization 736 Blocking Queues 764 Thread-Safe Collections 771 Callables and Futures 774 Executors 778 Synchronizers 785 Threads and Swing 794 Appendix 809 Index 813 Java 核心技术 卷2 Index Chapter 1: Streams and Files 1 Streams 2 Text Input and Output 11 Reading and Writing Binary Data 23 ZIP Archives 32 Object Streams and Serialization 39 File Management 59 New I/O 65 Regular Expressions 75 Chapter 2: XML 87 Introducing XML 88 Parsing an XML Document 93 Validating XML Documents 105 Locating Information with XPath 129 Using Namespaces 136 Streaming Parsers 138 Generating XML Documents 146 XSL Transformations 157 Chapter 3: Networking 169 Connecting to a Server 170 Implementing Servers 177 Interruptible Sockets 184 Sending E-Mail 191 Making URL Connections 196 Chapter 4: Database Programming 217 The Design of JDBC 218 The Structured Query Language 222 JDBC Configuration 227 Executing SQL Statements 232 Query Execution 242 Scrollable and Updatable Result Sets 254 Row Sets 260 Metadata 263 Transactions 273 Connection Management in Web and Enterprise Applications 278 Introduction to LDAP 279 Chapter 5: Internationalization 297 Locales 298 Number Formats 303 Date and Time 310 Collation 318 Message Formatting 324 Text Files and Character Sets 328 Resource Bundles 329 A Complete Example 333 Chapter 6: Advanced Swing 351 Lists 352 Tables 370 Trees 405 Text Components 442 Progress Indicators 479 Component Organizers 492 Chapter 7: Advanced AWT 521 The Rendering Pipeline 522 Shapes 524 Areas 540 Strokes 542 Paint 550 Coordinate Transformations 552 Clipping 557 Transparency and Composition 559 Rendering Hints 568 Readers and Writers for Images 575 Image Manipulation 585 Printing 601 The Clipboard 635 Drag and Drop 652 Platform Integration 668 Chapter 8: Javabeans Components 685 Why Beans? 686 The Bean-Writing Process 688 Using Beans to Build an Application 690 Naming Patterns for Bean Properties and Events 698 Bean Property Types 701 BeanInfo Classes 710 Property Editors 713 Customizers 723 JavaBeans Persistence 732 Chapter 9: Security 755 Class Loaders 756 Bytecode Verification 767 Security Managers and Permissions 771 User Authentication 790 Digital Signatures 805 Code Signing 822 Encryption 828 Chapter 10: Distributed Objects 841 The Roles of Client and Server 842 Remote Method Calls 845 The RMI Programming Model 846 Parameters and Return Values in Remote Methods 856 Remote Object Activation 865 Web Services and JAX-WS 871 Chapter 11: Scripting, Compiling, and Annotation Processing 883 Scripting for the Java Platform 884 The Compiler API 895 Using Annotations 905 Annotation Syntax 911 Standard Annotations 915 Source-Level Annotation Processing 919 Bytecode Engineering 926 Chapter 12: Native Methods 935 Calling a C Function from a Java Program 936 Numeric Parameters and Return Values 942 String Parameters 944 Accessing Fields 950 Encoding Signatures 954 Calling Java Methods 956 Accessing Array Elements 962 Handling Errors 966 Using the Invocation API 970 A Complete Example: Accessing the Windows Registry 975 Index 991
package cn; import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*; //登陆面板 public class Login extends JFrame { Connection conn = null; Statement stmt = null; ResultSet rst = null; public Login() { try { Class.forName("com.mysql.jdbc.Driver"); System.out.println("加载驱动成功。"); String url = "jdbc:mysql://localhost/users"; String user = "root"; String password = "123456"; conn = DriverManager.getConnection(url, user, password); System.out.println("连接数据库成功。"); stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); rst = stmt.executeQuery("SELECT*FROM user"); } catch (Exception e) { System.out.println(e); } setTitle("登陆页面"); JPanel panel = new JPanel(); //JLabel lblName = new JLabel("用户名:"); JTextField txtName = new JTextField(10); //lblName.setHorizontalAlignment(JLabel.CENTER); panel.add(new JLabel("用户名:")); panel.add(txtName); JLabel lblPassword = new JLabel("密码:"); JPasswordField txtPassword = new JPasswordField(10); lblPassword.setHorizontalAlignment(JLabel.CENTER); panel.add(lblPassword); panel.add(txtPassword); add(panel, BorderLayout.CENTER); JPanel panel2 = new JPanel(); JButton btnLogin = new JButton("登陆"); /** * 给登陆按钮添加监听事件 当按钮被点击时时间被触发 */ btnLogin.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean b = false; // boolean b = um.Login(txtName.getText(), txtPassword.getText()); try { stmt = conn.createStatement();// 预定义语句 // 数据库查询语句(根据用户名和密码) String sql = "select * from user where User='" + txtName.getText() + "' and Password='" + txtPassword.getText() + "'"; rst = stmt.executeQuery(sql);// 执行查询语句 // rst中有数据,则将标记改为true if (rst.next()) { b = true; } } catch (SQLException e1) { e1.printStackTrace(); } if (b) {// 登陆成功,跳转页面 JOptionPane.showMessageDialog(null, "登陆成功!"); new ProductQueryDemo();// 打开主页 dispose();// 关闭窗口 } else {// 登陆失败 JOptionPane.showMessageDialog(null, "登陆失败!"); } } }); JButton btnReset = new JButton("重置"); /** * 点击重置按钮时,将文本框中的值设置为空 */ btnReset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtName.setText(""); txtPassword.setText(""); } }); JButton btnSignin = new JButton("注册"); /** * 点击注册按钮时,调用注册程序 */ btnSignin.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new Signin(); dispose();// 关闭窗口 } }); panel2.add(btnLogin); panel2.add(btnReset); panel2.add(btnSignin); add(panel2, BorderLayout.PAGE_END); setSize(430, 150); setLocationRelativeTo(null); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] args) { new Login(); } }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值