|
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)
HXTT ACCESS
|
SQLException.getNextException() having further error message |
Daniel Kim |
2006-01-10 00:00:00 |
hi!
I am inserting oracle data into Access and this stmt works in Access, but doesn't work in java code and have this error msg and I using HXTT driver. How do I get further exception message? (other similiar insert stmts work, but not this one.)
INSERT INTO [Med Prof Work History]([Med Prof Record No], [Order], [WorkFromDate], [WorkThruDate], [CompanyName], [WorkAddress], [WorkAddress2], [WorkCity] ,[WorkState], [WorkCountry], [WorkZipCode], [PositionHeld], [ContactName], [ContactTitle], [WorkPhone], [WorkFaxNumber],[Comments],[LastUpdated], [UpdatedBy])
VALUES (245, 1, '11/1990', '01/2000', 'sdfgsdfg', 'sdfsg', 'sdfsg', 'sdfg', 'AK', 'United States', '21133', 'asdfasdf', 'asdfas', 'asdfa', '2222222222', '222 222 2222', 'asdfa', '10/01/2006', 'cred')
Error(resultDAO): java.sql.SQLException: Failed to insert a new record into table Med Prof Work History! For more information, please use SQLException.getNextException().
thx,
|
Re:SQLException.getNextException() having further error message |
Daniel Kim |
2006-01-10 00:00:00 |
Data types for the Access table is the following:
[Med Prof Record No], [Order] --> Number
[WorkFromDate], [WorkThruDate],[LastUpdated]--> Date/time
others --> Text
+++++++++++++++++++++++++
String insertSql = "INSERT INTO " + "[Med Prof Work History]" + "(" +
"[Med Prof Record No]," +
"[Order]," +
"[WorkFromDate]," +
"[WorkThruDate]," +
"[CompanyName]," +
"[WorkAddress]," +
"[WorkAddress2]," +
"[WorkCity]," +
"[WorkState]," +
"[WorkCountry]," +
"[WorkZipCode]," +
"[PositionHeld]," +
"[ContactName]," +
"[ContactTitle]," +
"[WorkPhone]," +
"[WorkFaxNumber]," +
"[Comments]," +//reason for leaving
"[LastUpdated], " +
"[UpdatedBy]) " +//19
//TO_CHAR(WorkFromDate, 'MM/YYYY')
"VALUES ("+accessMedProfRecordNo+", " +
""+orderNo+", " +
//"TO_CHAR([WorkFromDate],"+"'"+Converters.convertDateMMYYYY((String)hm.get("date_from"))+"'), " +
//"TO_CHAR([WorkThruDate],"+"'"+Converters.convertDateMMYYYY((String)hm.get("date_to"))+"'), " +
"'"+Converters.convertDateMMYYYY((String)hm.get("date_from"))+"', " +
"'"+Converters.convertDateMMYYYY((String)hm.get("date_to"))+"', " +
"'"+(String)hm.get("company_name")+"', " +
"'"+(String)hm.get("address_one")+"', " +
"'"+(String)hm.get("address_two")+"', " +
"'"+(String)hm.get("city")+"', " +
"'"+(String)hm.get("state")+"', " +
"'"+(String)hm.get("country")+"', " +
"'"+(String)hm.get("zip")+"', " +
"'"+(String)hm.get("position")+"', " +
"'"+(String)hm.get("contact_name")+"', " +
"'"+(String)hm.get("contact_title")+"', " +
"'"+(String)hm.get("phone")+"', " +
"'"+(String)hm.get("fax")+"', " +
"'"+(String)hm.get("reason_leaving")+"', " +
"'"+Converters.getDateTimeMMDDYYYY()+"', " +
"'"+Constants.WHOLOGGEDIN+"') ";//19
|
Re:Re:SQLException.getNextException() having further error message |
HXTT Support |
2006-01-10 00:00:00 |
You can use:
catch( SQLException sqle )
{
do
{
System.out.println(sqle.getMessage());
System.out.println("Error Code:"+sqle.getErrorCode());
System.out.println("SQL State:"+sqle.getSQLState());
sqle.printStackTrace();
}while((sqle=sqle.getNextException())!=null);
}
I guess that your issue was resulted by '11/1990', '01/2000', '10/01/2006', you should use '1990/11/1', '2000/01/01', and '20006/10/01' in sql.
|
Re:Re:Re:SQLException.getNextException() having further error message |
HXTT Support |
2006-01-10 00:00:00 |
I guess that you can try to replace:
Converters.convertDateMMYYYY((String)hm.get("date_from")) with hm.get("date_from") since HXTT Access can guess most of 'yyyy-mm-dd', 'yyyy-m-d', and so on. What's your original date string format?
Converters.getDateTimeMMDDYYYY() with now() or date() function;
|
|
|