警告:不建议在没有服务器身份验证的情况下建立SSL连接。根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果不设置显式选项,默认必须建立SSL连接。为了符合现有的不使用SSL的应用程序,verifyServerCertificate属性被设置为'false'。您需要通过设置useSSL=false显式禁用SSL,或者设置useSSL=true并为服务器证书验证提供信任存储区。这个是啥意思呢
请问Oracle登入用户不区分大小写吗?
怎么删除不了表的·······啥情况????????????????????????????????????
删除命令不commit 也恢复不了么?也需要数据恢复? 数据恢复属于硬件么?什么原理?有资料么?
程序运行成功,但是数据库没有添加到数据
1:代码
package sxt.com; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class JdbcTest { //向departments表添加一条数据 public void insertDepartments(String department_name,int location_id){ Connection conn = null; Statement state = null; //驱动注册 try { Class.forName("com.mysql.jdbc.Driver"); //创建链接 conn =DriverManager.getConnection("jdbc:mysql://localhost:3306/sxt?useUnicode=true&characterEncoding=utf-8&useSSL=false","root","2020"); //执行sql String sql = "insert into departments values(default,'"+department_name+"',"+location_id+")"; state = conn.createStatement(); int flag = state.executeUpdate(sql); System.out.println(flag); } catch (Exception e) { e.printStackTrace(); }finally { if (state != null){ try { state.close(); } catch (SQLException throwables) { throwables.printStackTrace(); }finally { } } } if (conn != null){ try { conn.close(); } catch (SQLException throwables) { throwables.printStackTrace(); } } } public static void main(String[] args) { JdbcTest test = new JdbcTest(); test.insertDepartments("研发部",8); } } 2:运行
3:数据库:
分页查询的rownum吧
老师 这个每一行都黏在一起了 是什么问题。。 显示不全
老师,case函数的参数类型要一致,decode函数要一致吗
{ = ; = ; (username,userage){ { create(); = +username++userage+; = .execute(); ..println(); }(e){ e.printStackTrace(); }{ close(); } } (userid,username,userage){ { create(); = +username++userage++userid; = .executeUpdate(); ..println(); }(e){ e.printStackTrace(); }{ close(); } } (){ .(,); } (){ = .(); { = .createStatement(); } (e) { RuntimeException(e); } } }
可以这么写吗?我运行成功了
为啥我这个登录了HR不一样,没变化,table里的内容不一样
出现了跟上面的同学一样的问题 无法初始化类,还有这个文件创建成功的图标一定是绿色的 P 吗
sql里的单引号和双引号用法区别呢???????
public class StatmentTest { /** * 添加用户 */ private Connection connection = null; private Statement statement = null; public void insertUsers(String username,int userage){ try{ create(); //定义需要执行的SQL语句 String sql = "insert into users values(default,'"+username+"',"+userage+")"; //执行SQL,返回boolean类型值,如果SQL有结果集返回,那么返回值为true,如果没有返回值则返回false boolean execute = statement.execute(sql); System.out.println(execute); }catch (Exception e){ e.printStackTrace(); }finally { close(); } } /** * 修改用户信息 */ public void updateUsers(int userid,String username,int userage){ try{ create(); //定义SQL语句 String sql = "update users set username = '"+username+"',userage="+userage+" where userid="+userid; //执行SQL语句 int i = statement.executeUpdate(sql); System.out.println(i); }catch (Exception e){ e.printStackTrace(); }finally { close(); } } private void close(){ JdbcUtils.closeResource(statement,connection); } private void create(){ //获取Connection对象 connection = JdbcUtils.getConnection(); //获取Statement对象 try { statement = connection.createStatement(); } catch (SQLException e) { throw new RuntimeException(e); } } } //可以这么写吗?运行成了,就是不知道有没有别的问题。
老师这里的int的长度为何是11啊?系统自动给的,我看了int的数值范围后,理解不了这个位置。
运行的时候成功了但是表里没加上数据
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637