<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Bad value for type int with PostreSQL database"]]></title>
		<link>http://forums.terracotta.org/forums/posts/list/7.page</link>
		<description><![CDATA[Latest messages posted in the topic "Bad value for type int with PostreSQL database"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Bad value for type int with PostreSQL database</title>
				<description><![CDATA[ 

public class StdJDBCDelegate implements DriverDelegate, StdJDBCConstants {

    protected Object getObjectFromBlob(ResultSet rs, String colName)
        throws ClassNotFoundException, IOException, SQLException {
        ...
        Blob blobLocator = rs.getBlob(colName); // the line 3462


1) First crash is happend during the SQL call
SELECT * FROM QRTZ_TRIGGERS WHERE TRIGGER_NAME = ssssssssssss AND TRIGGER_GROUP = DEFAULT
The value of JOB_DATA is "''" (two single quotes). I think this value is very strange.

2) I set empty value for JOB_DATA in QRTZ_TRIGGERS
I have second crash in the same place during the select:
SELECT * FROM QRTZ_JOB_DETAILS WHERE JOB_NAME = POLLING_1_ssssssssssss AND JOB_GROUP = DEFAULT

The value of JOB_DATA in QRTZ_JOB_DETAILS is:
\254\355\000\005sr\000\025org.quartz.JobDataMap\237\260\203\350\277\251\260\313\002\000\000xr\000&org.quartz.utils.StringKeyDirtyFlagMap\202\010\350\303\373\305](\002\000\001Z\000\023allowsTransientDataxr\000\035org.quartz.utils.DirtyFlagMap\023\346.\255(v\012\316\002\000\002Z\000\005dirtyL\000\003mapt\000\017Ljava/util/Map;xp\000sr\000\021java.util.HashMap\005\007\332\301\303\026`\321\003\000\002F\000\012loadFactorI\000\011thresholdxp?@\000\000\000\000\000\014w\010\000\000\000\020\000\000\000\000x\000


The log for first crash:
010-02-26 17:21:07,857 ERROR [org.quartz.core.ErrorLogger] - <An error occured while scanning for the next trigger to fire.>
org.quartz.JobPersistenceException: Couldn't acquire next trigger: Couldn't retrieve trigger: Bad value for type int :  [See nested exception: org.quartz.JobPersistenceException: Couldn't retrieve trigger: Bad value for type int :  [See nested exception: org.postgresql.util.PSQLException: Bad value for type int : ]]
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2787)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport$36.execute(JobStoreSupport.java:2730)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3744)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2726)
	at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:263)
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve trigger: Bad value for type int :  [See nested exception: org.postgresql.util.PSQLException: Bad value for type int : ]
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1569)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1545)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2765)
	... 4 more
Caused by: org.postgresql.util.PSQLException: Bad value for type int : 
	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2515)
	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:1994)
	at org.postgresql.jdbc3.Jdbc3ResultSet.getBlob(Jdbc3ResultSet.java:54)
	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBlob(AbstractJdbc2ResultSet.java:323)
	at com.mchange.v2.c3p0.impl.NewProxyResultSet.getBlob(NewProxyResultSet.java:285)
	at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.getObjectFromBlob(StdJDBCDelegate.java:3462)
	at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:2132)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1551)
	... 6 more]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/3210.page#18206</guid>
				<link>http://forums.terracotta.org/forums/posts/list/3210.page#18206</link>
				<pubDate><![CDATA[Tue, 2 Mar 2010 05:48:02]]> GMT</pubDate>
				<author><![CDATA[ Serg]]></author>
			</item>
			<item>
				<title>Re:Bad value for type int with PostreSQL database</title>
				<description><![CDATA[ Do you prefer the JDBCDataStore - have you tried the terracottaJobStore. Let us know..
Thanks
 ]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/3210.page#18263</guid>
				<link>http://forums.terracotta.org/forums/posts/list/3210.page#18263</link>
				<pubDate><![CDATA[Thu, 4 Mar 2010 06:17:24]]> GMT</pubDate>
				<author><![CDATA[ zeeiyer]]></author>
			</item>
			<item>
				<title>Re:Bad value for type int with PostreSQL database</title>
				<description><![CDATA[ Hello zeeiyer,

It doesn't help.]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/3210.page#18491</guid>
				<link>http://forums.terracotta.org/forums/posts/list/3210.page#18491</link>
				<pubDate><![CDATA[Thu, 11 Mar 2010 02:18:31]]> GMT</pubDate>
				<author><![CDATA[ Serg]]></author>
			</item>
			<item>
				<title>Re:Bad value for type int with PostreSQL database</title>
				<description><![CDATA[ For the issue resolving two fixes are required in StdJDBCDelegate:
1) 
...
    protected void setBytes(PreparedStatement ps, int index,  ByteArrayOutputStream baos) throws SQLException {

        if (baos == null) {
            ps.setBytes(index, null);
        } else {
            ps.setBytes(index, baos.toByteArray());
        }
         //ps.setBytes(index, (baos == null) ? new byte[0] : baos.toByteArray());
    }
...

2)
...
    protected Object getObjectFromBlob(ResultSet rs, String colName)
        throws ClassNotFoundException, IOException, SQLException {
        Object obj = null;
// ssokolov /////////////////////////////////

        byte[] bytes = rs.getBytes(colName);
        if (bytes != null && bytes.length != 0) {
            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
            try {
                obj = in.readObject();
            } finally {
                in.close();
            }
        }

/*
        Blob blobLocator = rs.getBlob(colName);
        if (blobLocator != null && blobLocator.length() != 0) {
            InputStream binaryInput = blobLocator.getBinaryStream();

            if (null != binaryInput) {
                if (binaryInput instanceof ByteArrayInputStream
                    && ((ByteArrayInputStream) binaryInput).available() == 0 ) {
                    //do nothing
                } else {
                    ObjectInputStream in = new ObjectInputStream(binaryInput);
                    try {
                        obj = in.readObject();
                    } finally {
                        in.close();
                    }
                }
            }

        }
*/
        return obj;
    }
...]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/3210.page#18492</guid>
				<link>http://forums.terracotta.org/forums/posts/list/3210.page#18492</link>
				<pubDate><![CDATA[Thu, 11 Mar 2010 02:29:19]]> GMT</pubDate>
				<author><![CDATA[ Serg]]></author>
			</item>
	</channel>
</rss>