老师,你的截图的工具很方便呀!叫啥子名字呀?
老师,为什么我的HR用户下没有employees表,却仍然可以做相应数据的查询
老师,这个怎么弄,可以直接忽略掉吗?不知道咋办
老师,一个数据库可以有多个标识吗?还是你新建的netorcl是一个新的数据库吗?
我现在直接登陆不上去了,不知道什么原因。。。。。。。。。。。。。。。
请问老师,本地网络服务配置的意思是自己连自己的吗,然后那个system的密码是多少。我总是测试失败
请问老师这个工具主要是用来解决什么问题呢
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/bjsxt?useUnicode=true&characterEncoding=utf-8", "root", "root"); String sql = "insert into departments values(default,'" + department_name + "'," + location_id + ")"; state = conn.createStatement(); int flat = state.executeUpdate(sql); System.out.println(flat); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if (state != null) { try { state.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } //更新Departments public void updateDempartments(String department_name, int location_id, int department_id) { Connection conn = null; Statement state = null; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://localhost: 3306/bjsxt?useUnicode=true&characterEncoding=utf-8", "root", "root"); state = conn.createStatement(); String sql = "update departments d set d.department_name = '" + department_name + "',d.location_id = " + location_id + " where d.department_id =" + department_id; int flag = state.executeUpdate(sql); System.out.println(flag); } catch (Exception e) { e.printStackTrace(); } finally { if (state != null) { try { state.close(); } catch (SQLException e) { e.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } } public static void main(String[] args) { jdbcTest test = new jdbcTest(); // test.insertDepartments("研发部", 8); test.updateDempartments("教学部", 6, 6); } }
import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class jdbcTest { 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/bjsxt?useUnicode=true&characterEncoding=utf-8", "root", "root"); 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 e) { e.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } } public static void main(String[] args) { jdbcTest test = new jdbcTest(); test.insertDepartments("研发部", 8); } }
插入的是研发部,location_id为8,但是插入进去就不对了,不管插入什么进去之后都是显示这样
老师 properties 文件只能创建在src下
我发现创建在 com.bjsxt包下面读不到
老师,不是说department id是主键吗,但是我的数据库并没有进行索引扫描,而是全表扫描
老师,存不存在是主键,且会返回多行数据,那数据库会进行唯一扫描还是多行扫描呢
老师,table access by index rowid 是通过rowid来查询,table access by index scan 也是得到对应的rowid进行查询,这两个方式不是一样的吗,都是通过rowid进行查询。还是说,前面的是表的rowid,后面的是生成索引的表的rowid?
对照了同样问题的同学,依然无法找到原因,麻烦老师看看源代码有什么问题。
jdbcDemo.rar
老师,我的Oracle中没有这个配置文件,可能是安装的时候出了点问题,暂时不配置这个 本地网络服务配置对后续课程有影响吗?
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637