473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Data truncation

i have a problem

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated for column 'FGiroNPagDol' at row 1
at com.mysql.jdbc.SQLError.convertShowWarningsToSQLWa rnings(SQLError.java:717)
at com.mysql.jdbc.MysqlIO.scanForAndThrowDataTruncati on(MysqlIO.java:3183)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java :1874)
at com.mysql.jdbc.Connection.execSQL(Connection.java: 3256)
at com.mysql.jdbc.PreparedStatement.executeInternal(P reparedStatement.java:1313)
at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:1585)
at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:1500)
at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:1485)
at packapp.Desempaquetar.grabarEnTablaGiros(Desempaqu etar.java:872)
at packapp.Operaciones.desempaquetar(Operaciones.java :333)
at packinterfaz.servletinterfaz.ProcesarArchivo.proce ssRequest(ProcesarArchivo.java:156)
at packinterfaz.servletinterfaz.ProcesarArchivo.doPos t(ProcesarArchivo.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
Error = Data truncation: Data truncated for column 'FGiroNPagDol' at row 1


please help me
Sep 14 '07 #1
12 4759
r035198x
13,262 8TB
Could you show the sql that gave this exception?
Sep 15 '07 #2
JosAH
11,448 Expert 8TB
And also please show the type of column 'FGiroNPagDol' and the value you
wanted to store in it.

kind regards,

Jos
Sep 15 '07 #3
Hi,
I have the same problems when I try to convert data from *.dbf to MySQL table:

Exception in thread "main" com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated for column 'DATAPROD' at row 1
at com.mysql.jdbc.SQLError.convertShowWarningsToSQLWa rnings(SQLError.java:717)
at com.mysql.jdbc.MysqlIO.scanForAndThrowDataTruncati on(MysqlIO.java:3102)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java :1862)
at com.mysql.jdbc.Connection.execSQL(Connection.java: 3249)
at com.mysql.jdbc.PreparedStatement.executeInternal(P reparedStatement.java:1268)
at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:1541)
at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:1455)
at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:1440)
at converting.ConvertData2.rewrite(ConvertData2.java: 231)
at startapp.StartClass.main(StartClass.java:26)

The type of 'DATAPROD' in *.dbf file is Date (like 02.02.2007) and it will be VARCHAR in MySQL.

Below I'm wrote the void when I'm insert data into MySQL table:

public static void rewrite() throws SQLException {
getConnect();
createStmt();
try {
ostr = new FileOutputStream(outputFolder + outputFile);
ostrw = new OutputStreamWriter(ostr, "UTF-8");
}
catch(IOException e) {
echonl("rewrite1 : " + e.getMessage() + e.toString() + outputFolder + outputFile );
}
Object []rowObjects;
echonl("counting");
rowCount = 0;
String strSQLIns = "";
strSQLIns += "insert into " + tablename + " (";
try {
try {
for(int j=0; j<fieldCount; j++) {
DBFField field = reader.getField( j);
strSQLIns += convertFieldName(field.getName()) ;
if (j != fieldCount - 1) {
strSQLIns += ",";
}
}
strSQLIns += ") values ";
while((rowObjects = reader.nextRecord()) != null) {
rowCount++;
if (rowCount == 1) {
ostrw.write(strSQLIns);
}
else {
if (rowCount % multiple_rows == 0) {
ostrw.write(";");
ostrw.write("\n");
ostrw.write(strSQLIns);
}
else {
if (rowCount > 1) {
ostrw.write(",");
}
}
}
if (rowCount % 20000 == 0) {
echo(Integer.toString(rowCount) + "..");
}
if (rowCount % 100000 == 0) {
echonl("");
}
pstmt = incon.prepareStatement(strSQLIns + insertRowStmt(rowObjects));
pstmt.executeUpdate();
//ostrw.write("\n");
//ostrw.write(insertRowStmt(rowObjects));
}
}
catch(DBFException e) {
echonl("rewrite-- : " + e.getMessage());
}
ostrw.close();
}
catch(IOException e) {
echonl("rewrite3 : " + e.getMessage() + "**" + e.toString() + outputFolder + outputFile);
}
}

P.S. In MySQL table put only one row and value in this column is "Wed May".
How I can solve this problem?
Oct 16 '07 #4
r035198x
13,262 8TB
Hi,
I have the same problems when I try to convert data from *.dbf to MySQL table:

Exception in thread "main" com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated for column 'DATAPROD' at row 1
at com.mysql.jdbc.SQLError.convertShowWarningsToSQLWa rnings(SQLError.java:717)
at com.mysql.jdbc.MysqlIO.scanForAndThrowDataTruncati on(MysqlIO.java:3102)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java :1862)
at com.mysql.jdbc.Connection.execSQL(Connection.java: 3249)
at com.mysql.jdbc.PreparedStatement.executeInternal(P reparedStatement.java:1268)
at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:1541)
at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:1455)
at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:1440)
at converting.ConvertData2.rewrite(ConvertData2.java: 231)
at startapp.StartClass.main(StartClass.java:26)

The type of 'DATAPROD' in *.dbf file is Date (like 02.02.2007) and it will be VARCHAR in MySQL.

Below I'm wrote the void when I'm insert data into MySQL table:

public static void rewrite() throws SQLException {
getConnect();
createStmt();
try {
ostr = new FileOutputStream(outputFolder + outputFile);
ostrw = new OutputStreamWriter(ostr, "UTF-8");
}
catch(IOException e) {
echonl("rewrite1 : " + e.getMessage() + e.toString() + outputFolder + outputFile );
}
Object []rowObjects;
echonl("counting");
rowCount = 0;
String strSQLIns = "";
strSQLIns += "insert into " + tablename + " (";
try {
try {
for(int j=0; j<fieldCount; j++) {
DBFField field = reader.getField( j);
strSQLIns += convertFieldName(field.getName()) ;
if (j != fieldCount - 1) {
strSQLIns += ",";
}
}
strSQLIns += ") values ";
while((rowObjects = reader.nextRecord()) != null) {
rowCount++;
if (rowCount == 1) {
ostrw.write(strSQLIns);
}
else {
if (rowCount % multiple_rows == 0) {
ostrw.write(";");
ostrw.write("\n");
ostrw.write(strSQLIns);
}
else {
if (rowCount > 1) {
ostrw.write(",");
}
}
}
if (rowCount % 20000 == 0) {
echo(Integer.toString(rowCount) + "..");
}
if (rowCount % 100000 == 0) {
echonl("");
}
pstmt = incon.prepareStatement(strSQLIns + insertRowStmt(rowObjects));
pstmt.executeUpdate();
//ostrw.write("\n");
//ostrw.write(insertRowStmt(rowObjects));
}
}
catch(DBFException e) {
echonl("rewrite-- : " + e.getMessage());
}
ostrw.close();
}
catch(IOException e) {
echonl("rewrite3 : " + e.getMessage() + "**" + e.toString() + outputFolder + outputFile);
}
}

P.S. In MySQL table put only one row and value in this column is "Wed May".
How I can solve this problem?
Post the sql statement that was executed (Capture it by System.out.println before the query was executed).
Also state your MySQL version.
Oct 16 '07 #5
Post the sql statement that was executed (Capture it by System.out.println before the query was executed).
Also state your MySQL version.
MySQL version is 4.1.
SQL statement is:
insert into ALEX (DATATIME,DOCTYPE,DOCNUM,STRNUM,KODNOMEN,NOMENKLAT ,EDIZM,DATAPROD,KOLVO,VES,CENA,SEBEST,KODKLIENTA,K LIENT,FILIAL) values ('02.05.07 08:45:15','Нов яР сход* яН кл д* я','7063','1','00048','‘кумбрия тл.х/к б/г из сырья 400-600','кг','Wed May 02 00:00:00 MSD 2007','12.9','12.9','132.3','1150.94','00001306',' „емья*ов Н.П.','€лексеевк ')
Oct 16 '07 #6
r035198x
13,262 8TB
MySQL version is 4.1.
SQL statement is:
insert into ALEX (DATATIME,DOCTYPE,DOCNUM,STRNUM,KODNOMEN,NOMENKLAT ,EDIZM,DATAPROD,KOLVO,VES,CENA,SEBEST,KODKLIENTA,K LIENT,FILIAL) values ('02.05.07 08:45:15','Нов яР сход* яН кл д* я','7063','1','00048','Скумбрия тл.х/к б/г из сырья 400-600','кг','Wed May 02 00:00:00 MSD 2007','12.9','12.9','132.3','1150.94','00001306',' Демья*ов Н.П.','Алексеевк ')
Most likely you are inserting a value wider than is allowed by your column. What's the type of the DATAPROD column and which value are you trying to put into it.
Oct 16 '07 #7
Most likely you are inserting a value wider than is allowed by your column. What's the type of the DATAPROD column and which value are you trying to put into it.
The type of 'DATAPROD' in *.dbf file is Date (like 02.02.2007) and it will be VARCHAR in MySQL
Oct 16 '07 #8
r035198x
13,262 8TB
The type of 'DATAPROD' in *.dbf file is Date (like 02.02.2007) and it will be VARCHAR in MySQL
Why don't you convert to Varchar first using TO_CHAR
Oct 16 '07 #9
Why don't you convert to Varchar first using TO_CHAR
What do you mean "using TO_CHAR" - make field CHAR type, or something else?

I think the problem is in converting DBase type "Date" into MySQL type "Datetime". And another one problem in converting russian letters from *.dbf into MySQL table. I create mysql table with DEFAULT CHARSET=utf8.
Oct 16 '07 #10
r035198x
13,262 8TB
What do you mean "using TO_CHAR" - make field CHAR type, or something else?

I think the problem is in converting DBase type "Date" into MySQL type "Datetime". And another one problem in converting russian letters from *.dbf into MySQL table. I create mysql table with DEFAULT CHARSET=utf8.
I thought you said the MySQL type is Varchar. Now you say it's DateTime?
Oct 16 '07 #11
I thought you said the MySQL type is Varchar. Now you say it's DateTime?
sorry, I mean data in DATAPROD column in mysql table look like datetime: 'Wed May 02 00:00:00 MSD 2007', but it type is varchar.
Oct 16 '07 #12
It was easier than I think!
Field "DATAPROD" is dbf has only 8 symbols length. I set 50 symbols for this field and it works!

Now I have another problem with cyrillic encoding. )
Oct 18 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Joe Conlin | last post by:
I am truncating data from an SQL database and have a script that populates a cell. The problem that I have is I have HTML tags in my database so if the data gets truncated in the middle of a tag,...
1
by: hharry | last post by:
Hello All, I am attempting a bulk load of fixed position flat file data via bcp and I have noticed that I get a Right Truncation error when trying to load a row where the last column value is...
10
by: joel.brewster | last post by:
We have a VB6 application using ADO version 2.5 and I am receiving a " CLI0109E String data right truncation. SQLSTATE=22001" error when I execute the rs.UpdateBatch method. I have determined...
2
by: Gary Miller | last post by:
I have a TextBox control with a databings to a dataset.column name. The MaxLength property is 2000 bytes. When I enter data e.g. 1957 bytes and do a Update the screen remains complete, but if I...
9
by: Sean | last post by:
I am using a datagrid to display some data. I notice when I click in a cell where the data is longer than the cell width, it truncates the end of the data off. For example: The data is: This...
2
by: coolnoff | last post by:
I have a dts which creates a table which is utilized on my local intranet. The DTS runs without error and the table is created/populated/transfered to the appropriate db. Then it appears that...
1
by: Serman D. | last post by:
Background: The Payment Card Industry (PCI) Data Security Standard (PCI DSS) is a standard for financial institutions. It requires sensitive information, such as credit card numbers, to be...
2
by: david | last post by:
I've noticed that the following compiles (as C) under both VS8 and gcc with no warnings, even though there's a possibility of data truncation from enum to unsigned char. It does generate a warning...
13
by: chromis | last post by:
Hi, I have a query which updates the projects table of my database, however when I try to run my query with blank values i get the following error: Data truncation: Data truncated for column...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.