Can anyone see what the problem is?
Hi
I get this message whilst trying to debug this jsp: SQLException:java.sql.SQLException: Syntax error or access violation, message from server:
"You have an error in your SQL syntax near email = 'null'AND password = 'null'' at line 1"
Here is the JSP code:
<%
String email = request.getParameter("username");
String password = request.getParameter("ppassword");
String user_type = null;
mylogin.connect();
ResultSet loginResult = mylogin.viewLogon(email, password);
loginResult.next();
if (loginResult != null)
%>
Incorrect Username or Password Entered. Please try again!
Please clickHere to Go Back!
<%
if (loginResult.first())
user_type = request.getParameter("user");
}else if (user_type.equals("patient"))
%>
<jsp:forward page="homepage.jsp" />
<%
}else if (user_type.equals("staff"))
%>
<jsp:forward page="outofhoursstaff.jsp" />
<% }else if (user_type.equals("admin"))
%>
<jsp:forward page="siteadminmain.jsp" />
<%
%>
<% mylogin.disconnect(); %>
Here is the JavaBean code:
public ResultSet viewLogon(String email, String password) throws SQLException, Exception
ResultSet loginResult = null;
try
String queryString = ("SELECT user_type, email, password" +
"FROM user" +
"WHERE email = '"+email+"'" +
"AND password = '"+password+"'");
Statement statement = con.createStatement();
Statement stmt = con.createStatement();
loginResult = statement.executeQuery(queryString);
catch (SQLException sqle)
System.out.println("SQLException:" + sqle);
catch (Exception e)
System.out.println("Exception:" + e);
return loginResult;
Any suggestions will be gratefully appreciated
I think you need some spaces in your code - It would have produced
SELECT user_type, email, passwordFROM userWHERE email ='null'AND password ='null'
You need to include spaces where you are concatenating the strings.
String queryString = ("SELECT user_type, email, password" +
" FROM user" +
" WHERE email = '"+email+"'" +
" AND password = '"+password+"'");
As an aside, I would also suggest that you use a prepared statement, and substitute in the parameters
ie WHERE email = ? and password = ?
This will
- Protect you from stupid people who put quotes in their passwords
- prevent SQL injection attacks.
Cheers,
evnafets
Similar Messages
-
Whilst I'm at work I can't seem to connect to the internet, despite the home screen telling me I have a 3G connection. I can't get anything to refresh at all, until I go home and my phone auto connects to the WIFI and then I get all my emails and app notifications come through in a flood.
All other aspects of my phone working fine.
Can anyone help?
ThanksCheck to see if you have cellular data enabled for mail.
Go to Settings > Cellular and check the apps under "USE CELLULAR DATA FOR:" -
I am finding that emails are disappearing from my inbox without explanation. Has anyone any ideas what might be causing this?
I found a fix elsewhere for Mail.app. I had to remove every sub-folder under INBOX (I moved them to a local folder) and then used the MAILBOX -> REBUILD command on INBOX. It worked, but now I don't have any of the sub-folders.
I am very disappointed with Apple. I should never have to do that. Tens of Billions of dollars in cash, just lying around, and they can't be bothered to make the most basic (and central) of applications work. -
This sign appeared in my account: "Your payment method was declined. Update your biiling info'. After adding new information about my others cards I see the same sign. Can't understand what the problem is and what should I do. Everything used to be good before.
Do anyone know what I supposed to do in that situation?
Really need help!
Thanks in advance.Contact iTunes Customer Service and request assistance
Use this Link > Apple Support iTunes Store Contact -
I have a 13" macbook from 2009 and for some reason can no longer change my desktop image by just clicking on an image in system prererences>I-Photo. Does anyone know what the problem could be?
Your Desktop Picture settings and Dock items are stored in the files
/Users/your short user name/Library/Preferences/com.apple.desktop.plist and
/Users/your short user name/Library/Preferences/com.apple.dock.plist
in the "Preferences" folder in your user library. This looks like the system has trouble to write to these files. Check the permissions on your user library and remove the above files from your user library, then log off and on again.
Your user library is hidden in Lion and Mt. Lion. To reveal it, use the Finder's "Go" menu. Select "Go" in the Finder's main menu bar and hold down the alt/option key, until you see the "Library" in the drop-down menu. Double click it to open a Finder window, so you can browse the files inside.
Regards
Léonie -
I am running a 7 year old MacBook Pro 15. Since upgrading to Yosemite I can not run my airport express' without having to reset each of them every time I wish to use them. I did not have this problem with Mavericks OSX. Does anyone know what the problem is and is there a fix?
See
What is a kernel panic,
Technical Note TN2063: Understanding and Debugging Kernel Panics,
Mac OS X Kernel Panic FAQ,
Resolving Kernel Panics, and
Tutorial: Avoiding and eliminating Kernel panics for more details. -
When typing out emails on ipad, screend I lose the message I am typing. Does anyone know what the problem can be?
Please follow these directions to delete the Mail "sandbox" folders. In OS X 10.9 there are two sandboxes, while in 10.8 there is only one. If you're running a version older than 10.8, this comment isn't applicable.
Back up all data.
Triple-click anywhere in the line below on this page to select it:
~/Library/Containers/com.apple.mail
Right-click or control-click the highlighted line and select
Services ▹ Reveal
from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder — not just its contents — to the Desktop. Leave the Finder window open for now.
Log out and log back in. Launch Mail and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window. If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Repeat with this line:
~/Library/Containers/com.apple.MailServiceAgent
Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
*If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. In the Finder, select
Go ▹ Go to Folder...
from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return. -
When i try to sync contact via itunes to outlook, it doesnt get sync, even i checked the sync contact with outlook. Can anyone guide whats the actual problem?
I have similar problems trying to synchronize my calendar, also after update on 7.1.1. on my Iphone 5.
It doesn;t replace the outlook entries on Iphone 5.
I didn,t try to synchronize the contacts, because it may fail.
Has any one an idea what could be the reasson for thid synchronize problems. -
Iphone6 doesn't play music (have tried obvious things like volume etc and plugged in headphones, connected to a speaker via bluetooth, and tried to play from the inbuilt speaker). Does anyone know what the problem is and how it can be resolved?
You can't buy the part from Creative as a spare.
I'm not sure how compatible other parts might be, but that would be a question for someone who really knows a lot about this area of electronics.
The Creative repair for this is likely to be expensi've, but the problem is most likely a broken solder connection than an actual new headphone socket. So if you know someone experienced in surface mount soldering you could probably get it repaired just with this. -
I am having trouble connecting to wifi network via airport express on my windows xp pc, but I know it is working because I can connect on my macbook, does anyone know what the problem is?
Tell us more about the problem, I can think up 100&1 different reasons, but don't have time to go through all the possibilities. So.. what happens?
-
I have migrated from London to New Delhi and i am facing some problem with my iPhone 4s and i am not able to setup a repair .My phone is in under warranty too. Can anyone tell whats the matter?
The warranty is NOT international. You must take it back to the country of origin if it needs repair. The E.U. is considered a single country for warranty purposes.
-
I have an .avi file Quicktime is refusing to play, yet the information says Quicktime does play .avi files. Does anyone know what the problem is?
AVI is a legacy file container originated by Microsoft back in 1992 and which has not been officially supported for more than a decade. Like the container, many of the codecs commonly used to create AVI content are also "legacy" compression formats most often supported on PC/Windows platforms. In fact, some codecs have never been transcoded for Mac use. Of those that have, many never made the transition to Mac OS X or the transition to Intel-based platforms. Those codecs that are still supported on the Mac can normally be found in the avi to quicktime converter available as an online download. While some common AVI compression formats may be supported by the QT X Player app, QT 7 currently provides a more compatible AVI playback environment for most "legacy" compression formats. If the codec(s) used in your AVI files are not supported by the avi to quicktime converter for QT use, you can try the VLC media player which may still support more esoteric compression formats. If VLC does not support the files, the normal approach is to discover which specific audio and/or video codecs were used to create the file and perform an Internet search to see if a compatible Mac component is available for download.
-
My Apple TV will not update to the latest software, dose anyone know what the problem is, I've reset, tried to do it wirelessly as well as while connected via Ethernet cable.. Both have resulted in the same message!! Update unsuccessful, current software version is 5.1 (5201) . I've rented a movie recently and does not appear in my movie list, but I have been charged for this movie, can someone help me out with these issues.
If your problem persists get yourself a micro USB cable (sold separately), you can restore your Apple TV from iTunes:
Remove ALL cables from Apple TV. (if you don't you will not see Apple TV in the iTunes Source list)
Connect the micro USB cable to the Apple TV and to your computer.
Reconnect the power cable (only for Apple TV 3)
Open iTunes.
Select your Apple TV in the Source list, and then click Restore.
If when you choose restore you get a message that the device cannot be found, download the file below
Apple TV Software Restore 5.1.1 (2nd generation)
Apple TV Software Restore 5.1.1 (3rd generation)
Then hold down the option key while choosing restore and select the downloaded file when prompted. -
I am using chat-r wireless and facetime is not working but when i put rogers fido or any other carrier sim in it work. Anyone know what the problem?
I'm guessing it's a compatibility problem similar to that that T-Mobile in the US has. I'm not familiar with chat-r wireless, but I'm guessing it's not a supported carrier for the iPhone. If they can't tell you how to fix it, I'm guessing it's just plain not going to work.
-
Hiya, I've got a weird problem with my iPhone4. On the 'home page' of my iPhone the mail symbol tells me there's a new mail waiting for me. However, there's no new mail to be found. Does anyone know what the problem is? Thanks
This response is a little late as I just read about your problem. I have a 2012 Dodge Charger and a 2012 Chrysler Town and Country and both worked flawlessly with the iPhone 5s my wife and I had. However, we just upgraded to the iPhone 6 and Uconnect will receive calls but you cannot answer them. You can callout successfully, however. the annoyance being the inability to answer incoming calls in the HandsFree mode.
Maybe you are looking for
-
Can I buy a television 32 inch for a mac mini and have a good image quality?
Hello I want to buy a tv 32 inch for work with videos, the image on tv will be good ?
-
Creating PDFs from a PDF in Snow Leopard
All, With Snow Leopard, I'm unable to create a PDF from a PDF using Acrobat 8 or 9 because it doesn't work and theres no fix, yet. What I do.... someone mails me a PDF, I make comments, fill in info, etc, and need to create another PDF from that one
-
Hi, for which T-codes am using for mvt 544 and 545 to get the scrap from sub-contracting vendor rgds
-
Export Current Setting Problem
We currently use DVCProHD footage/timeline, etc. 1280x1080 DVCPro Pixel aspect... all that. We export to quicktime using Current Settings so we can use it on different editors with no additional rendering needed. Here's the problem: The export change
-
OS X Yosemite upgrade for MacBook Pro
I know some people have found updating to OS X Yosemite an issue so I thought would check with the experts. I have 17-inch, Early 2011. Processor 2.2 GHz Intel Core i7. Memory 4 GB 1333 MHz DDR3. Software Mac OS X Lion 10.7.5 (11G63). Hard drive 75