java - ResultSet is empty, event though the sql query is ok -


i have following stored procedure:

alter procedure uspinformation3 (@typenr    varchar(50),                                   @process   varchar(50),                                   @startdate varchar(50),                                   @enddate   varchar(50))     begin try        set dateformat dmy;         select count(rownr)          diff_ct         type_number = @typenr               , process = @process               , full_time_stamp between @startdate , @enddate    end try  

if execute procedure sql server, gives me wanted answer

exec uspinformation3 1137328582, 427,                       {ts '2015-05-24 12:00:00'}, {ts  ' 2015-05-24 16:00:00 '} 

but, when try java, result set empty. doing mistake? guess has data types using?

 try {                 class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver").newinstance();                 connection conn = drivermanager.getconnection(db_connection);                string partno = pn.gettext();               string processname = procname.gettext();             // string starttime =  datastart.gettext();         string starttime = "{ts " +"'"+ datastart.gettext() +"'}";               string endtime = "{ts " +"'"+ datafinal.gettext()+"'}";         system.out.println(starttime);               statement state = conn.createstatement();      callablestatement cs = null;        cs = conn.preparecall("{call uspinformation3(?,?,?,?)}");         cs.setstring(1, partno);         cs.setstring(2, processname);         cs.setstring(3, starttime);         cs.setstring(4, endtime);         cs.executequery();         resultset rs = cs.getresultset();         system.out.println(rs);         if(rs.next()) {                 string totalct = rs.getstring(1);                system.out.println(totalct);            totalctno.settext(totalct);                                  } 

did try send parameter string? or change parameter type datetime

also there spaces there on second date.

exec uspinformation3 1137328582, 427,                       '2015-05-24 12:00:00', '2015-05-24 16:00:00'; 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -