Results 1 to 3 of 3
  1. #1
    shiva.b is offline Member
    Join Date
    Mar 2010
    Posts
    4
    Rep Power
    0

    Default How and Where to Add SYSDATE in the below program.

    Hi i am not able to progress with the below code, can any one please help me in solving the problem.

    Actuall the below code is getting data from the to SQL data base where i got Servername, path, filename, Requested time, Start date and end date.

    Strart date and end date should be null and where i hard coded in the data base and the status to be fixed as sheduled even this i hard coded in the db.

    but he requested time should be the systime. which i need to added that in the below code.

    There is a GUI, where when you click on the zip file in that gui, the start date and end date as i said are set to null and the status as schedled. and at the same time now the requested time should be the set as the systime.

    So can any one please help me in solving my problem where can i add the sysdate in the below jsp code.

    Thanks in advance.

    <%@ page import="com.verizon.vzedge.dbconn.WeblogicConnecti onPool" %>
    <%@ page import="com.verizon.vzedge.common.GISLogger" %>
    <%@ page import="java.sql.PreparedStatement" %>
    <%@ page import="java.sql.Connection" %>
    <%@ page import="java.sql.ResultSet" %>
    <%
    response.setContentType("text/html");
    response.setHeader("Cache-Control","no-cache");

    GISLogger log = GISLogger.getInstance();
    Connection cn = null;
    ResultSet rs= null;

    try
    {

    String serverName = request.getParameter("servername");
    String remoteDir = request.getParameter("path");
    String remoteFile = request.getParameter("filename");
    //String status = request.getParameter("status");

    //We have to replace -BKSLSH- with \ in path and use it.
    remoteDir = remoteDir.replaceAll("-BKSLSH-","\\\\");

    cn = WeblogicConnectionPool.getConnection();

    int cnt = 0;

    String sqlCount = "select count(1) from county_lotlinepath where servername=? and remote_dir =? and filename=?";
    String status="SCHEDULED";
    PreparedStatement pstmt = cn.prepareStatement(sqlCount);
    pstmt.setString(1,serverName );
    pstmt.setString(2,remoteDir );
    pstmt.setString(3,remoteFile);
    //pstmt.setString(4,status);
    rs = pstmt.executeQuery();

    while(rs.next())
    cnt = rs.getInt(1);

    if(cnt == 0)
    {
    String sql = "insert into county_lotlinepath(servername, remote_dir, filename, status) values (?,?,?,?)";

    pstmt = cn.prepareStatement(sql);
    pstmt.setString(1,serverName );
    pstmt.setString(2,remoteDir );
    pstmt.setString(3,remoteFile);
    pstmt.setString(4, status);

    pstmt.executeUpdate();
    cn.commit();
    pstmt.close();
    %>
    alert("Selected County Zip file is queued for Processing");
    <%
    }
    else
    {
    %>
    alert("Selected County Lotline File was already chosen for processing. Please select ANOTHER File!!!");
    <%
    }
    }
    catch(Exception e)
    {
    %>
    alert("Enountered an issue while saving file path to database - <%=e.toString()%>");
    <%
    log.problem(this,"Exception at query :"+e.toString());
    }
    finally
    {
    try
    {
    if(cn != null)
    cn.close();
    }
    catch(Exception e)
    { log.fatal(this,"Unable to close connection - SavePathParcelloading.jsp"); }
    }
    %>
    $('btnFtpOpen').disabled = false;

  2. #2
    javastuden's Avatar
    javastuden is offline Senior Member
    Join Date
    Nov 2009
    Posts
    157
    Rep Power
    5

    Default

    hi,
    i didn't get you what you actually mean in the request

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

Similar Threads

  1. changing my program to array working program
    By Chewart in forum New To Java
    Replies: 39
    Last Post: 11-18-2009, 06:53 PM
  2. Execute A program from a Program!
    By Moncleared in forum Advanced Java
    Replies: 2
    Last Post: 02-22-2009, 04:17 PM
  3. Regarding sysdate
    By adeeb in forum JDBC
    Replies: 0
    Last Post: 06-10-2008, 06:56 PM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •