Tuesday, 15 July 2014

how to match the system date time format with the sql parameters datetime type in java -



how to match the system date time format with the sql parameters datetime type in java -

when run jsp page:

exception in display bean in getdbtable(string code): com.microsoft.sqlserver.jdbc.sqlserverexception: error converting info type varchar datetime

is displayed. have stored procedure has parameters of datetime type. create dynamic stored scheme date , time in variable , passed argument of stored procedure sql command:

clstmt = con.preparecall("exec vcs_gauge 'vs1_bag','d','currentdate'") ;

you need like:

clstmt = con.preparecall("exec vcs_gauge 'vs1_bag', 'd', :date"); clstmt.setdate("date", new java.sql.date(currentdate.gettime())); // assumes currentdate j.u.date

see callablestatement#setdate(java.lang.string,java.sql.date)

java sql datetime

No comments:

Post a Comment