data exception: string data, right truncation - while creating index.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

data exception: string data, right truncation - while creating index.

Narayanaswamy, Mohan-3

Hi,

 

We are using HSQLDB2.2.8, when we use hsqldb.default_table_type=MEMORY; program works without below error.

 

But when we convert hsqldb.default_table_type=CACHED, below exception appears. Program behaviour seems to be not consistent.

 

Moreover, I have also confirmed TradeSysFilter schema string columns are varchar(255), when required input length falls in 6-8. We didn’t allocate less space than required. So below error seems to be strange.

 

org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL [CREATE INDEX Table_MXG_NB ON TradeSysFilter (MXG_NB)]; data exception: string data, right truncation in statement [CREATE INDEX TradeSysFilter_MXG_NB ON TradeSysFilter (MXG_NB)]; nested exception is java.sql.SQLDataException: data exception: string data, right truncation in statement [CREATE INDEX TradeSysFilter_MXG_NB ON TradeSysFilter (MXG_NB)]

                at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:79)

                at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)

                at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)

                at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:406)

                at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:427)

                at com.package.rec.util.Utility.createIndex(Utility.java:9)

                at com.package.rec.dao.impl.AbstractDAO.index(AbstractDAO.java:55)

                at com.package.rec.process.Processor.filterAndIndex(Processor.java:145)

                at com.package.rec.process.Processor.filterAndIndexTables(Processor.java:135)

                at com.package.rec.process.Processor.createRec(Processor.java:78)

                at com.package.rec.spring.Main.<init>(Main.java:26)

                at com.package.rec.spring.Main.main(Main.java:49)

Caused by: java.sql.SQLDataException: data exception: string data, right truncation in statement [CREATE INDEX TradeSysFilter_MXG_NB ON TradeSysFilter (MXG_NB)]

                at org.hsqldb.jdbc.Util.sqlException(Unknown Source)

                at org.hsqldb.jdbc.Util.sqlException(Unknown Source)

                at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)

                at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)

                at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

                at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

                at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:420)

                at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395)

                ... 8 more

Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation

                at org.hsqldb.error.Error.error(Unknown Source)

                at org.hsqldb.error.Error.error(Unknown Source)

                at org.hsqldb.types.CharacterType.convertToTypeLimits(Unknown Source)

                at org.hsqldb.Table.enforceTypeLimits(Unknown Source)

                at org.hsqldb.persist.RowStoreAVL.moveData(Unknown Source)

                at org.hsqldb.TableWorks.moveData(Unknown Source)

                at org.hsqldb.TableWorks.addIndex(Unknown Source)

                at org.hsqldb.StatementSchema.getResult(Unknown Source)

                at org.hsqldb.StatementSchema.execute(Unknown Source)

                at org.hsqldb.Session.executeCompiledStatement(Unknown Source)

                at org.hsqldb.Session.executeDirectStatement(Unknown Source)

                at org.hsqldb.Session.execute(Unknown Source)

                ... 14 more

 

Regards

Mohan


This email and any attachments are confidential and may also be privileged. If you are not the addressee, do not disclose, copy, circulate or in any other way use or rely on the information contained in this email or any attachments. If received in error, notify the sender immediately and delete this email and any attachments from your system. Emails cannot be guaranteed to be secure or error free as the message and any attachments could be intercepted, corrupted, lost, delayed, incomplete or amended. Standard Chartered PLC and its subsidiaries do not accept liability for damage caused by this email or any attachments and may monitor email traffic.

Standard Chartered PLC is incorporated in England with limited liability under company number 966425 and has its registered office at 1 Aldermanbury Square, London, EC2V 7SB.

Standard Chartered Bank ("SCB") is incorporated in England with limited liability by Royal Charter 1853, under reference ZC18. The Principal Office of SCB is situated in England at 1 Aldermanbury Square, London EC2V 7SB. In the United Kingdom, SCB is authorised and regulated by the Financial Services Authority under FSA register number 114276.

If you are receiving this email from SCB outside the UK, please click http://www.standardchartered.com/global/email_disclaimer.html to refer to the information on other jurisdictions.

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|

Re: data exception: string data, right truncation - while creating index.

Fred Toussi-2
This is difficult to locate without an example.
 
Please create a test table with a few rows of sample data that shows this problem and post the SQL statements.
 
Fred
 
 
On Mon, Feb 13, 2012, at 12:23, Narayanaswamy, Mohan wrote:

Hi,

 

We are using HSQLDB2.2.8, when we use hsqldb.default_table_type=MEMORY; program works without below error.

 

But when we convert hsqldb.default_table_type=CACHED, below exception appears. Program behaviour seems to be not consistent.

 

Moreover, I have also confirmed TradeSysFilter schema string columns are varchar(255), when required input length falls in 6-8. We didn’t allocate less space than required. So below error seems to be strange.

 

org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL [CREATE INDEX Table_MXG_NB ON TradeSysFilter (MXG_NB)]; data exception: string data, right truncation in statement [CREATE INDEX TradeSysFilter_MXG_NB ON TradeSysFilter (MXG_NB)]; nested exception is java.sql.SQLDataException: data exception: string data, right truncation in statement [CREATE INDEX TradeSysFilter_MXG_NB ON TradeSysFilter (MXG_NB)]

                at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:79)

                at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)

                at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)

                at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:406)

                at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:427)

                at com.package.rec.util.Utility.createIndex(Utility.java:9)

                at com.package.rec.dao.impl.AbstractDAO.index(AbstractDAO.java:55)

                at com.package.rec.process.Processor.filterAndIndex(Processor.java:145)

                at com.package.rec.process.Processor.filterAndIndexTables(Processor.java:135)

                at com.package.rec.process.Processor.createRec(Processor.java:78)

                at com.package.rec.spring.Main.<init>(Main.java:26)

                at com.package.rec.spring.Main.main(Main.java:49)

Caused by: java.sql.SQLDataException: data exception: string data, right truncation in statement [CREATE INDEX TradeSysFilter_MXG_NB ON TradeSysFilter (MXG_NB)]

                at org.hsqldb.jdbc.Util.sqlException(Unknown Source)

                at org.hsqldb.jdbc.Util.sqlException(Unknown Source)

                at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)

                at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)

                at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

                at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

                at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:420)

                at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395)

                ... 8 more

Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation

                at org.hsqldb.error.Error.error(Unknown Source)

                at org.hsqldb.error.Error.error(Unknown Source)

                at org.hsqldb.types.CharacterType.convertToTypeLimits(Unknown Source)

                at org.hsqldb.Table.enforceTypeLimits(Unknown Source)

                at org.hsqldb.persist.RowStoreAVL.moveData(Unknown Source)

                at org.hsqldb.TableWorks.moveData(Unknown Source)

                at org.hsqldb.TableWorks.addIndex(Unknown Source)

                at org.hsqldb.StatementSchema.getResult(Unknown Source)

                at org.hsqldb.StatementSchema.execute(Unknown Source)

                at org.hsqldb.Session.executeCompiledStatement(Unknown Source)

                at org.hsqldb.Session.executeDirectStatement(Unknown Source)

                at org.hsqldb.Session.execute(Unknown Source)

                ... 14 more

 

Regards

Mohan


This email and any attachments are confidential and may also be privileged. If you are not the addressee, do not disclose, copy, circulate or in any other way use or rely on the information contained in this email or any attachments. If received in error, notify the sender immediately and delete this email and any attachments from your system. Emails cannot be guaranteed to be secure or error free as the message and any attachments could be intercepted, corrupted, lost, delayed, incomplete or amended. Standard Chartered PLC and its subsidiaries do not accept liability for damage caused by this email or any attachments and may monitor email traffic.

Standard Chartered PLC is incorporated in England with limited liability under company number 966425 and has its registered office at 1 Aldermanbury Square, London, EC2V 7SB.

Standard Chartered Bank ("SCB") is incorporated in England with limited liability by Royal Charter 1853, under reference ZC18. The Principal Office of SCB is situated in England at 1 Aldermanbury Square, London EC2V 7SB. In the United Kingdom, SCB is authorised and regulated by the Financial Services Authority under FSA register number 114276.

If you are receiving this email from SCB outside the UK, please click http://www.standardchartered.com/global/email_disclaimer.html to refer to the information on other jurisdictions.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user

 

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user