cancel
Showing results for 
Search instead for 
Did you mean: 

Regd: Insert DATE into Dictionary Table

Former Member
0 Kudos

Hi All,

I've problems in inserting the Date value into java dictionary table (Oracle is the backend). i'm getting the below error: "type check error: new value (element number 2) is not assignable to column". what is the format it accepts while inserting date?

i've done almost all the possible ways to insert the date into dictionary table. plz suggest me if there are any other ways or i'm i missing anything?

tnx,

-JB

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi,

Which type of date object you are using?

java.util.Date  or  java.sql.Date;

For backends such as SAP R/3 accept only java.sql.Date they don't accept java.util.Date. Just check this too. You can check in import statements which type of Date is being used.

You can initialize it as

Date today = new Date(System.currentTimeMillis());

regards,

Siva

Former Member
0 Kudos

hi Siva,

thanks for your comments. i'm using java.sql.Date only, where ever required to insert into DB. i guess this is the problem with OpenSQL (Open JDBC) framework which is not accepting any kind of date format while inserting.

and when i print the insert statement the value portion looks like : "... VALUES (1,(2009 - 😎 - 7)", dont understand wt is that??

i've just tried "Date today = new Date(System.currentTimeMillis());"

its giving the same error it gave me before, below is the error:

type check error: new value (element number 2(SMALLINT)) is not assignable to column >>SDATE<<(DATE)

i hope this error will give you some idea toward the solution, i'm tried with all the options. even PrepareStatements are not supported by Open JDBC framework.

tnx,

-JB

former_member197348
Active Contributor
0 Kudos

Hi JB,

I am not sure but I guess the problem is with the format of the Date. First try to find which format it is storing the date. fetch any date object from SQL table into String object and print it. Then try to pass in the format it accepts.

Regards,

Siva

Former Member
0 Kudos

Hi,

"... VALUES (1,(2009 - 😎 - 7)",

Looks like you are using java.sql.Statement for executing the query, use java.sql.PreparedStatement instead of it.

Check this [link|http://help.sap.com/saphelp_nw04s/Helpdata/EN/6c/7784ac804be2419f957e8434be6a07/content.htm] for more information.

Thanks,

MS

Answers (0)