想问一下这里的<all与 在子函数当中直接求出其工作岗位IT_PROG下的最低薪水 的写法有区别吗?
也就是说 < all是否和max函数可以等价呢?
老师,为啥我这里修改了 中文 读出来还是乱码呢?
老师,这个异常怎么改
public class JDBCtest06 { public void run(String login_name,String login_pwd) { Connection conn = null; Statement stat = null; try { //注册驱动 Class.forName("com.mysql.jdbc.Driver"); //创建链接; conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/text2?useUnicode=true&characterEncoding=utf-8", "root", "123456"); String sql = "insert into t_user(login_name,login_pwd) values('"+login_name+"','"+login_pwd+"');"; //获取数据库操作对象,发送执行sql语句的对象 stat = conn.createStatement(); int re = stat.executeUpdate(sql); System.out.println(re); System.out.println(conn); } catch (Exception e) { e.printStackTrace(); } finally { if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } if (stat != null) { try { stat.close(); } catch (SQLException e) { e.printStackTrace(); } } } } public static void main(String[] args) { JDBCtest06 text=new JDBCtest06(); text.run(dd,ee);//这个dd,ee为什么会报错? } }
jdbcUtil
package com.bjsxt; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.util.ResourceBundle; /** * JDBC工具类 */ public class jdbcUtil { private static String driver ; private static String jdbcUrl ; private static String username ; private static String userpassword ; static { //读取properties文件 ResourceBundle bundle = ResourceBundle.getBundle("jdbc"); driver = bundle.getString("driver"); jdbcUrl=bundle.getString("jdbcUrl"); username=bundle.getString("username"); userpassword=bundle.getString("userpassword"); //驱动注册 try { Class.forName(driver); } catch (ClassNotFoundException e) { e.printStackTrace(); } } //获取Connection对象 public static Connection getConnection(){ Connection conn = null; //创建连接 try { conn = DriverManager.getConnection(jdbcUrl,username,userpassword); } catch (SQLException e) { e.printStackTrace(); } return conn; } //关闭statement public static void closeStatement(Statement state){ if (state != null){ try { state.close(); } catch (SQLException e) { e.printStackTrace(); } } } //关闭connection public static void closeConnection(Connection conn){ if(conn != null){ try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } }
jdbcTset
package com.bjsxt; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class jdbcTest { //向department添加一条数据 public void insertDepartments(String department_name, int location_id){ Connection conn = null; Statement state = null; try { //驱动注册 //创建连接 conn = jdbcUtil.getConnection(); 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 { jdbcUtil.closeStatement(state); jdbcUtil.closeConnection(conn); } } //更新数据 public void updateDepartments (String department_name,int location_id,int department_id){ Connection conn = null; Statement state = null; try{ conn = jdbcUtil.getConnection(); 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 { jdbcUtil.closeStatement(state); jdbcUtil.closeConnection(conn); } } public static void main(String[] args) { jdbcTest test = new jdbcTest(); //test.insertDepartments("研发部",8); test.updateDepartments("研发部4",6,3); //test.insertDepartments("教学部",9); } }
properties中
driver=com.mysql.jdbc.Driver jdbcUrl=jdbc:mysql://localhost:3306/bjsxt?useUnicode=true&characterEncoding=utf-8 username=root userpassword=niehan
看不出来是什么原因 为什么提示未连接呢?
底下同学的授权问题:
把密码那一段删了就行
为啥不对呀?
老师 ping不通192.168.1.129怎么办
老师,通配符‘?’不是表示出现0次或1次吗?那以下sql语句为什么会有两次的出现
SELECT e.last_name,e.salary from emp e WHERE e.last_name regexp 'u?';
老师:select e.last_name,e.job_id,d.department_id,d.department_name from employees e inner join departments d using(department_id) inner join locations l on d.location_id = l.location_id where l.city = 'Toronto';
上面这句一直提示“USING 子句的列部分不能有限定词”,但我没给department_id列加条件呀,怎么回事呢
老师,这里面的给user对象的属性赋值,不用反射,用普通方法,怎么来?想了很久每写出来
老师这个数组有什么存在的意义?是用来存储吗
老师这里为什么要使用子查询,我尝试使用普通的select语句好像也能正常执行
老师,麻烦您解释一下hash join和merge join?为什么左外连接和右外连接的查询,其执行计划都是hash join,而视频上老师的右外连接却是merge join?
左外连接
右外连接
视频中的 右外连接
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637