This week's book giveaway is in the Spring forum.
We're giving away four copies of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 and have Marten Deinum & Iuliana Cosmina on-line!
See this thread for details.
Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

Praveen Kumar Singh

Greenhorn
+ Follow
since Oct 05, 2009
Praveen Kumar likes ...
IBM DB2 Oracle MySQL Database
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
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Praveen Kumar Singh

Hi,

Can some one suggest me a good book(possibly Soft copy) to learn APEX...
7 years ago
Thanks but when i am writing a select statement the Zero(0). when i inserted i pass the value with Zero.


7 years ago
HI,

I have to store a account no which is 12(112345678900) digit in length. so in create statement can i use CHAR instead or NUMBER.

PKS
7 years ago
Thanks it got fixed after i change the code.

CREATE OR REPLACE TRIGGER ADDING_NEW
BEFORE INSERT ON TESTING
FOR EACH ROW
BEGIN
:NEW.TOTAL:=:NEW.NUM1+:NEW.NUM2;
END;
7 years ago
what is the error in below trigger.



7 years ago
Hi,

i am having privilege to create Trigger & i am creating for the 1st time. how can i compile the same on through SQLPLUS CMD. like the way use to alter we use "ALTER TRIGGER <TRIGGER NAME> compile."

I USER "EDIT" TO CREATE THE SAME.

its showing below exception:-ORA-04080: TRIGGER 'ADDING' DOES NOT EXIST.

7 years ago
Hi,

Well you need to install Java Development Kit-6 to make the same will work for more detail please check the below mentioned URL.

http://developer.android.com/sdk/index.html

Praveen Kumar Singh
10 years ago
hi,

i am creating a page where i need to give user access to some pages on the basic of his role.

this page can be common for all user or may be there will be different pages on the basic of his role.

Please help me on this & tell me how can i do this.

Praveen Kumar Singh
10 years ago
JSP
Hi,

i have made some changes in query & now the same is working fine.

The changes which i have made is mentioned below.

String sql = "INSERT INTO user(user,password) VALUES ('"+username+"','"+password+"' )";
String sql1 = "insert into user_info(FNAME,MNAME,LNAME, user)values('"+firstname+"','"+middlename+"','"+lastname+"','"+username+"')";


Thanks every one for Help.

Praveen Kumar Singh
Hi Abhishek & Paul Sturrock

insert into login_detail set name = 'username' + password='password'

The parameter which i have marked in red.. these value will not be replaced with the one i am accepting thorough jsp. this is my concern.

Paul Sturrock wrote:


String sql = "insert into login_detail set name='"+username+"'+ password='"+password+"'";


looks like it may just be a poor quality error message from MySQL. This would resolve to the SQL statement:


Which is invalid SQL. My guess is your use of the plus sign make MySQL think its dealing with numeric fields.



Sorry but the query which you have mentioned is wrong.
CREATE TABLE Login_Detail(NAME CHAR(15) NOT NULL UNIQUE, PASSWORD INTEGER (10) DEFAULT NULL);
CREATE TABLE User_info(FNAME CHAR(10), MNAME CHAR(10), LNAME CHAR(10),NAME CHAR(15) NOT NULL UNIQUE);
this is my register.jsp code

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>New User Register page</title>
<script language="Javascript">
function Validate() {
var fname = document.regform.fname
var mname = document.regform.mname
var lname = document.regform.lname
var uname = document.regform.uname
var pass = document.regform.pass
var confpass = document.regform.confpass
if ((fname.value==null) || (fname.value=="")) {
alert("Please Enter First Name")
fname.focus()
return false
}
if ((mname.value==null) || (mname.value=="")) {
alert("Please Enter Middle Name")
mname.focus()
return false
}
if ((lname.value==null) || (lname.value=="")) {
alert("Please Enter Last Name")
lname.focus()
return false
}
if ((uname.value==null) || (uname.value=="")) {
alert("Please Enter Username")
uname.focus()
return false
}
if ((pass.value==null) || (pass.value=="")) {
alert("Please Enter user Password")
pass.focus()
return false
}
if ((confpass.value==null) || (confpass.value=="")) {
alert("Please Enter Confirm Password")
confpass.focus()
return false
}
return true
}
</script>
</head>
<body>
<form name="regform" action="RegisterServlet" method="Post"
onSubmit="return Validate()">
<table align="center" style="background-color: ffeeff;">
<tr>
<td colspan=2 style="font-weight: bold; font-size: 20pt;"
align="center">New User Registeration</td>
</tr>
<tr>
<td colspan=2> </td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" name="fname" value=""></td>
</tr>
<tr>
<td>Middle Name</td>
<td><input type="text" name="mname" value=""></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="lname" value=""></td>
</tr>
<tr>
<td>Login Name</td>
<td><input type="text" name="uname" value=""></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="pass" value=""></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" name="confpass" value=""></td>
</tr>
<tr align="center">
<td><input type="submit" name="Submit" value="Save User"></td>
<td><input type="Reset" name="Reset" value=" Reset"></td>
</tr>
</table>
</form>
</body>
</html>

This is my RegisterServlet code.


import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class RegisterServlet extends HttpServlet{
private static final long serialVersionUID = 1L;
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException{
PrintWriter out = response.getWriter();
Connection connection=null;
String firstname=request.getParameter("fname");
String middlename=request.getParameter("mname");
String lastname=request.getParameter("lname");
String username=request.getParameter("uname");
String password=request.getParameter("pass");
try {
Class.forName("com.mysql.jdbc.Driver");
String URL = "jdbc:mysql://localhost:3306/webapplication";
connection = DriverManager.getConnection(URL, "root", "admin");
out.println(username);
out.println(password);
String sql = "insert into login_detail set name='"+username+"'+ password='"+password+"'";
// String sql1 = "insert into user_info set FNAME='"+firstname+"'+ MNAME='"+middlename+"' + LNAME='"+lastname+"'+ name='"+username+"'";
Statement s = connection.createStatement();
out.println(sql);
// out.println(sql1);
int i = s.executeUpdate(sql);
// int j = s.executeUpdate(sql1);
if(i>0)
{
response.sendRedirect("Record Updated sucessfully");
}
s.close();
}
catch(Exception e){
System.out.println("Exception is ;"+e);
}
}
}
rocker is the user name using which i am trying to register as new user from my register.jsp