db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eike Stepper <step...@sympedia.com>
Subject 'VARCHAR' from a data value of type '0'
Date Tue, 04 Jul 2006 08:03:54 GMT
Hi,

Does anybody know, why I get an SQLException if I try to insert a NULL value?
I use embedded mode (db-derby-10.1.2.1-bin).
On a windows system I created following table:

CREATE TABLE CDO_CLASS (
	CID INTEGER NOT NULL,
	NAME VARCHAR(255) NOT NULL,
	PARENTNAME VARCHAR(255),
	TABLENAME VARCHAR(127) NOT NULL,
	PID INTEGER NOT NULL,
	CONSTRAINT CID_CDO_CLASS PRIMARY KEY (CID))
CREATE UNIQUE INDEX CDO_CLASS_NAME ON CDO_CLASS (NAME)
CREATE INDEX CDO_CLASS_PID ON CDO_CLASS (PID)


This statement leads to the exception:

[DEBUG] net4j.server.mapper: INSERT INTO CDO_CLASS VALUES (1, 'library.Library', NULL, 'LIBRARY',
1)
Exception in thread "pool-1-thread-1" org.springframework.dao.DataIntegrityViolationException:
PreparedStatementCallback; SQL [INSERT INTO CDO_CLASS VALUES (?, ?, ?, ?, ?)]; An attempt
was made to get a data value of type 'VARCHAR' from a data value of type '0'.; nested exception
is org.apache.derby.impl.jdbc.EmbedSQLException: An attempt was made to get a data value of
type 'VARCHAR' from a data value of type '0'.
SQL Exception: An attempt was made to get a data value of type 'VARCHAR' from a data value
of type '0'.
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)

	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.dataTypeConversion(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setNull(Unknown Source)
	at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:95)
	at org.springframework.jdbc.core.JdbcTemplate$ArgPreparedStatementSetter.setValues(JdbcTemplate.java:1070)
	at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:680)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:454)
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:676)
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:738)
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:746)
	at org.eclipse.emf.cdo.server.impl.MapperImpl.sql(MapperImpl.java:651)
	at org.eclipse.emf.cdo.server.impl.MapperImpl.insertClass(MapperImpl.java:394)
	at org.eclipse.emf.cdo.server.protocol.DescribePackageIndication.receiveClasses(DescribePackageIndication.java:79)
	at org.eclipse.emf.cdo.server.protocol.DescribePackageIndication.indicate(DescribePackageIndication.java:46)
	at org.eclipse.net4j.core.impl.ChannelImpl$SignalTask.processSignal(ChannelImpl.java:853)
	at org.eclipse.net4j.core.impl.ChannelImpl$SignalTask.run(ChannelImpl.java:789)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
	at java.lang.Thread.run(Thread.java:595)

Thanks for any hint ;-)
/Eike


Mime
View raw message