mysql错误-UncategorizedSQLException 1449

阅读更多

错误:

UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1449];  

解决:

出错的意思是数据库访问时没有‘@’这个用户.这主要是在新建视图和存储过程时,我直截在mysql可视图形工具里copy代码到服务器上去运行,mysql里会自动生成一些代码,比如copy出来的视图语句:
    DROP VIEW IF EXISTS `testdb`.`v4bbs`;
CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=``@`` SQL SECURITY DEFINER VIEW `v4bbs` AS select `a`.`topic_id` AS `did`,`a`.`topic_type` AS `topic_type`,`a`.`especial_flag` AS `topic_level`,`a`.`title` AS `title`,`a`.`url` AS `url`,`a`.`content` AS `content`,concat(`b`.`chinese_name`,_utf8' ',`c`.`chinese_name`,_utf8' ',`d`.`chinese_name`) AS `addr`,`a`.`author_id` AS `author_id`,`e`.`nikename` AS `author_nick`,`a`.`appear_date` AS `pub_time`,`a`.`restor_count` AS `reply`,`a`.`last_restor_user_id` AS `last_reply_id`,`a`.`last_restor_nickName` AS `last_reply_nick`,`a`.`last_restor_date` AS `last_reply_time`,`a`.`last_update_date` AS `last_modify_time`,`a`.`fingerprint` AS `fp` from ((((`tb4topic` `a` join `tb4position` `b`) join `tb4position` `c`) join `tb4position` `d`) join `tb4user` `e`) where ((`a`.`pos_id_1` = `b`.`position_id`) and (`a`.`pos_id_2` = `c`.`position_id`) and (`a`.`pos_id_3` = `d`.`position_id`) and (`a`.`author_id` = `e`.`user_id`) and ((`a`.`state` = 1) or (`a`.`state` = 2)));

应该改成:

    DROP VIEW IF EXISTS `testdb`.`v4bbs`;
CREATE VIEW `v4bbs` AS select `a`.`topic_id` AS `did`,`a`.`topic_type` AS `topic_type`,`a`.`especial_flag` AS `topic_level`,`a`.`title` AS `title`,`a`.`url` AS `url`,`a`.`content` AS `content`,concat(`b`.`chinese_name`,_utf8' ',`c`.`chinese_name`,_utf8' ',`d`.`chinese_name`) AS `addr`,`a`.`author_id` AS `author_id`,`e`.`nikename` AS `author_nick`,`a`.`appear_date` AS `pub_time`,`a`.`restor_count` AS `reply`,`a`.`last_restor_user_id` AS `last_reply_id`,`a`.`last_restor_nickName` AS `last_reply_nick`,`a`.`last_restor_date` AS `last_reply_time`,`a`.`last_update_date` AS `last_modify_time`,`a`.`fingerprint` AS `fp` from ((((`tb4topic` `a` join `tb4position` `b`) join `tb4position` `c`) join `tb4position` `d`) join `tb4user` `e`) where ((`a`.`pos_id_1` = `b`.`position_id`) and (`a`.`pos_id_2` = `c`.`position_id`) and (`a`.`pos_id_3` = `d`.`position_id`) and (`a`.`author_id`

你可能感兴趣的:(mysql错误-UncategorizedSQLException 1449)