2

I have a java web application and i did mysql connection in using a java file and i want to schedule a job to every week in my web application.

here is my java file sample

public class DbFunction {

    public static DataSource dataSource;

    public static Connection getConnection_4main() throws SQLException {

        Connection connection = null;
        System.out.println("Cant create a Connection");
        connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/" + Constants.TC_DB_NAME + "", "root",
                "mysql");
        return connection;
    }
}

and my jsp file is here

<%@page import="net.sf.json.JSONArray"%>
<%@ page import= "java.sql.*" %>
<%@ page import= "java.util.*"%>
<%@page trimDirectiveWhitespaces="true"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:useBean id= "dbfunc" scope="session" class= "package.DbFunction" />
<%
try{    
String dailyscheduleidlist=request.getParameter("dailyscheduleidlist");
String []dailyscheduleidarray=dailyscheduleidlist.split("_"); 
boolean b = dbfunc.removeDailyScheduleBulk(dailyscheduleidarray);    
out.print(b);
}
catch(Exception ex){    
    throw ex;
}
finally
{   
}   
%>
nbrooks
  • 18,126
  • 5
  • 54
  • 66
Vaibhav
  • 485
  • 6
  • 12
  • 1
    Possible options mentioned in another thread: http://stackoverflow.com/questions/7814089/how-to-schedule-a-periodic-task-in-java – Sanket Sarang Oct 22 '16 at 08:55
  • ya i referred that but in my java file there is no main file according to our need i called java function from the jsp page, my doubt is if i write the code in that java file is it work or not, please help, and also i am not used any framework its wrote on pure java – Vaibhav Oct 22 '16 at 09:01

0 Answers0