Harendra Sahani

Greenhorn
+ Follow
since May 11, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Harendra Sahani

Thanks a lot for you valuable suggestion
I am quite comfortable in HTML, I want to try my hands at html 5, could you please suggest one good book for deep knowdlge of HTML 5
how should I approach for a career in Big data analytics? I am a java developer with experience in content management applications and tools
11 years ago
Hi,
i have to modify a code in my project which is importing class com.ibm.websphere.security.auth.WSSubject and class com.ibm.websphere.security.auth.callback.WSCallbackhandlerImpl
but i could not able to build my project as the jar files are missing.i want to know what are the JAR files that might contain this classes.i have checked and imported a lot of jar i think it should related to it but of no avail
Please Help.

Thanks
14 years ago
When i run the code it shows the messages i.e
[Message on HTML page]
Update
just Go to servlet

[after clicking submit button]
Start Updation
check if update

But it does not insert the data into the MS Access DB file as it happend with the pure java code.
Hi
I have update my code as per suggested by Bear Bibeault but even though after using servlet which in turn calling a POJO,it doesnot get me the desired result.I have tried several times but wihtout success.Please suggest how to modify the given below code:

[HTML]
<html>
<body style="background-color:gray">
<h1 align ="center">Update</h1>
<form method ="POST" action="check.do" >
Just go to servlet





<input type="SUBMIT">
</form>
</body>
</html>

SERVLET CODE
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
*
* @author Harendra.Sahani
*/
public class Trial extends HttpServlet {

/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out =response.getWriter();
out.println(" start updation
");
OdbcConnection od = new OdbcConnection();
od.updataDB();
out.println("check if updated
");
}
}

JAVA CODE:
import java.sql.*;
public class OdbcConnection {


public String updataDB(){
Connection con = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;

// Connect with a url string
con = DriverManager.getConnection("jdbc:odbc:Sample");
System.out.println("Connection ok.");
Statement sta =con.createStatement();
int c = sta.executeUpdate("INSERT INTO Customers"
+ " (ID, FirstName, SurName)"
+ " VALUES (1, 'Nitin', 'kanujia')");

sta.close();
con.close();
} catch (Exception e) {
System.err.println("Exception: "+e.getMessage());
}
return("You have checked my code");
}

}

Thanks Bear Bibeault for the suggestion,but I have one html page where i have to implement this functionality.Is there any way to call Java class from a HTML page?I am restricted to use that simple HTML page to implement this funtionality.Thats leave me no other choice than to use JSP(As far as my knowledge concerned).Please suggest any otherway to implement this.
Hi
I am using jsp to insert data into MS Access using JSP. Functionality is such that there is a simple HTML form having a submit button
which is calling a JSP.The JSP connect to MS Access file and should update the values.The same code when i used with JAVA it is giving me the desired result but not with JSP.Please help..

HTML CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form METHOD="POST" action="CreateConnection.jsp" >
<input type="button" value="submit" /> //i have used input type submit also
</body>
</html>

JSP CODE
//CreateConnection.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%@ page import="java.util.*" %>
<%@ page import="javax.sql.*;" %>

<%
java.sql.Connection con = null;
java.sql.Statement sta = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
out.println("Connection ok.");
sta =con.createStatement();
int c = sta.executeUpdate("INSERT INTO Customers"
+ " (ID, FirstName, SurName)"
+ " VALUES (2, 'raju', 'rama')");

sta.close();
con.close();
}catch (Exception e) {
System.err.println("Exception: "+e.getMessage());
}


%>
<h1>hellooooo</h1>
</body>
</html>
Hi,
I am required to insert some data into an access file using javaScript Though the code is inserting the values properly but i am getting an JS Error."operation is not allowed when object is closed"
Here is the code
please suggest how should i close the rs?(you will know "rs" whenyou see the code)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)" />
<meta name="created" content="Wed, 19 Aug 2009 06:14:01 GMT" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />



<script language="JavaScript" >

function getSubmit()
{
var LastName = "Kanujia";
var Firstn = "Nitin" ;

var cn = new ActiveXObject("ADODB.Connection");

//here you must use forward slash to point strait
var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:/clientDB.mdb";

var rs = new ActiveXObject("ADODB.Recordset");

var SQL = "INSERT INTO Customers(FirstName, Surname)"
+ " VALUES ( '"+ Firstn +"', '" + LastName +"')";



cn.Open(strConn);

rs.Open(SQL, cn);

//surname.value = rs(0);


rs.Close();

cn.Close();


}
</script>

</head>
<body>
<input type="button" value="submit" onclick="getSubmit()">
</body>
</html>