Getting error message in tomcat server

Have a look at the following programs:
AuthenticationFilter_
import javax.servlet.*;
import java.io.*;
import java.sql.*;
public class AuthenticationFilter implements Filter
     ServletContext sc;
     Connection con;
public void init(FilterConfig f) throws ServletException
System.out.println(f.getFilterName() + "Filter Initialized");
String d = f.getInitParameter("driver");
String url = f.getInitParameter("url");
String user = f.getInitParameter("user");
String pwd = f.getInitParameter("password");
try
     Class.forName(d);
     con = DriverManager.getConnection(url,user,pwd);
     System.out.println("Connection Established");
catch (Exception e)
     e.printStackTrace();
sc = f.getServletContext();
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain)throws ServletException,IOException
Statement st = null;
ResultSet rs = null;
String user = request.getParameter("user");
String pwd = request.getParameter("password");
try
     st = con.createStatement();
     String sql = "SELECT * FROM OURUSERS WHERE usr = " + user + " and password = " + pwd + " ";
     rs = st.executeQuery(sql);
     if(rs.next())
          chain.doFilter(request,response);
     else
          sc.getRequestDispatcher("/error.html").forward(request,response);
catch (Exception e)
     e.printStackTrace();
finally
try
     if(rs!=null)
          rs.close();
     if(st!=null)
          st.close();
catch (Exception e)
     e.printStackTrace();
}//doFilter()
public void destroy()
try
     if(con!=null)
          con.close();
catch (Exception e)
     e.printStackTrace();
*2)_HitCounterFilter__
import javax.servlet.*;
import java.io.*;
public class HitCounterFilter implements Filter
     ServletContext sc;
     int count;
public void init(FilterConfig f)throws ServletException
System.out.println(f.getFilterName() + "Filter Initialized");
sc = f.getServletContext();
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain)throws ServletException,IOException
chain.doFilter(request,response);
count++;
sc.log("Number of times request came to LoginServlet is " + count);
public void destroy()
*3) LoginServlet*
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class LoginServlet extends HttpServlet
     public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<HTML> <BODY BGCOLOR=yellow>");
pw.println("<H1> WELCOME TO OUR WEBSITE</H1>");
pw.println("</BODY>");
pw.println("</HTML>");
pw.close();
web.xml
<web-app>
<filter>
<filter-name>authenticate</filter-name>
<filter-class>AuthenticationFilter</filter-class>
<init-param>
<param-name>driver</param-name>
<param-value>oracle.jdbc.driver.OracleDriver</param-value>
</init-param>
<init-param>
<param-name>url</param-name>
<param-value>jdbc:oracle:thin:@localhost:1521:orcl</param-value>
</init-param>
<init-param>
<param-name>user</param-name>
<param-value>scott</param-value>
</init-param>
<init-param>
<param-name>password</param-name>
<param-value>tiger</param-value>
</init-param>
</filter>
<filter>
<filter-name>hitcount</filter-name>
<filter-class>HitCounterFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>authenticate</filter-name>
<url-pattern>/nit</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Login</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/nit</url-pattern>
</servlet-mapping>
</web-app>
Error_
java.sql.SQLException: ORA-00904: "SANDY": invalid identifier
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:242)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:554)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1478)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:
677)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.jav
a:2371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:2660)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:
777)
at AuthenticationFilter.doFilter(AuthenticationFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:48
9)
at java.lang.Thread.run(Thread.java:619)
The above error message i am getting in Tomcat server,i am having Oracle 11g V1..My SQL prompt is open and i have a table named "ourusers"...Can anyone kindly gimme the solution for this problem+*
Edited by: sandy on Nov 9, 2010 8:59 AM

java.sql.SQLException: ORA-00904: "SANDY": invalid identifier
Looks like the sql you are submitting is invalid.
Print out a copy of the sql you are trying to run and you will probably get:
SELECT * FROM OURUSERS WHERE usr = Sandy and password = secretThat isn't valid sql. It is missing quotes around the values you are checking.
This is the corrected sql query:
SELECT * FROM OURUSERS WHERE usr = 'Sandy' and password = 'secret'so one solution would be:
String sql = "SELECT * FROM OURUSERS WHERE usr = '" + user + "' and password = '" + pwd + "' ";However that is not optimal. It exposes your code to sql injection attack.
The better way is to use a prepared statement:
String sql = "SELECT * FROM OURUSERS WHERE usr = ? and password =?";
st = con.prepareStatement(sql);
st.setString(1, user);
st.setString(2, password);
rs = st.executeQuery();cheers,
evnafets

Similar Messages

  • Ca'nt ftp longer (i.e. 4 minutes) flv or f4v files (get error message "waiting for server")  I

    when I ftp(i.e. "put" or "upload) short flv or f4v files using dreamweaver cs4 the files upload easily and quickly. However, when I try to ftp ("put" or "upload" ) longer (i.e. 4 minutes or longer) flv or f4v files it goes through the ftp process (seeing it in background activity screen) but at the end I always get a message "waiting on server" and the longer files don't get onto hosting server.  Is there a setting I need to change or other method I need to use).  I have worked with my hosting support tech person but we could not solve this problem.

    I'd suggest that you try using a dedicated FTP program like Filezilla or SmartFTP.
    http://filezilla-project.org/
    Those programs give you much more feedback on what's happening as you attempt to upload files, including error messages, etc.
    There is really no difference between uploading large files and small files, the process on the server is exactly the same..UNLESS there are limits to file size or video duration set by your host. So dispite the fact that you have worked with your host support, I'd still say that the problem is server side or being limited by your Internet service provider... unless the video files you are attempting to upload are corrupted.
    You didn't say if any portion of the larger video files were uploaded...and FTP program will show you whether or not ANY of the file was uploaded and at what point it stopped. You also didn't mention how large the video files where.... sort of where the "tipping point" is in file size (video duration of course is no measure of file size).
    Just to reassure you, the file size of a video file will have no bearing on your ability to FTP unless your host or ISP is limiting you in some way.
    I regularly Live stream events and also record them. An 8 hr event will produce roughly 1.5GB of compressed video. I use SmartFTP, with a reputable host and can upload the entire set of 1.5GB of video files (each about 50MB) over a 1000kbps upload connection without problem. Recently during a movie production project, we uploaded a number of single video file which each where over 1GB a piece.
    So there is really no problem uploading video files unless there are restriction on you account from the host or the ISP.
    Best wishes,
    Adninjastrator

  • When trying to send email, I get error message, rejected by server

    Our companies webhosting and email are through Bluehost.  I have set up email on my iPhone and it receives email just fine, but when i try to send I get "recipient rejected by server" error.  How can I fix this.  i have tried everything i know to do.

    most of the time the problem is the settings of the out going server of your email account. Call your internet provideer and ask them for the right settings, or do a research on google for those

  • On start up, get error message "The proxy server is refusing connections". Have dial up and no network. Changed my dial up from Localnet, which I uninstalled on my computer, to free dial up. Explorer works, but Firefox just gives me this error message.

    Nothing else to add.

    Hi there,
    You're running an old version of Safari. Before troubleshooting, try updating it to the latest version: 6.0. You can do this by clicking the Apple logo in the top left, then clicking Software update.
    You can also update to the latest version of OS X, 10.8 Mountain Lion, from the Mac App Store for $19.99, which will automatically install Safari 6 as well, but this isn't essential, only reccomended.
    Thanks, let me know if the update helps,
    Nathan

  • I get nothing but error messages, -"Your IMAP server wants to alert you to the following: 113 that mail is not available" or 364? there are hundreds stacked up.You must give answers to how to fix these when we do "search" add the error code number

    I get nothing but error messages, -
    "Your IMAP server wants to alert you to the following: 113 that mail is not available"  or  the same with:  364? 
    Now there are hundreds stacked up on my desktop.
    I cannot find the answer anywhere. You need to  give answers to how to fix these errors because when I  "search" "error code" or the number there is NOTHING. NOTHING!  Yet you give us these stupid error codes
    then you do not give us ANYTHING on how to fix these. These error codes make me so mad it makes me hate outlook, and hate the developers and hate microsoft.  How in the world can you give us ERROR codes without the explanation of what
    to do or how to fix it. You need to  add each  error code number in your "search" then explain what it is and how to fix it.  I am not a tech. I am a lawyer. I have googled the entire string of error code and nothing is clear.
    So, for the last several years, I get these error codes. Also, there is another error code that won't go away--it is the password error code that asks if I want to store the password. Yes, so I say YES. but it pops back. I am sick of this. This is the reason
    I hate Microsoft and I love google. #1 they respond to error, #2 them try to fix them you do not. I paid the full price to buy the OUtlook 2010, almost $500 just to get outlook, and all I got was error codes. I could not even open it because all I would get
    was that error codes and NO ONE knew how to fix them. WHAT IS YOUR PROBLEM that you cannot fix the stupid error codes that you imbed? PLEASE HELP

    Hi,
    I understand how frustrated you are when facing such an issue, maybe I can provide some suggestions on the problem.
    Based on the description, you should be using an IMAP account setup in Outlook. As for the error message, usually it's caused by a corrupted message on the Server. I suggest you logon the Webmail site, check if sending/receiving emails works well.
    If you find any unusual emails that cannot be read or sent, try deleting them to try again.
    I also suggest you create a new profile to setup the IMAP account:
    http://support.microsoft.com/kb/829918/en-us
    Contact your Email Service Provider to get the correct and latest account settings, since you have been using Outlook for years, some settings may have been changed while you haven't been informed.
    For the steps to setup an account in Outlook 2010, please refer to:
    http://office.microsoft.com/en-001/outlook-help/add-or-remove-an-email-account-HA010354414.aspx
    I hope this helps.
    Regards,
    Melon Chen
    TechNet Community Support

  • I get error message: "An error occurred with the  publication of album...Authentication with server failed...whenever I open a facebook file in my iPhoto. In each file, most of my photos have disappeared. What do I need to do?

    I get error message: "An error occurred with the  publication of album...Authentication with server failed. Please check your login and password information" whenever I open a facebook file in my iPhoto. In each file, most of my photos have disappeared. I am hoping I can retrieve these "lost" files. What do I need to do?

    Message was edited by: leroydouglas
    better yet, try this solution:
    https://discussions.apple.com/message/12351186#12351186

  • I keep getting a popup error message in Ical "server does not recognize name/password

    I keep getting a popup error message in Ical "server does not recognize name/password"  This started after they did the change to Icloud and extended our subcriptions. 
    Tricia

    I guess that the server name is incorrect, then.
    Did it ever work?
    Delete the account, reboot the phone, then add it back and be sure you choose Yahoo as the mail server type. Everthing should then fill in automatically except your user name and password.

  • TS1843 I am getting the following error messages- No DNS Server and Double SAT.  Can anyone walk me through a fix?

    Airport Express- No internet connection. I am getting the following error messages- No DNS Server and Double SAT.  Can anyone walk me through a fix

    Try putting these numbers in Network>TCP/IP>DNS Servers, for the Interface you connect with...
    208.67.222.222
    208.67.220.220
    Then Apply. For 10.5/10.6 Network, highlight Interface>Advanced button>DNS tab>little + icon.
    Might also put them in the Airport Express, no idea what Double SAT is!?

  • Cannot log in. Get error message proxy server not reponding, check proxy settings. How can this be fixed ?

    I get the following error message:The proxy server is refusing connections Firefox is configured to use a proxy server that is refusing connections. * Check the proxy server

    You may have a problem with an extension if you do not keep settings.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    See also:
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    *http://kb.mozillazine.org/Preferences_not_saved

  • HT201210 Trying to restore ipod and keep on getting error message: the ipod software update server could not be contacted. the network connection was reset

    Hello can someone please help? Trying to restore ipod and I keep on getting error message: The IPod software update server could not be contacted. The network connection was reset. Make sure your network is active and try again.

    Try:
    - Powering off and then back on your router.
    - iTunes for Windows: iTunes cannot contact the iPhone, iPad, or iPod software update server
    - Change the DNS to either Google's or Open DNS servers
    Public DNS — Google Developers
    OpenDNS IP Addresses
    - Try on another computer/network
    - Wait if it is an Apple problem

  • I'm trying to load video file into CS6 I keep getting error message: 'Could not complete you request because the DynamicLink Media Server is not available.' No Idea what to do next. Help please.

    I'm using CS6 Extended. My OS is "Windows 7 home premium.
    Can no longer load video files into CS6 for edited I keep getting error message:
    'Could not complete your request because the DynamicLink Media Server is not available.'
    Don't know what this means. Until just now I was able to load videos without any problems. Now I'm getting this message. Any thoughts?

    Hi Mylenium,
    upfront:
    I hope I won't be marked as spam now, since I am posting on a few relevant discussions now to this topic.
    However, I really would like to ask the people who have experienced this problem to see if they were able to solve it.
    Now the real deal:
    I posted a question in this discussionDynamicLink Media Server won't let me import video for video frames to layers anymore.
    The linked discussion is a lot younger, which is why I posted there first.
    I also put in information on the steps that I have tried and my computer specifications.
    I am experiencing this problem for a while now and hope you and jones1351may be able to help out.

  • I am getting error messages when importing CD's. I keep getting a message saying 'unable to connect to CDDB server'. I run itunes on a macbook pro. Any ideas/solutions?

    I am getting error messages when importing CD's. I keep getting a message saying 'unable to connect to CDDB server'. I run itunes on a macbook pro. Any ideas/solutions?

    Don't worry I've sorted it! I just had to turn off Reminders as well in iCloud. Calendar then worked fine, even when I turned Calendar and Reminders back on.

  • HT5052 I have been trying to upate my ipod to 5.0.1, but every time i get an error message of the server timed out after downloading for over an hour. My broadband speed here is is 1.5mbs, not good any help?

    I have been trying to update my ipod to the 5.0.1 but after waiting for a hour for the download i get an error message that the server has timed out as my broadband speed is not good, could this be the problem and if so how can i get the update?

    I have the same problem I disable msconfig mode all the programs escept windows and apple products but the same error appears at the last second of downloading the update

  • Unable to "share" a photo. Get error message stating server is not responding. But all normal email functions work just fine.????????

    unable to "share" a photo. Get error message stating server is not responding. But all normal email functions work just fine.????????

    Just a quick bump... Anyone got any thoughts on this?

  • Sql Server 2008 Reporting Security issue ( added name to Server, some how cannot acces the report ) getting error message

    have added name to Sql server , users cannot access the report, getting error message ,
    I have give all the permission to this users, so why this users still cannot look at the report,
    and getting error message,
    An error has occurred during report processing.
    cannot create a connection to data source Ax live
    for more information about this error navigate to the report server on the local server machine or enable remote errors.
    can some please help me what this message means,
    I really appreciate it
    thanks In advance

    If "Credentials supplied by the user running the report" is selected, when the report is run, the user will be prompted to provide credentials.  They would need to provide credentials that have the appropriate permissions (e.g., read, execute) to the
    database.  This prevents the double hop.
    If "Credentials stored securely in the report server" is selected, you have to enter the username and password of a user (or service account) that has the appropriate permissions (e.g., read, execute) to the database. When the report is run, SSRS will use
    these stored credentials each time to authenticate to the database engine and query the data.  Users running the report are not prompted to provide credentials.  With this option you can use an Active Directory or SQL Server account.
    In order to access/run the report, a user will need to authenticate to SSRS.  There are options here as well. You can provide them the link to the report manager and they can authenticate, navigate to, and run the report.  You can also provide
    direct links to reports that users click in a document or application.  At this point the user is typically still prompted to authenticate to SSRS.  You can also programmatically call the report using API's and essentially build a proxy that authenticates
    to SSRS and open the report.
    Not sure if that answers your question.

Maybe you are looking for

  • How to change the Credential domain Value in XML gateway?

    How to change the Credential domain Value in XML gateway? configured the XML Gateway trading partner . It is generating the header as given below. but need to change the Credential domain to DUNS. <Header> <From> <Credential domain="olgridap1.lan">  

  • Reader XI freeze when click on attached files in PDF

    I am opening an encrypted (AES-256) PDF file that has an attached PDF and Excel document embedded as a file inside the PDF. If I click on either the attached PDF or the Excel doc, Reader XI will always freeze. This will not happen in X or 9.  Yes, I

  • Os10.5.8 connection FTP server no popup windows asking for my logging and password

    I'm actually working on mac book pro 10.5.8 and I try to access a FTP server. Finder then command+P and my address. The finder open me two files "Array and Info" but nothing in the Array folder where everything should be. The problem found is that th

  • Equate text to number

    Hi! I'm using Numbers version 3.2.2 I was wondering if there was a way to equate a text to a numerical value. For example if I  I write "sugar" in any given cell, Numbers sees it as -3. I'd like to be able to do sums of these things. For example (ima

  • Not really a problem...just annoying

    my mbp's battery cover moves slightly even when fully attached. it can get really annoying when on a desk it moves. anyone else have this problem?