너무어려웡
502
2017-05-07 00:36:46 작성 2017-05-07 01:02:04 수정됨
4
1247

oracle db관련 오류 질문 입니다ㅠㅠ!


-board.db-

create table board
(
   idx int primary key,
   subject varchar2(200),	
   content varchar2(200),	
   nick varchar2(100),
   regdate date
);


-board.jsp-

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%> 
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>

<script type="text/javascript" src="${ pageContext.request.contextPath }/resources/ckeditor/ckeditor.js">
</script>

<script type="text/javascript" src="${ pageContext.request.contextPath }/resources/js/jquery-1.10.2.js">
</script>

</head>
<body>
<script>
	
	var editor = null;
	jQuery(function() { 
		// ckeditor 적용
		editor = CKEDITOR.replace('content');
		}
	);

	// 전송을 위한 체크 함수
	function form_save(form) {
		editor.updateElement();
		
	}

function send(f){
	var subject=document.getElementById("subject").value.trim();
	var content=CKEDITOR.instances.content.getData();
	
	f.action = "board_insert.do";
	f.method = "POST";
	
	f.submit();
}
</script>
<header>
  <form>
   <input id="subject" name="subject" type="text">
   <textarea id="content" name="content" ></textarea>		
			
    <button onclick="send(this.form)">전송</button>
  </form>
</body>
</html>


-controller-

@RequestMapping("/board_insert.do")
	public String insert(BoardVo vo){

		int res = dao.insert(vo);
		return "redirect:board_view.do";
	}


-board.xml-

<insert id="board_insert" parameterType="vo.BoardVo">
		insert into board values(seq_board_idx.nextVal,
                         #{ subject },
                         #{ content,jdbcType=VARCHAR},
                         #{ nick },
                         sysdate)
</insert>


이렇게 쭉 이어지는데요..

jsp에서 전송 버튼 누르면 

HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Error setting null for parameter #3 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형

type Exception report

message Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Error setting null for parameter #3 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Error setting null for parameter #3 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형
; uncategorized SQLException for SQL []; SQL state [null]; error code [17004]; 부적합한 열 유형; nested exception is java.sql.SQLException: 부적합한 열 유형
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

org.springframework.jdbc.UncategorizedSQLException: Error setting null for parameter #3 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형
; uncategorized SQLException for SQL []; SQL state [null]; error code [17004]; 부적합한 열 유형; nested exception is java.sql.SQLException: 부적합한 열 유형
	org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
	org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
	org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
	org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
	com.sun.proxy.$Proxy4.insert(Unknown Source)
	org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:236)
	dao.BoardDao.insert(BoardDao.java:71)
	com.ic.atct.BoardController.insert(BoardController.java:100)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:498)
	org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

java.sql.SQLException: 부적합한 열 유형
	oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
	oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
	oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
	oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:3456)
	oracle.jdbc.driver.OraclePreparedStatement.setNullCritical(OraclePreparedStatement.java:4292)
	oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:4281)
	org.apache.commons.dbcp.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:108)
	org.apache.commons.dbcp.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:108)
	org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:39)
	org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:77)
	org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:77)
	org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:58)
	org.apache.ibatis.executor.ReuseExecutor.prepareStatement(ReuseExecutor.java:76)
	org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:46)
	org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:100)
	org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:148)
	org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:137)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:498)
	org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354)
	com.sun.proxy.$Proxy4.insert(Unknown Source)
	org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:236)
	dao.BoardDao.insert(BoardDao.java:71)
	com.ic.atct.BoardController.insert(BoardController.java:100)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:498)
	org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

note The full stack trace of the root cause is available in the Apache Tomcat/8.0.36 logs.


Apache Tomcat/8.0.36


이렇게 나와서 content가 null 인가 싶어서 controller에서

프린트 찍어 봤는데 jsp에서 입력 했던 값이 제대로 찍히기는 하더라구요..

혹시 해서 String content="ah"; vosetContent(content); 이렇게 해줘는데도 마찬가지구요...


오류 내용에 대해서 구글 검색 해보니 db 에서 content 입력하는 부분에

#{ content,jdbcType=VARCHAR} 이렇게 입력 해주면 해결 된다고 해서 해봤는데도 그대로네요...

대체 무슨 문제일까요 ㅠㅠ?


0
0
  • 답변 4

  • 희영
    2
    2017-05-07 02:07:08 작성 2017-05-07 02:31:51 수정됨

    저.. 오류로만 봐서는 널값이 들어가면 안되는 컬럼에 널이 들어가서 나는 오류 같습니다.

    테이블 정보로만 봐서는 널값이 허용 안되는건 인덱스와 날자 정보 인거같은데

    seq_board_idx 이거 시퀀스를 생성을 안하셨다면 해주시면 해결 될거같은데요 

    0
  • 너무어려웡
    502
    2017-05-07 02:19:22
    아뇨 ㅠㅠ 인덱스 생성한적 없습니다.
    0
  • 너무어려웡
    502
    2017-05-07 02:34:35

    앗 nick을 안넣어준거였네요 ㅠㅠ

    죄송합니다 ㅠㅠ

    0
  • isNotEmpty
    2017-05-07 02:36:46

    파라미터 nick값이 없어서 그런 것 같은데요.

    vo에 nick값이 있는지 확인해보세요.


    0
  • 로그인을 하시면 답변을 등록할 수 있습니다.