473,782 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can i KNOW WHATS WRONG IN THIS

1 New Member
<html>
<body>
<%@ page import="java.sq l.*" %>
<%

Connection con=null;
Statement st=null;

ResultSet rs= null;


try{
Class.forName(" org.gjt.mm.mysq l.Driver").newI nstance();
}

catch(Exception e)
{
out.println("Un able to load driver"+e.getMe ssage());
}
try
{
String MYSQL_HOST = "richese.csci.u nt.edu";
String MYSQL_DB = "rp0110";
String MYSQL_USER = "rp0110";
String MYSQL_PASSWD = "rp0110";
String MYSQL_TABLE = "client";
con = DriverManager.g etConnection(
"jdbc:mysql ://" + MYSQL_HOST + "/" + MYSQL_DB +
"?user=" + MYSQL_USER + "&password= " + MYSQL_PASSWD);

}//end try
catch(Exception e){
out.println("er ror connecting to DataBase "+e);
}//end catch
try{
String username = request.getPara meter("username ");
String password = request.getPara meter("password ");
String technology = request.getPara meter("technolo gy");
String experience = request.getPara meter("experien ce");
String qualification = request.getPara meter("qualific ation");
String skills = request.getPara meter("skills") ;
String adress = request.getPara meter("address" );

String email = request.getPara meter("email");


st = con.createState ment();

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

rs = st.executeQuery (selqry);

int maxvalue=0;

if(rs.next())

maxvalue = Integer.parseIn t(rs.getString( 1))+1;

String insqry = "insert into jobseekers values("+maxval ue+
",'"+username+" ','"+password+" ','"+technology +
"',"+experience +",'"+qualifica tion+"','"+skil ls+
"','"+adress+"' ,'"+email+"') ";

int rowsaffected = st.executeUpdat e(insqry);

if(rowsaffected > 0)
{
con.commit();
out.println("Th anks 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 1146
JosAH
11,448 Recognized Expert MVP
(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
2395
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."', '".$_POST."')"); ?> <script language="JavaScript"> <!--
1
2499
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. Whats wrong? Any clues?
7
2231
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 me why? Its probably sooooooo obvious, but it is 1.19 am! Thanks. www.thunderin.co.uk/
4
1982
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 whether the equal values are lower or higher than the third?? And can somebody please help me answer the questions at the bottom??? //A place to play with your kitty public class SandBox { public static void main(String args) {...
5
2321
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 the number. whats wrong with my code? #!/usr/bin/perl use Fcntl; @array = (a..z); srand; foreach (1..5) { $name = int(rand scalar(@array));
0
9641
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.