473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

can i KNOW WHATS WRONG IN THIS

<html>
<body>
<%@ page import="java.sql.*" %>
<%

Connection con=null;
Statement st=null;

ResultSet rs= null;


try{
Class.forName("org.gjt.mm.mysql.Driver").newInstan ce();
}

catch(Exception e)
{
out.println("Unable to load driver"+e.getMessage());
}
try
{
String MYSQL_HOST = "richese.csci.unt.edu";
String MYSQL_DB = "rp0110";
String MYSQL_USER = "rp0110";
String MYSQL_PASSWD = "rp0110";
String MYSQL_TABLE = "client";
con = DriverManager.getConnection(
"jdbc:mysql://" + MYSQL_HOST + "/" + MYSQL_DB +
"?user=" + MYSQL_USER + "&password=" + MYSQL_PASSWD);

}//end try
catch(Exception e){
out.println("error connecting to DataBase "+e);
}//end catch
try{
String username = request.getParameter("username");
String password = request.getParameter("password");
String technology = request.getParameter("technology");
String experience = request.getParameter("experience");
String qualification = request.getParameter("qualification");
String skills = request.getParameter("skills");
String adress = request.getParameter("address");

String email = request.getParameter("email");


st = con.createStatement();

String selqry = "select nvl(max(jobseekerid),0) from job_seekers";

rs = st.executeQuery(selqry);

int maxvalue=0;

if(rs.next())

maxvalue = Integer.parseInt(rs.getString(1))+1;

String insqry = "insert into jobseekers values("+maxvalue+
",'"+username+"','"+password+"','"+technology+
"',"+experience+",'"+qualification+"','"+skill s+
"','"+adress+"','"+email+"')";

int rowsaffected = st.executeUpdate(insqry);

if(rowsaffected > 0)
{
con.commit();
out.println("Thanks for registering<br> with us <br>");
}
st.close();
con.close();



}
catch(Exception e)
{
String message = e.getMessage();

}
finally
{
st.close();
con.close();
}
%>
</body>
</html>
Oct 16 '07 #1
1 1134
JosAH
11,448 Expert 8TB
(see title)

Yes, I know what's wrong here:

1) you shouldn't make database connections in a jsp file; leave that to the logic
delegated to by a Servlet and pass the results to the jsp file instead.

2) you forgot to use [ code ] ... [ /code ] tags. The text is hardly readable now.

kind regards,

Jos
Oct 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris Geerdink | last post by:
combo with PHP. what is wrong with the Javascript? else { include("mysql.php"); $query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES ('".$_POST."', '".$_POST."',...
1
by: '~=_Slawek_=~' | last post by:
$DOW = (jddayofweek(unixtojd(mktime(1, 1, 1, $month, $day, $year)))+6)%7; $DOW= (jddayofweek(juliantojd($month, $day, $year))+6)%7; The results are supposed to be the same, but they are not....
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
4
by: ryann18 | last post by:
What is wrong with this?? Here are the two classes...SandBox and KittyKitty?? I need to also know what happens if two or more values are equal and if exactly two values are equal, does it matter...
5
by: islayer | last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.