Poor Performance of the Demos - help please
I finally got the demos to run after figuring out that they had the wrong database port (19092 instead of 29092) configured by default.
The Vehicle Incident Report application runs fine, except for responsiveness.
Should I expect over a second delay between clicking a button and something displaying on the screen when it is running on local host, with a p4 2.6ghz machine running linux with 1.5GB of memory in Firefox 1.0.7?
On the first impression, I don't mind (initial compilation I expect), but subsequent impressions I would expect things to be lightning fast.
Sometimes they are lightning fast, if, for example, I swap between two pages in quick succession but if I click on the tabs from left to right then towards the left again, zzzz.
I have tried setting up the HTTP monitor but the timestamps recorded are pretty useless for this sort of thing, having a resolution of minutes (microseconds or even seconds would have been handy)
I have captured the TCP packets on local host using
tcpdump -A -s 256 -i lo 'tcp port 28080 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'and filtered them a bit.
For example, in the VIR app, I clicked on each of the tabs one after the other and then generated the following output by looking for POST then looking for the next GET. (on the assumption the first communication is the POST and the last communicatoin is a GET - not entirely true, I am sure, but good enough for illustration purposes).
As you can see, the delays between the post and the GET can be quite long.
18:04:29.288087 POST /VehicleIncidentReportApplication/faces/Profile.jsp HTTP/1.1
18:04:29.820572 GET /favicon.ico HTTP/1.1
18:04:30.849785 POST /VehicleIncidentReportApplication/faces/SearchAVehicle.jsp HTTP/1.1
18:04:31.269366 GET /favicon.ico HTTP/1.1
18:04:32.381863 POST /VehicleIncidentReportApplication/faces/Profile.jsp HTTP/1.1
18:04:38.014451 GET /VehicleIncidentReportApplication/theme/com/sun/rave/web/ui/defaulttheme-gray/javascript/table.js HTTP/1.1
18:04:40.852971 POST /VehicleIncidentReportApplication/faces/Vehicles.jsp HTTP/1.1
18:04:49.233314 GET /favicon.ico HTTP/1.1
18:04:53.156757 POST /VehicleIncidentReportApplication/faces/Help.jsp HTTP/1.1
18:04:58.777153 GET /favicon.ico HTTP/1.1
18:05:00.288716 POST /VehicleIncidentReportApplication/faces/Vehicles.jsp HTTP/1.1
18:05:05.938047 GET /favicon.ico HTTP/1.1
18:05:06.934621 POST /VehicleIncidentReportApplication/faces/Profile.jsp HTTP/1.1
18:05:07.320218 GET /favicon.ico HTTP/1.1There is no way I am going to proceed with this app using jsCreator if this is how fast they run.
Where would I start looking?
Any help would be appreciated.
I am not entirely sure its the databases fault.
I have MySQL setup as my data source for my app in jsCreator2 and it is still glacial in speed.
Runs fine in Tomcat though.
Thanks for the reply though,
...Lyall
Similar Messages
-
How to improve the performance of the attached query, Please help
Hi,
How to improve performance of the below query, Please help. also attached explain plan -
SELECT Camp.Id,
rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount,
(SUM(rCam.Impressions) * 0.001 + SUM(rCam.Clickthrus)) AS GR,
rCam.AccountKey as AccountKey
FROM Campaign Camp, rCamSit rCam, CamBilling, Site xSite
WHERE Camp.AccountKey = rCam.AccountKey
AND Camp.AvCampaignKey = rCam.AvCampaignKey
AND Camp.AccountKey = CamBilling.AccountKey
AND Camp.CampaignKey = CamBilling.CampaignKey
AND rCam.AccountKey = xSite.AccountKey
AND rCam.AvSiteKey = xSite.AvSiteKey
AND rCam.RmWhen BETWEEN to_date('01-01-2009', 'DD-MM-YYYY') and
to_date('01-01-2011', 'DD-MM-YYYY')
GROUP By rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount
Explain Plan :-
Description Object_owner Object_name Cost Cardinality Bytes
SELECT STATEMENT, GOAL = ALL_ROWS 14 1 13
SORT AGGREGATE 1 13
VIEW GEMINI_REPORTING 14 1 13
HASH GROUP BY 14 1 103
NESTED LOOPS 13 1 103
HASH JOIN 12 1 85
TABLE ACCESS BY INDEX ROWID GEMINI_REPORTING RCAMSIT 2 4 100
NESTED LOOPS 9 5 325
HASH JOIN 7 1 40
SORT UNIQUE 2 1 18
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY SITE 2 1 18
INDEX RANGE SCAN GEMINI_PRIMARY SITE_I0 1 1
TABLE ACCESS FULL GEMINI_PRIMARY SITE 3 27 594
INDEX RANGE SCAN GEMINI_REPORTING RCAMSIT_I 1 1 5
TABLE ACCESS FULL GEMINI_PRIMARY CAMPAIGN 3 127 2540
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY CAMBILLING 1 1 18
INDEX UNIQUE SCAN GEMINI_PRIMARY CAMBILLING_U1 0 1Hello,
This has really nothing to do with the Oracle Forms product.
Please, send the SQL or/and PL/SQL questions in the corresponding forums.
Francois -
Poor performance of the BDB cache
I'm experiencing incredibly poor performance of the BDB cache and wanted to share my experience, in case anybody has any suggestions.
Overview
Stone Steps maintains a fork of a web log analysis tool - the Webalizer (http://www.stonesteps.ca/projects/webalizer/). One of the problems with the Webalizer is that it maintains all data (i.e. URLs, search strings, IP addresses, etc) in memory, which puts a cap on the maximum size of the data set that can be analyzed. Naturally, BDB was picked as the fastest database to maintain analyzed data on disk set and produce reports by querying the database. Unfortunately, once the database grows beyond the cache size, overall performance goes down the drain.
Note that the version of SSW available for download does not support BDB in the way described below. I can make the source available for you, however, if you find your own large log files to analyze.
The Database
Stone Steps Webalizer (SSW) is a command-line utility and needs to preserve all intermediate data for the month on disk. The original approach was to use a plain-text file (webalizer.current, for those who know anything about SSW). The BDB database that replaced this plain text file consists of the following databases:
sequences (maintains record IDs for all other tables)
urls -primary database containing URL data - record ID (key), URL itself, grouped data, such as number of hits, transfer size, etc)
urls.values - secondary database that contains a hash of the URL (key) and the record ID linking it to the primary database; this database is used for value lookups)
urls.hits - secondary database that contains the number of hits for each URL (key) and the record ID to link it to the primary database; this database is used to order URLs in the report by the number of hits.
The remaining databases are here just to indicate the database structure. They are the same in nature as the two described above. The legend is as follows: (s) will indicate a secondary database, (p) - primary database, (sf) - filtered secondary database (using DB_DONOTINDEX).
urls.xfer (s), urls.entry (s), urls.exit (s), urls.groups.hits (sf), urls.groups.xfer (sf)
hosts (p), hosts.values (s), hosts.hits (s), hosts.xfer (s), hosts.groups.hits (sf), hosts.groups.xfer (sf)
downloads (p), downloads.values (s), downloads.xfer (s)
agents (p), agents.values (s), agents.values (s), agents.hits (s), agents.visits (s), agents.groups.visits (sf)
referrers (p), referrers.values (s), referrers.values (s), referrers.hits (s), referrers.groups.hits (sf)
search (p), search.values (s), search.hits (s)
users (p), users.values (s), users.hits (s), users.groups.hits (sf)
errors (p), errors.values (s), errors.hits (s)
dhosts (p), dhosts.values (s)
statuscodes (HTTP status codes)
totals.daily (31 days)
totals.hourly (24 hours)
totals (one record)
countries (a couple of hundred countries)
system (one record)
visits.active (active visits - variable length)
downloads.active (active downloads - variable length)
All these databases (49 of them) are maintained in a single file. Maintaining a single database file is a requirement, so that the entire database for the month can be renamed, backed up and used to produce reports on demand.
Database Size
One of the sample Squid logs I received from a user contains 4.4M records and is about 800MB in size. The resulting database is 625MB in size. Note that there is no duplication of text data - only nodes and such values as hits and transfer sizes are duplicated. Each record also contains some small overhead (record version for upgrades, etc).
Here are the sizes of the URL databases (other URL secondary databases are similar to urls.hits described below):
urls (p):
8192 Underlying database page size
2031 Overflow key/data size
1471636 Number of unique keys in the tree
1471636 Number of data items in the tree
193 Number of tree internal pages
577738 Number of bytes free in tree internal pages (63% ff)
55312 Number of tree leaf pages
145M Number of bytes free in tree leaf pages (67% ff)
2620 Number of tree overflow pages
16M Number of bytes free in tree overflow pages (25% ff)
urls.hits (s)
8192 Underlying database page size
2031 Overflow key/data size
2 Number of levels in the tree
823 Number of unique keys in the tree
1471636 Number of data items in the tree
31 Number of tree internal pages
201970 Number of bytes free in tree internal pages (20% ff)
45 Number of tree leaf pages
243550 Number of bytes free in tree leaf pages (33% ff)
2814 Number of tree duplicate pages
8360024 Number of bytes free in tree duplicate pages (63% ff)
0 Number of tree overflow pages
The Testbed
I'm running all these tests using the latest BDB (v4.6) built from the source on Win2K3 server (release version). The test machine is 1.7GHz P4 with 1GB of RAM and an IDE hard drive. Not the fastest machine, but it was able to handle a log file like described before at a speed of 20K records/sec.
BDB is configured in a single file in a BDB environment, using private memory, since only one process ever has access to the database).
I ran a performance monitor while running SSW, capturing private bytes, disk read/write I/O, system cache size, etc.
I also used a code profiler to analyze SSW and BDB performance.
The Problem
Small log files, such as 100MB, can be processed in no time - BDB handles them really well. However, once the entire BDB cache is filled up, the machine goes into some weird state and can sit in this state for hours and hours before completing the analysis.
Another problem is that traversing large primary or secondary databases is a really slow and painful process. It is really not that much data!
Overall, the 20K rec/sec quoted above drop down to 2K rec/sec. And that's all after most of the analysis has been done, just trying to save the database.
The Tests
SSW runs in two modes, memory mode and database mode. In memory mode, all data is kept in memory in SSW's own hash tables and then saved to BDB at the end of each run.
In memory mode, the entire BDB is dumped to disk at the end of the run. First, it runs fairly fast, until the BDB cache is filled up. Then writing (disk I/O) goes at a snail pace, at about 3.5MB/sec, even though this disk can write at about 12-15MB/sec.
Another problem is that the OS cache gets filled up, chewing through all available memory long before completion. In order to deal with this problem, I disabled the system cache using the DB_DIRECT_DB/LOG options. I could see OS cache left alone, but once BDB cache was filed up, processing speed was as good as stopped.
Then I flipped options and used DB_DSYNC_DB/LOG options to disable OS disk buffering. This improved overall performance and even though OS cache was filling up, it was being flushed as well and, eventually, SSW finished processing this log, sporting 2K rec/sec. At least it finished, though - other combinations of these options lead to never-ending tests.
In the database mode, stale data is put into BDB after processing every N records (e.g. 300K rec). In this mode, BDB behaves similarly - until the cache is filled up, the performance is somewhat decent, but then the story repeats.
Some of the other things I tried/observed:
* I tried to experiment with the trickle option. In all honesty, I hoped that this would be the solution to my problems - trickle some, make sure it's on disk and then continue. Well, trickling was pretty much useless and didn't make any positive impact.
* I disabled threading support, which gave me some performance boost during regular value lookups throughout the test run, but it didn't help either.
* I experimented with page size, ranging them from the default 8K to 64K. Using large pages helped a bit, but as soon as the BDB cached filled up, the story repeated.
* The Db.put method, which was called 73557 times while profiling saving the database at the end, took 281 seconds. Interestingly enough, this method called ReadFile function (Win32) 20000 times, which took 258 seconds. The majority of the Db.put time was wasted on looking up records that were being updated! These lookups seem to be the true problem here.
* I tried libHoard - it usually provides better performance, even in a single-threaded process, but libHoard didn't help much in this case.I have been able to improve processing speed up to
6-8 times with these two techniques:
1. A separate trickle thread was created that would
periodically call DbEnv::memp_trickle. This works
especially good on multicore machines, but also
speeds things up a bit on single CPU boxes. This
alone improved speed from 2K rec/sec to about 4K
rec/sec.Hello Stone,
I am facing a similar problem, and I too hope to resolve the same with memp_trickle. I had these queries.
1. what was the % of clean pages that you specified?
2. What duration were you clling this thread to call memp_trickle?
This would give me a rough idea about which to tune my app. Would really appreciate if you can answer these queries.
Regards,
Nishith.
>
2. Maintaining multiple secondary databases in real
time proved to be the bottleneck. The code was
changed to create secondary databases at the end of
the run (calling Db::associate with the DB_CREATE
flag), right before the reports are generated, which
use these secondary databases. This improved speed
from 4K rec/sec to 14K rec/sec. -
I'm in syria and they blocked me from using any VPN service please help without VPN i can't open the store help please ( using iphone 5 version 9.1.4 )
There is nothing that anyone here on a user forum can do to help you. If it is a local issue in Syria, then you need to take it up with your phone company or authorities there who have prevented you from using VPN.
Nobody here can help you. -
have a lenovo tablet running windows 8 - only 4 of my albums are showing in my list - this is my 4th device and I subscribe to the cloud HELP please I want to see my music
See the futher information area of Troubleshooting issues with iTunes for Windows updates for download advice and direct links if required.
See this migrate iTunes library post for advice on moving the library over from a previous computer and this post on deduplication.
tt2 -
Error in sending mail 2nd time, Where is the fault- Help Please
Hi friends,
I had written a program to send mail. Everything is fine, when i send first time. But if I try to send mail 2nd time, It gives the error:
Exception in Connect: IOException while sending message
Here is the complete code what i had written, It successfully connects using t.connect();
the problem in t.send();
output on JBoss Console is :
Inside Action
After Transport t = session.getTransport(protocol)
before t.connect()
after t.connect()
Exception in Connect IOException while sending message
import java.io.*;
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class MsgSend extends Action {
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request
, HttpServletResponse response) throws Exception {
response.setContentType("text/xml");
PrintWriter out = response.getWriter();
System.out.println("Inside Action");
String to = request.getParameter("to");
String bcc = request.getParameter("bcc");
String cc = request.getParameter("cc");
String subject = request.getParameter("sub");
String user = request.getParameter("user");
//String password = request.getParameter("pass");
String message = request.getParameter("message");
String from = user + "@domainname.com" ;
/*Properties props = System.getProperties();
props.put("mail.smtp.host", "smtp.vsginc.com");
MailBean bean = MailBean.getInstance();
Session session = bean.getSession();
String protocol = "smtp";
Transport t = session.getTransport(protocol);
System.out.println("After Transport t = session.getTransport(protocol)");
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
if(cc != null ){
InternetAddress ccAddr[] = InternetAddress.parse(cc);
msg.setRecipients(Message.RecipientType.CC, ccAddr);
if(bcc != null){
InternetAddress bccAddr[] = InternetAddress.parse(bcc);
msg.setRecipients(Message.RecipientType.BCC,bccAddr);
msg.setSubject(subject);
// create and fill the first message part
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(message);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
Attachment attachment = Attachment.getInstance();
ArrayList<String> fileList = attachment.getFileNames();
String parentFolder = null;
for(String path:fileList){
File attachmentFile = new File(path);
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(attachmentFile);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(attachmentFile.getName());
multipart.addBodyPart(messageBodyPart);
parentFolder = attachmentFile.getParent();
// add the Multipart to the message
msg.setContent(multipart);
// set the Date: header
msg.setSentDate(new Date());
try {
System.out.println("before t.connect()");
t.connect(bean.getSmtpServer(),bean.getUsername() ,bean.getPassword());
System.out.println("after t.connect()");
//Error is coming here in this Line.
t.sendMessage(msg, msg.getAllRecipients());
* System.gc(); will relese the fileHandles, if some resource
* still holds it.
System.out.println("before System.gc()");
System.gc();
* Deleting All the Files from Attachment Folders.
System.out.println("before attachmentFolder");
File attachmentFolder = new File(parentFolder);
System.out.println("Attachment Folder Name is : "+attachmentFolder.getAbsolutePath());
if(attachmentFolder.isDirectory()){
File[] files = attachmentFolder.listFiles();
System.out.println("No of Files For Attachments are: "+files.length);
boolean deleteResult = false;
for(int i=0; i<files.length; i++ ){
deleteResult = files.delete();
System.out.println(files[i].getName() + " Delete Staus is :"+ deleteResult);
System.out.println("All attachments Deleted");
out.print("<result>Mail has been sent successfully</result>");
} catch (Exception e) {
out.print("<result>Mail sending failed</result>");
System.out.println("Exception in Connect "+e.getMessage());
}finally{
t.close();
return null;
Problem only comes, when i send 2nd time or more. What is the problem? Please help me out.
Thanks for your response in advance. One more thing, Whether to send a mail & receive a mail, we need to create different sessions. one for sending & one for receiving mails.
Message was edited by:
Ashish.Mishra16I don't see anything obviously wrong in your code. Try adding
session.setDebug(true);
You can use the same Session for sending and for reading.
A Session just encapsulates your configuration parameters,
so as long as they're the same for both usages, one Session
is fine. -
Database don't delete prom the table, help please !!
there is my code :
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection con=DriverManager.getConnection(jdbc:odbc:Medic);
con.setReadOnly(false);
try{
Statement st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
int res=st.executeUpdate("DELETE FROM PATIENT WHERE PATIEN_ID="+id+";");
System.out.println(String.valueOf(res)+" rows deleted");
st.close();
}catch(Exception exc){
System.out.print(exc+"\n");
the code execute with no error or exception , the message that i recieve is "1 rows deleted" and i want delete just one row, it's ok until the moment but whene i read the table i see that the row is not deleted.
I use dBase database, help please !!!
ThanksDon't trust the return value.
Because you got no exception it means that the SQL executed. SQL can execute without deleting anything however if the where clause does not match.
As posted your code is not valid java so anything else is meaningless. -
Cannot open itunes now I've downloaded the update - help please
I launched my itunes and had a message asking did I want to install the updated version. When it finished installing it said it needed to shutdown and restart - which I did. When I tried to reopen itunes from the shortcut it said it cannot open it coz some files are missing. Can anyone help please. I have contacted apple and although i've had my phone for over 90 days they have emailed me steps on how to uninstalled and reinstall safely. However, once I got the email, the first thing it tells me to do is to launch itunes which I can't do. can anyone help please? Many thanks.
Hi,
Try the following
First of all, see if you can uninstall your current version of HP Support Assistant by using the Microsoft 'Fixit' on the following link - this is particularly useful in correcting issues that may prevent reinstallation on machines running a 64bit OS.
http://support.microsoft.com/mats/Program_Install_and_Uninstall
If this completes, restart the PC.
Next download and install the latest version of HP Support Assistant from the page on the link below - the download links are towards the bottom of the page.
http://h18021.www1.hp.com/helpandsupport/hp-support-assistant.html
After the installation, restart the PC again.
Regards,
DP-K
****Click the White thumb to say thanks****
****Please mark Accept As Solution if it solves your problem****
****I don't work for HP****
Microsoft MVP - Windows Experience -
Macbook pro (2010) Powers off everytime i close the screen.HELP PLEASE
Macbook pro (2010) Powers off everytime i close the screen, used to go into hibernate but now it powers off....HELP PLEASE
Computer is just over a year old and this is the first problem i have ever had, Nothing has changed in the power saver settings, and its getting frustrating everytime i go to use it i need to power it on and it always seems that it takes awhile before it finnaly realizes to turn on when pushing the button.So apparntly it is not turning off, however the screen is just not coming back on once i open the lid. so i push the power button, it shuts down then i press it again and it restarts. software or hardware error?
-
I cant set up my brand new apple iphone 4s as it wont connect to the internet help please
I cant set up my brand new apple iphone 4s as it wont connect to the internet help please
Hey vanessafromsouth perth,
Thanks for using Apple Support Communities.
It sounds like you are not able to connect to the internet. These articles should be able to help you get connected.
iPhone: Troubleshooting a cellular data connection
http://support.apple.com/kb/ts3780
iOS: Troubleshooting Wi-Fi networks and connections
http://support.apple.com/kb/TS1398
Have a nice day,
Mario -
I can not play the songs on my iphone 4s, the more they have been transferred to the cell, help please
Connect your iPod to your computer. When you get the message that it is linked to a different library and asking if you want to link to this one and replace all your songs etc, press "Cancel". Pressing "Erase and Sync" will irretrievably remove all the songs from your iPod. When your iPod appears in iTunes enable it for disk use, this is required for most if not all the utilities listed below so they can access the files: Using your iPod as a storage drive
The transfer of non iTMS content such as songs imported from CD is designed by default to be one way from iTunes to iPod. However there are a number of third party utilities that you can use to retrieve the music files and playlists from your iPod. This is just a selection, have a look at the web pages and documentation, they are generally quite straightforward, just check for one that soecifically state they work with the iPod shufle. You can also read reviews of some of them here: Wired News - Rescue Your Stranded Tunes
YamiPod Mac and Windows Versions
iGadget Windows Only
iPod Access Mac and Windows Versions
Music Rescue Mac & Windows
iPodCopy Mac and Windows Versions
TuneJack Windows Only
iPod2PC Windows Only
There is also manual method of accessing the iPod's hard drive and copying songs back to iTunes on Windows. The procedure is a bit involved and was written long before iTunes 7 and Windows Vista so it requires a little adaptation as the iPod preferences are no longer in the location mention for instance but if you're interested it's posted in this thread: MacMuse - iPod to iTunes -
When I try to sync my iphone to Itunes on my mac air ti will not come up
My ipad works ok but not the phone help pleaseHello Canonball,
It sounds like your iPhone is not showing in iTunes so it will not sync, but your iPad works fine. If you have already restarted your phone, (Turn your iOS device off and on (restart) and reset, http://support.apple.com/kb/ht1430), I recommend the troubleshooting from the following article named:
iOS: Device not recognized in iTunes for Mac OS X
http://support.apple.com/kb/ts1591
Check USB connections. iOS devices require USB 2.0 to function properly. If you're not sure your Mac has USB 2.0 ports, refer to the computer's specifications.
Disconnect other USB devices and connect your device directly to a USB port on your Mac.
Restart your Mac.
Thank you for using Apple Support Communities.
All the very best,
Sterling -
I can't insert my data into the table - help please
Hello everyone,
I have a trouble about JSP. I'm using Java2 SDK,JSP 1.2,Mysql and TOMCAT.
I want to do this. A user has to enter the nicno,into the html form(EnterNicInter.jsp),to verify if it is already exist or not. If it is exist in the db, an error msg(Record already exist) must be displayed. If not, then the page "InterviewForm.jsp" displayed. This part is working.
But, I can't save these details into the db by clicking submit button int the InterviewForm.jsp.
I wrote a javaBean for this task. Here is it.
CandidateMgr.java
package hrm;
import java.io.*;
import java.sql.*;
public class CandidateMgr
private String nicno;
private String title;
private String firstName;
private String civilStatus;
private String tele;
private String eduQua;
// Constructor
public CandidateMgr()
this.nicno = nicno;
this.title = title;
this.firstName = firstName;
this.civilStatus= civilStatus;
this.tele = tele;
this.eduQua = eduQua;
//getters & setters.
// Initializes the connection and statements
public void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
//Verify nicno
sql="SELECT * FROM Candidate where nicNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql ="INSERT INTO Candidate
VALUES(?,?,?,?,?,?)";
pstmt2 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
public boolean verifyNicNo(){
boolean nic_no_select_ok = false;
String nic="xxxx";
initConnection();
try {
pstmt1.setString(1, nicno);
ResultSet rs1 = pstmt1.executeQuery();
if(rs1.next()){
nic=rs1.getString("nicNo");
if(nic=="xxxx")
nic_no_select_ok = true;
} else{
nic_no_select_ok = false;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return nic_no_select_ok;
public boolean addInter(){
boolean add_inter_ok = false;
try{
//assign values for the object
pstmt2.setString(1, nicno); // ERROR(java:652)
pstmt2.setString(2, title);
pstmt2.setString(3, firstName);
pstmt2.setString(4, civilStatus);
pstmt2.setString(5, tele);
pstmt2.setString(6, eduQua);
if(pstmt2.executeUpdate()==1) add_inter_ok=true;
pstmt2.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return add_inter_ok;
IntreviewForm.jsp (used to submit data into the db)
<form method="POST" action="InterviewCtrl.jsp">
//codes
<input type="text" name="nicno" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="title" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="firstName" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="civilStatus" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="tele" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
<input type="text" name="eduQua" size="14" style="border:1px solid #0000FF;
color: #FF0000; font-weight: bold">
</form>.......................................................................
Here is the "InterviewCtrl.jsp"
<%@ page language="java" import="java.util.*"%>
<%@ page import="hrm.CandidateMgr" %>
<%@ page session="false" %>
<jsp:useBean id="candidate" class="hrm.CandidateMgr" scope="request"/>
<jsp:setProperty name="candidate" property="*"/>
<%-- Execute the addInter() method on the bean and check if it is true or false.-- %>
<%-- if it's true then display a confirmation message "InterConfirm.html" --%>
<%-- else display InterError.html --%>
<%
String nextPage ="MainForm.jsp";
if(candidate.addInter()){
nextPage="InterConfirm.html";
}else{
nextPage="InterError.html";
%>
<jsp:forward page="<%=nextPage%>"/>.......................................................................
Here is the error:(I mark it in my bean also)
root cause
java.lang.NullPointerException
at hrm.CandidateMgr.addInter(CandidateMgr.java:652)
at org.apache.jsp.InterviewCtrl_jsp._jspService(InterviewCtrl_jsp.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
I use JSP 1.2 , mySQL with TOMCAT. My table name is Candidate.It's fields are as follows:
Candidate(nicNo,title,fName,civilStatus,tele,eduQua)
Can anybody tell me whats going on, help me to solve this please.
Thanks.you should try something different, since you are mixing up a lot of code.
1) create a separate method just to connect and disconnect from a database;
2) use the value entered and see if you can find a record in the table. If the record is there, then you should re-direct your jsp to a jspError, else goes to another form.
the code below give you some idea
if( sAction.equals("Add1") ) {
sITEM = request.getParameter("parameter1");
try {
itemmaster.connect();
itemmaster.viewitemmaster( sITEM );
rs = itemmaster.getRs();
if( rs.next() ) {
sURL = "additemmaster1.jsp";
else {
request.setAttribute( "asITEM", sITEM );
sURL = "additemmaster2.jsp";
finally {
rs.close();
itemmaster.disconnect();
} -
so i downloaded ios7, waited, and everything seems fine and dandy. except for the fact that i cant access the control panel. i tried swiping for hours, i googled solutions, tried figuring it out myself, but nothing is working. my orientation screen is locked. if that matters? so can someone please tell me what i should do? thank you!
Perform a Reset... Try again...
Reset ( No Data will be Lost )
Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
http://support.apple.com/kb/ht1430
If no joy...
Connect to iTunes on the computer you usually Sync with and “ Restore “...
http://support.apple.com/kb/HT1414 -
My iphone 5 is stuck rotated to the left help please
please help my iphone 5 is stuck rotated to the side the rotation lock is not on and ive even restored the phone and updated it but it still hasnt fixed it...
Hi Turn iPhone off Connect lead to USB on your PC Press & hold power button down on iPhone don't let go Connect lead to iPhone keep button pressed until PC sees iPhone then wait for restore . Cheers Brian
Maybe you are looking for
-
I am new to iMovie, but disappointed by my initial experience. I am trying to do a simple slide show -- 161 jpg photos, running for 3 seconds each, with simple dissolve transitions. I get the photos in, and then select them all and select the "dissol
-
Hello Flash Forum, I have been checking the forum for ideas and suggestions on how to implement an interactive zoom and pan on an image. I would like the user to be able to drag a "magnifing glass" or a circle over an image, and then zoom in (or out)
-
How to activate and passivate member variables?
Hi ViewObjects have methods like public void passivateState(ViewRowImpl currentRow, Document doc, Element parent)andpublic void activateState(ViewRowImpl currentRow, Element elem)However, I can't find any example how to use them. Can anyone show me a
-
Why does a tv episode already on my phone get deleted and readded when I sync with Itunes?
I purchased a tv episode directly on my iPhone, (using the same Apple ID I always use). It downloaded without any trouble and plays fine, but whenever I go to sync my phone with iTunes, the episode proceeds to redownload as if it were not already on
-
STO: Condition tab not occuring
Hi Friends, I have configured a STO purchase order and not getting condition tab at item level. Please suggest how can i get Condition tab in Purchase order. Kraheja.