上面的红字意思是我感觉子查询查到的部门id是有重复值的,那个多行子查询的in关键字就是对返回的每一个部门id进行相等,当主查询对每一个部门id进行查询按理来说就是会返回很多重复的结果,但是按照视频的sql语言来写的话确没有重复值
老师,刚刚那个问题已解决,是我忘记提交事务了。现在,我想得到2018-03-04 13:00:00 的具体日期时间,解决思路是什么?
为什么我的语句是和视频中老师讲的一模一样,为什么结果不出来呢?
老师:
int n[]=ps.executeBatch();老师的返回值是从0到9,而我的都是1。返回值不是收影响行数吗为什么我的不对
public static void batch(List<Departments> list) { Connection conn=null; PreparedStatement ps=null; try { conn=JdbcUtil.getConnection(); ps=conn.prepareStatement("insert into departments values(?,?,?)"); for(int i=0;i<list.size();i++) { ps.setInt(1, list.get(i).getDepartmentId()); ps.setString(2, list.get(i).getDepartmentName()); ps.setInt(3, list.get(i).getDepartmentlocationId()); ps.addBatch(); } int n[]=ps.executeBatch(); for(int i=0;i<n.length;i++) { System.out.println(n[i]); } }catch(Exception e) { e.printStackTrace(); }finally { JdbcUtil.close(conn, ps, null); } }
1.这里可以写成可变参数为Object···prama吧,与数组Object[] param有什么区别吗?
public int executeUpdate(String sql,Object[] param) ;
2.为什么这个Dao接口要继承这个BaseDao接口呢,我不继承还是能够运行出结果丫?
DaoImpl类实现这个Dao接口是不是要全部实现Dao接口和BaseDao接口中的全部抽象方法嘛?我这里DaoImpl类没实现BaseDao里的方法不会报错唉.
public interface DepartmentDao extends BaseDao{
老师我这个报错原因是什么啊,为什么报错之后还能继续运行呢
老师,mysql是表名大小写不敏感,不管写大小写都是小写,列名大小写敏感吗
老师,我也是配置了监听,就启动不了了。然后卸载重装Oracle,就报这个错。
老师,封装完以后,运行丢失参数怎么回事?
老师图片输出的位置没给定默认输出到idea的本项目中吗
老师,这是哪里出现问题了?我实在找不出来.。。
com.bzcxy.logincom.bzcxy.jdbc.JDBCUtilsjava.io.IOExceptionjava.lang.reflect.Fieldjava.sql.*java.util.*Login_Test { (String[] args) ClassNotFoundExceptionSQLExceptionIOExceptionIllegalAccessExceptionNoSuchFieldException { Map<StringString> userLoginInfo = ()System..println((userLoginInfo)?:)} Map<StringString> (){ Scanner sc = Scanner(System.)System..println()String account = sc.next()System..println()String password = sc.next()Map<StringString> userLoginInfo = HashMap<>()userLoginInfo.put(account)userLoginInfo.put(password)userLoginInfo} List<Account> (String sqlObject...args) SQLExceptionIOExceptionClassNotFoundExceptionNoSuchFieldExceptionIllegalAccessException { List<Account> accounts = ArrayList<>()Connection conn = JDBCUtils.()PreparedStatement ps = conn.prepareStatement(sql)(i=i<args.i++){ ps.setObject(i+args[i])} ResultSet rs = ps.executeQuery()ResultSetMetaData rsmd = rs.getMetaData()columncount = rsmd.getColumnCount()(rs.next()){ Account account = Account()(i=i<columncounti++){ Object columnValue = rs.getObject(i+)String columnName = rsmd.getColumnName(i+)Field field = account.getClass().getDeclaredField(columnName)field.setAccessible()field.set(accountcolumnValue)} accounts.add(account)} rs.close()JDBCUtils.(connps)accounts} (Map<StringString> userLoginInfo) ClassNotFoundExceptionSQLExceptionNoSuchFieldExceptionIllegalAccessExceptionIOException { String sql = List<Account> accounts = (sqluserLoginInfo.get()userLoginInfo.get())(accounts.size() == ){ } } }
com.bzcxy.loginAccount { Integer String String String Integer () { } (Integer userid) { .= userid} String () { } (String useraccound) { .= useraccound} String () { } (String username) { .= username} String () { } (String userpassword) { .= userpassword} }
user=rootpassword=GO898611url=jdbc:mysql://localhost:3306/baizhan?useSSL=falsedriverClass=com.mysql.jdbc.Driver
pl/sql developer在配置监听以后打开不是无法监听就是无服务。。。咋回事啊???不配置还好好的,一配置咋瘫痪了。。。
mysql> insert into departments(department_name,location_id) values("market", 1);
ERROR 1046 (3D000): No database selected
mysql>
提示这个是啥意思,咋解决哇
老师,这种做法没有用到占位符,那是不是也会有sql注入的问题? 如果departmentName 是‘ or 1=1 --
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637