JAKARTAPROJECT
JAKARTA TIPJSP TIPJSP Áú¹®&´äº¯DATABASE TIPJAVASCRIPT TIPWEBHACKING TIP±âŸ TIP
ÀÚÄ«¸£Å¸ ÇÁ·ÎÁ§Æ®
ÀÚÄ«¸£Å¸ ÇÁ·ÎÁ§Æ®
ÀÚÄ«¸£Å¸ ÇÁ·ÎÁ§Æ® ÆÁ °Ô½ÃÆÇ ÀÔ´Ï´Ù
DBUtils¿¡¼­ Clob »ç¿ëÇϱâ
GoodBug http://www.jakartaproject.com
À̹ÌÁö ½½¶óÀÌ´õ º¸±â

DBUtils¿¡¼­ Clob »ç¿ëÇϱâ

 

ÃÖ±Ù ¿À¶óŬ¹öÁ¯µéÀº ÀÏ¹Ý Stringó·³ clobÀ» ó¸®ÇÒ ¼ö ÀÖÁö¸¸ ±×·¸Áö ¾ÊÀº ¹öÁ¯µéÀº DBUtils¸¦ Á¶±Ý ¼öÁ¤ÇØ ÁÖ¼­¾ß ÇÕ´Ï´Ù

resultsetÀÇ ¸ÞŸ Á¤º¸¸¦ ÀÌ¿ëÇؼ­ Ä÷³ ŸÀÔÀÌ clobÀÎ ³Ñµé¸¸ µû·Î ó¸®ÇÏ´Â ·ÎÁ÷ÀÔ´Ï´Ù

 

org.apache.commons.dbutils.BasicRowProcessor.java ¸¦ ´ÙÀ½°ú °°ÀÌ ¼öÁ¤ÇÑ ÈÄ ´Ù½Ã ÄÄÆÈ Çϼ¼¿ä

 

 

    private Object createBean(
        ResultSet rs,
        Class type,
        PropertyDescriptor[] props,
        int[] columnToProperty,
        int cols)
        throws SQLException {

 

        Object bean = this.newInstance(type);       
        Object value = null;
        ResultSetMetaData meta = rs.getMetaData();
        for (int i = 1; i <= cols; i++) {

            if (columnToProperty[i] == PROPERTY_NOT_FOUND) {
                continue;
            }
           
            PropertyDescriptor prop = props[columnToProperty[i]];
            Class propType = prop.getPropertyType();
           
            if ("CLOB".equals(meta.getColumnTypeName(i))) {
                value = readClob(rs, i);
            }
            else {
                value = rs.getObject(i);
            }

            if (propType != null && value == null && propType.isPrimitive()) {
                value = primitiveDefaults.get(propType);
            }
           
            this.callSetter(bean, prop, value);
        }

        return bean;
    }
   
    protected Object readClob(ResultSet rs, int idx) {
        StringBuffer stringbuffer = new StringBuffer();
        char[] charbuffer = new char[1024];
        int read = 0;
       
        Reader reader = null;
        String result = null;
        try {
            reader = rs.getCharacterStream(idx);
            while ((read = reader.read(charbuffer, 0, 1024)) != -1)
                stringbuffer.append(charbuffer, 0, read);

            result = stringbuffer.toString();
        } catch (Exception exception) {
            System.out.println(exception);
        } finally {
            if (reader != null) try { reader.close(); } catch (Exception e){}
        }

        return result;
    }

 

 

 

2009-02-10 11:22:06
211.189.124.***

 

ÁÁÀº»ý°¢ ^^

0Á¡ (1¸í)
DBUtils DBUtils¿¡¼­ Clob »ç¿ëÇϱâ 3 Tag 1 GoodBug 2007-08-28
µ¡±Û 3°³ | ÅÂ±× 1°³ | °ü·Ã±Ûº¸±â
ű×ÀÔ·Â
½±Ç¥(,)±¸ºÐÀ¸·Î Çѹø¿¡ ¿©·¯ ű׸¦ ÀÔ·ÂÇÒ¼ö ÀÖ½À´Ï´Ù
DBUtils (6)
¼Õ´Ô
(0) (0)

ÁÁÀºÀÚ·á °¨»çÇÕ´Ï´Ù.......

 

+1 221.143.29.*** 2007-08-28 15:15:52
¼Õ´Ô
(0) (0)

The method createBean(ResultSet, Class, PropertyDescriptor[], int[], int) in the type BeanProcessor is not applicable for the arguments (ResultSet, Class, PropertyDescriptor[], int[])

ÀÌ·±¿¡·¯°¡ ³³´Ï´Ù.......

 

221.143.29.*** 2007-08-29 10:22:15
ÇູÇѱ¤´ë
(0) (0)

ÁÁÀº ÀÚ·á °¨»çÇÕ´Ï´Ù.

118.218.148.*** 2009-02-10 11:22:06
À̸§ ºñ¹Ð¹øÈ£
ÀÚÄ«¸£Å¸ ÇÁ·ÎÁ§Æ®
ÀÚÄ«¸£Å¸ ÇÁ·ÎÁ§Æ® ÆÁ °Ô½ÃÆÇ ÀÔ´Ï´Ù
! ¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ÀÏÀÚ Á¶È¸
Hierarchy of the Apache Software Foundation GoodBug 2005-10-14 10,814
Jakarta Project °­Á °Ô½ÃÆÇÀÔ´Ï´Ù 8 GoodBug 2005-04-03 11,701
44 Log4J log4j¿¡¼­ e.printStackTrace() ¸Þ½ÃÁö¸¦ log¿¡ ³²±â´Â ¹æ¹ý 1 kaiser 2008-10-22 17,613
DBUtils DBUtils¿¡¼­ Clob »ç¿ëÇϱâ 3 1 GoodBug 2007-08-28 10,633
42 Spring Spring ¼³Á¤ ÆÄÀÏ ·Îµù 1 GoodBug 2007-07-16 11,317
41 POI POIÀÇ HSLF¸¦ ÀÌ¿ëÇÏ¿© PowerPoint ¹®¼­¸¦ ÀоÀÚ 2 GoodBug 2007-05-28 14,910
40 POI POIÀÇ HWPF¸¦ ÀÌ¿ëÇÏ¿© MS WORD¹®¼­¸¦ ÀоÀÚ 2 GoodBug 2007-05-28 16,839
39 Validator Validator ¼Ó¼ºµé 1 GoodBug 2007-05-11 10,404
38 dd Commons-Fileupload 1.2 1 2 GoodBug 2007-04-23 15,345
37 Apache Apache2 + Tomcat5.5 + mod_jk 4 ¹ÙÀÌ·¯½ºô¸国 2007-01-29 11,066
36 DBUtils DBUtils¿¡¼­ number ŸÀÔÀÇ Ä÷³ÀÌ intÇüÀ¸·Î ¾È³Ñ¾î¿Ã¶§.. 3 1 GoodBug 2006-06-28 10,755
35 ÈìÈì À§ÇèÇÑ static Logger Çʵå... 2 1 ¼­¿¬¾Æºü 2006-03-16 10,113
34 Installing Tomcat with commons-daemon (jsvc) GoodBug 2006-01-08 9,067
33 commons Commons DbUtils ¸î°¡Áö ¿¹Á¦ 3 2 GoodBug 2005-11-17 15,221
32 commons Jakarta Commons Net ¿¡¼­ FTP »ç¿ë½Ã ¸ñ·ÏÀÌ ¾Èº¸ÀÏ °æ¿ì 2 GoodBug 2005-11-15 21,776
31 listFiles() ¿¡¼­ null À» ¹Ýȯ ÃßÀû.. ½Å¸¸µÎ 2008-11-11 11,866
30 commons ¸ñ·ÏÀÌ ¾Èº¸ÀÏ °æ¿ì ÇØ°á±â Iź 1 2 GoodBug 2005-12-23 15,932
29 POI POI·Î ¿¢¼¿ÆÄÀÏ ÀÐÀ»¶§, Invalid header signature ¿¡·¯ 1 GoodBug 2005-11-12 16,540
28 log4j log4j, JSP¿¡¼­ ¿øÇÏ´Â Appender °ñ¶ó¾²±â 1 GoodBug 2005-11-07 13,894
27 commons Commons-Email~ 7 2 GoodBug 2005-10-13 17,860
copyright 2005-2024 by Unicorn