Unable to access values from database in login page..

Hey all,
Friends I have a login.jsp page and I want if i enter username and password then it will be accessed from database and after verifying the details it will open main.jsp.I made a database as "abc" and created DSN as 1st_login having table 1st_login. But the problem is that I am unable to access values from database.
So Please help me.
Following is my code:
<HTML>
<body background="a.jpg">
<marquee>
                    <CENTER><font size="5" face="times" color="#993300"><b>Welcome to the"<U><I>XYZ</I></U>" of ABC</font></b></CENTER></marquee>
          <br>
          <br>
          <br>
          <br><br>
          <br>
     <form name="login_form">
          <CENTER><font size="4" face="times new roman">
Username          
          <input name="username" type="text" class="inputbox" alt="username" size="20"  />
          <br>
     <br>
          Password          
          <input type="password" name="pwd" class="inputbox" size="20" alt="password" />
          <br/>
          <input type="hidden" name="option" value="login" />
          <br>
          <input type="SUBMIT" name="SUBMIT" class="button" value="Submit" onClick="return check();"> </CENTER>
          </td>
     </tr>
     <tr>
          <td>
          </form>
          </table>
<%
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connection = DriverManager.getConnection("jdbc:odbc:1st_login");
Statement statement = connection.createStatement();
String query = "SELECT username, password FROM 1st_login WHERE username='";
query += request.getParameter("username") + "' AND password='";
query += request.getParameter("password") + "';";
ResultSet resSum = statement.executeQuery(query);
//change: you gotta move the pointer to the first row of the result set.
resSum.next();
if (request.getParameter("username").equalsIgnoreCase(resSum.getString("username")) && request.getParameter("password").equalsIgnoreCase(resSum.getString("password")))
%>
//now it must connected to next page..
<%
else
%>
<h2>You better check your username and password!</h2>
<%
}catch (SQLException ex ){
System.err.println( ex);
}catch (Exception er){
er.printStackTrace();
%>
<input type="hidden" name="op2" value="login" />
     <input type="hidden" name="lang" value="english" />
     <input type="hidden" name="return" value="/" />
     <input type="hidden" name="message" value="0" />
     <br>
          <br><br>
          <br><br>
          <br><br><br><br><br>
          <font size="2" face="arial" color="#993300">
     <p align="center"> <B>ABC &copy; PQR</B>
</BODY>
</HTML>
and in this code i am getting following error
C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:93: cannot find symbol_
C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:93: cannot find symbol_
C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:94: cannot find symbol_
C:\Project\SRS\build\generated\src\org\apache\jsp\loginjsp.java:95: cannot find symbol_
4 errors
C:\Project\SRS\nbproject\build-impl.xml:360: The following error occurred while executing this line:
C:\Project\SRS\nbproject\build-impl.xml:142: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 6 seconds)

As long as you're unable to compile Java code, please use the 'New to Java' forum. This is really trival.
To ease writing, debugging and maintenance, I highly recommend you to write Java code in Java classes rather than JSP files. Start learning Servlets.

Similar Messages

  • Display values from database in jsp page

    Hi,
    I need to display a list of options with checkboxes in a jsp page .The values are retrived from DB.
    formBean fb=new FormBean(request)
    <Input type="checkbox" name="xyz" value="<%=fb.getFormdata( "xyz")%>">
    should this"xyz" be the name of the column in the DB table?

    This is my FormBean
    public class FormBean {
    HttpServletRequest _request;
    public FormBean(HttpServletRequest request) {
    _request = request;
    public String getFormData(String abc) {
    return getFormData(abc, true);
    public String getFormData(String name, boolean filter) {
    String value = null;
    if (_request != null) {
    value = _request.getParameter(abc);
    if (value == null) value = "";
    if (filter) {
    value = Utils.filter(value);
    return value;
    * "Clears" parameters. Useful if you do wnat a form initialized with blanks rather than
    * current values;
    public void clear() {
    _request = null;
    }

  • Fetching values from database into a drop down box

    in my JSP page there are 3 drop down boxes for date of birth......
    what i need is i want to get the values from database into that drop down box when i access the JSP page.......
    session is there....'m getting all other values.......
    I will attach the JSP page.....
    Please help me...........
    Thanks in Advance......
    <%@ taglib uri='/WEB-INF/taglib/struts-bean.tld' prefix='bean'%>
    <%@ taglib uri='/WEB-INF/taglib/struts-logic.tld' prefix='logic'%>
    <%@ taglib uri='/WEB-INF/taglib/dyna.tld' prefix='dyna'%>
    <%@ taglib uri='/WEB-INF/taglib/struts-html.tld' prefix='html'%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title><bean:message key="page_title"/></title>
    <link href="<bean:message key="context"/>/CSS/default.css" rel="stylesheet" type="text/css" />
    <script src="<bean:message key="context"/>/js/AC_RunActiveContent.js" type="text/javascript"></script>
    <link href="<bean:message key="context"/>/CSS/screen.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <%!
    Membership mShip = null;
    %>
    <script language="javascript" >
    function checkDate(Form){
    var d;
    d = Form.year.value+"-"+Form.month.value+"-"+Form.day.value;
    alert("Date is:"+d);
    Form.dob.value = d;
    </script>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
         <jsp:include flush="true" page="../templates/header.jsp"/>     </td>
    </tr>
    <tr>
    <td class="menuTD">     
         <jsp:include flush="true" page="../templates/menu.jsp"/>     </td>
    </tr>
    <tr>
    <td class="sub_menuTR"> </td>
    </tr>
    <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td class="column" valign="top" width="170"><jsp:include flush="true" page="../templates/left_panel.jsp"/></td>
    <td valign="top" align="left">
              <dyna:message error="error" warning="warning" message="message"/>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="80%" valign="top" align="left">
                   <%
                   if(session != null){
                   mShip = (Membership)session.getAttribute("member");
                   %>
                        <form action="updateContactDetails.dy" method="post" name="form1">
                        <input type="hidden" name="m" value="<%=request.getParameter("m")%>" />
                             <table width="100%" border="0">
                             <tr>
                                  <td>First Name</td>
                                  <td><input name="first_name" type="text" id= "first_name" value = "<bean:write name = "member" property = "first_name" />" /></td>
                             </tr>
                             <tr>
                                  <td>Last Name </td>
                                  <td><input name="last_name" type="text" id="last_name" value = "<bean:write name = "member" property = "last_name" />" > </td>
                             </tr>
                             <tr>
                                  <td>Address</td>
                                  <td><input name="address1" type="text" id="address1" value = "<bean:write name = "member" property = "address1" />" ></td>
                             </tr>
                             <tr>
                                  <td> </td>
                                  <td><input name="address2" type="text" id="address2" value = "<bean:write name = "member" property = "address2" />" ></td>
                             </tr>
                             <tr>
                                  <td>Suburb/City </td>
                                  <td><input name="city" type="text" id="city" value= "<bean:write name = "member" property = "city" />" ></td>
                             </tr>
                             <tr>
                                  <td>State/Territory</td>
                                  <td><input type="text" name="state" value = "<bean:write name = "member" property = "state" />" ></td>
                             </tr>
                             <tr>
                                  <td>Postcode</td>
                                  <td><input type="text" name="postcode" value = "<bean:write name = "member" property = "postcode" />" ></td>
                             </tr>
                             <tr>
                                  <td>Contact Phone</td>
                                  <td><input type="text" name="home_phone" value = "<bean:write name = "member" property = "home_phone" />" ></td>
                             </tr>
                             <tr>
                                  <td>Mobile</td>
                                  <td><input type="text" name="mobile" value = "<bean:write name = "member" property = "mobile" />" ></td>
                             </tr>
                             <tr>
                                  <td>Date of birth</td>
                                  <td nowrap="nowrap"><select name="day">
    <option>Day</option>
    <option value="01">1</option>
    <option value="02">2</option>
    <option value="03">3</option>
    <option value="04">4</option>
    <option value="05">5</option>
    <option value="06">6</option>
    <option value="07">7</option>
    <option value="08">8</option>
    <option value="09">9</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    </select>
                                  <select name="month">
                                       <option>Month</option>
                                       <option value="01">January</option>
                                       <option value="02">February</option>
                                       <option value="03">March</option>
                                       <option value="04">April</option>
                                       <option value="05">May</option>
                                       <option value="06">June</option>
                                       <option value="07">July</option>
                                       <option value="08">August</option>
                                       <option value="09">September</option>
                                       <option value="10">October</option>
                                       <option value="11">November</option>
                                       <option value="12">Decembber</option>
                                  </select>
                                       <select name="year" onChange = "checkDate(this.form);" >
                                       <option>Year</option>
                                       <option value="1957">1957</option>
                                       <option value="1956">1956</option>
                                       <option value="1955">1955</option>
                                       <option value="1954">1954</option>
                                       <option value="1955">1955</option>
                                       <option value="1956">1956</option>
                                       <option value="1957">1957</option>
                                       <option value="1958">1958</option>
                                       <option value="1959">1959</option>
                                       <option value="1960">1960</option>
                                       <option value="1961">1961</option>
                                       <option value="1962">1962</option>
                                       <option value="1963">1963</option>
                                       <option value="1964">1964</option>
                                       <option value="1965">1965</option>
                                       <option value="1966">1966</option>
                                       <option value="1967">1967</option>
                                       <option value="1968">1968</option>
                                       <option value="1969">1969</option>
                                       <option value="1970">1970</option>
                                       <option value="1971">1971</option>
                                       <option value="1972">1972</option>
                                       <option value="1973">1973</option>
                                       <option value="1974">1974</option>
                                       <option value="1975">1975</option>
                                       <option value="1976">1976</option>
                                       <option value="1977">1977</option>
                                       <option value="1978">1978</option>
                                       <option value="1979">1979</option>
                                       <option value="1980">1980</option>
                                       <option value="1981">1981</option>
                                       <option value="1982">1982</option>
                                       <option value="1983">1983</option>
                                       <option value="1984">1984</option>
                                       <option value="1985">1985</option>
                                       <option value="1986">1986</option>
                                       <option value="1987">1987</option>
                                       <option value="1988">1988</option>
                                       <option value="1989">1989</option>
                                       <option value="1990">1990</option>
                                       <option value="1991">1991</option>
                                       <option value="1992">1992</option>
                                       <option value="1993">1993</option>
                                       <option value="1994">1994</option>
                                       <option value="1995">1995</option>
                                       <option value="1996">1996</option>
                                       <option value="1997">1997</option>
                                       <option value="1998">1998</option>
                                       <option value="1999">1999</option>
                                       <option value="2000">2000</option>
                                       <option value="2001">2001</option>
                                       <option value="2002">2002</option>
                                       <option value="2003">2003</option>
                                       <option value="2004">2004</option>
                                       <option value="2005">2005</option>
                                       <option value="2006">2006</option>
                                       <option value="2007">2007</option>
                             </select ></td></tr>
                             <tr>
                                  <td><input type="hidden" name = "dob" /> </td>
                                  <td nowrap="nowrap"><input type="submit" value="Submit" /></td>
                             </tr>
                             </table>
                        </form>
                   </td>
    <td width="40"></td>
    <td width="200" valign="top">
                   <div id="headlines">
    <jsp:include flush="true" page="../templates/profile.jsp"/>
    </div>
                   </td>
    </tr>
    </table>
              </td>
    <td> </td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td><jsp:include flush="true" page="../templates/footer.jsp"/></td>
    </tr>
    </table>
    </body>
    </html>

    i think normally u will get data from databsae as objects.they are like java beans having getter and setter methods.so you create a collection of those objects like collect all the objects coming from database into an arraylist or....
    suppose you want to populate the dropdown box with say "username" from database object s, your code will look like that
    <html:select property="name">
    <html:options collection="databaseList" property="username" />
    </html:select>
    "databaseList" is collection(say.. ArrayList) of objects you are getting from database.this dropdown will contain all the "usernames" you are getting from database.

  • DTW error in SAP hana "Unable to access SBO-Common database"

    Hi.. Experts
    I am working on SAP Hana Pl 04 64 bit, On which I got the error "Unable to access SBO-Common database  " While using DTW.
    also company databases are also not presents,For more details for more details find out attachment.
    I have also check out all services & Restart them.
    Please give me proper solution.

    Discussion moved from SAP Business One (中文) to SAP Business One Application
    Find Topic Spaces on SCN (Forums)

  • DTW error "Unable to access SBO-Common database " for sap hana

    Hi.. Experts
    I am working on SAP Hana Pl 04 64 bit, On which I got the error "Unable to access SBO-Common database  " While using DTW.
    also company databases are also not presents,For more details for more details find out attachment.
    I have also check out all services & Restart them.
    Please give me proper solution.

    Hi,
    Please check:
    1.Ensure you have the correct DB Type selected under the Login options.
    2.Verify that all connection information is correct (for example, the correct user name and password or the user has enough right to  connect to the database server in case Windows Authentication is used).
    3. Check whether the database is running properly, make sure that the COMMON and company databases are not suspended or stopped.
    4. Ensure there is no DI API version mismatch.
    Thanks & Regards,
    Nagarajan

  • Returning sql statement instead of values from database

    hi am reading value from database but my problem is am get sql statement values instead of values in database
    my code is
    java:337)

    There is no doubt: you get what you want:
        return s_getValue;
    bye
    TPD

  • How to get string value from database table using Visual Studio 2005?

    Hi,
    Im developing plugin in illustrator cs3 using visual studio 2005. I need to get the values eneterd in database. Im able to get the integer values. But while getting string values it is returning empty value.
    Im using the below code to get the values from database table
    bool Table::Get(char* FieldName,int& FieldValue)
        try
            _variant_t  vtValue;
            vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
            FieldValue=vtValue.intVal;
        CATCHERRGET
        sprintf(m_ErrStr,"Success");
        return 1;
    Im using the below code to get the values.
    AIErr getProjects()
        char buf[5000];
        int i;   
        std::string  catName;
        ::CoInitialize(NULL);
        Database db;
        Table tbl;
        errno_t err;
        err = fopen(&file,"c:\\DBResult.txt","w");
        fprintf(file, "Before Connection Established\n");
        //MessageBox(NULL,CnnStr,"Connection String",0);
        if(!db.Open(g->username,g->password,CnnStr))
            db.GetErrorErrStr(ErrStr);
            fprintf(file,"Error: %s\n",ErrStr);
        fprintf(file, "After Connection Established\n");
    if(!db.Execute("select ProjectID,ProjectName from projectsample",tbl))
            db.GetErrorErrStr(ErrStr);
            fprintf(file,"Error: %s\n",ErrStr);
        int ProjectID;
        int UserID;
        int ProjectTitle;
        char ProjectName[ProjectNameSize];
        if(!tbl.ISEOF())
            tbl.MoveFirst();
        ProjectArrCnt=0;
        for(i=0;i<128;i++)
            buf[i]='\0';
            int j=0;
        while(!tbl.ISEOF())
            if(tbl.Get("ProjectID",ProjectID))
                fprintf(file,"Project ID: %d ",ProjectID);
                ProjectInfo[ProjectArrCnt].ProjectID = ProjectID;
                sprintf(buf,"%d",ProjectID);
                //MessageBox(NULL, buf,"f ID", 0);
                j++;
            else
                tbl.GetErrorErrStr(ErrStr);
                fprintf(file,"Error: %s\n",ErrStr);
                break;
            //if(tbl.Get("ProjectTitle",ProjectName))
            if(tbl.Get("ProjectName",ProjectName))
                MessageBox(NULL,"Inside","",0);
                fprintf(file,"ProjectTitle: %s\n",ProjectName);
                //catName=CategoryName;
                ProjectInfo[ProjectArrCnt].ProjectName=ProjectName;
                //sprintf(buf,"%s",ProjectName);
                MessageBox(NULL,(LPCSTR)ProjectName,"",0);
            else
                tbl.GetErrorErrStr(ErrStr);
                fprintf(file,"Error: %s\n",ErrStr);
                break;
            ProjectArrCnt++;
            //MessageBox(NULL, "While", "WIN API Test",0);
            tbl.MoveNext();
        //MessageBox(NULL, ProjectInfo[i].ProjectName.c_str(),"f Name", 0);
        ::CoUninitialize();
        //sprintf(buf,"%s",file);
        //MessageBox(NULL,buf,"File",0);
        fprintf(file, "Connection closed\n");
        fclose(file);
        for(i=0;i<ProjectArrCnt;i++)
            sprintf(buf,"%i",ProjectInfo[i].ProjectID);
            //MessageBox(NULL,buf,"Proj ID",0);
            //MessageBox(NULL,ProjectInfo[i].ProjectName.c_str(),"Project Name",0);
        return 0;
    In the above code im geeting project D which is an integer value. But not able to get the project name.
    Please some one guide me.

    As I said in the other thread, this really isn't the place to ask questions about a database API unrelated to the Illustrator SDK. You're far more like to find people familliar with your problem on a forum that is dedicated to answering those kinds of questions instead.

  • How can i get the random values from database?

    Hi,
    i want to get random values from database.
    I try my best find no solution
    plz give solution in either sql query or java method.
    thanks in advance.

    try this:
    Give a numeric row-id to each row of database.
    say (1-100) for 100 rows
    In the program use random function to get random number between 0 and 1. this value u multiply with 100(or total number of rows) and take integer value of it . u then perform sql query to select the a row which matches randomly genarated value with row-id assigned to each row of database
    madhu

  • List of values from Database Adapter - BPM Forms

    Hi all,
    Can anyone tell me how to get list of values from Database adapter and a ServiceTask.
    As example lets say a table has Employee and Department columns.
    I want to list down all the Employees in BPM form (Select One List Box) once i provide the department to the Database Adapter.
    Is it possible from the DB Adapter?? What will be the variable type?
    Thanks,
    Nir

    Hi DanielAtwood,
    Thanks for your reply...
    Actually when i send the variable in 'WHERE Clause' in Db Adapter query it will retrieve more than one record as the output.
    I want to put that values to a 'SelectOneChoice' component and list down all the values..
    First I tried with data control. But i couldn't find the way to pass the value to the variable(in WHERE clause) to the query in data control view.
    Thanks,
    Nir

  • How to popup values from database tables to SelectOneMenu

    Hi friends,
    I am doing a jsf application, in which there is a selectOneMenu
    control and I want that, iwhen this page is loaded after clicking button
    on the previous page, the selectOne Menu should be populated with
    the values from database.
    Also I want , if i will select any menu item from the menu , acccordingly
    another selectOneMenu control should be filled with respective values
    thanx,
    bye

    Oh dear. I don't think anybody can advise you until you are not "kinda" new to Java anymore. Learn Java itself (the language, the platform and the tools), only then should you start considering going into web development.

  • I am unable to access information from the internet as I am unable to install the lastest adobe flash player that is now required.  Can you please help?

    I am unable to access information from the internet as I am unable to install the lastest adobe flash player that is now required.  Can you please help?

    I fould a hack that makes the sites think you have the latest (Intel) version of Flash installed. So I installed it & it works with Firefox, TenFourFox & Safari. Here's the info.
    Download this http://www.steelbin.com/FPforFBPPC.zip to your desktop, unzip it, and replace the current Flash Player plug-in which is in your main/Library/Internet Plug-Ins folder, (not the user Library). Save the old one just in case this one doesn't work.
     Cheers, Tom

  • I am from India using my iphone4 with Vodafone and  firmware version 5.0.1(9A405). I am unable to access 3G from my device as the CELLULAR DATA NETWORK option in the settings is missing. Any methods or options for fixing the same????

    I am from India using my iphone4 with Vodafone and  firmware version 5.0.1(9A405). I am unable to access 3G from my device as the CELLULAR DATA NETWORK option in the settings is missing. Any methods or options for fixing the same????

    I am from India using my iphone4 with Vodafone and  firmware version 5.0.1(9A405). I am unable to access 3G from my device as the CELLULAR DATA NETWORK option in the settings is missing. Any methods or options for fixing the same????

  • -111: Unable to access SBO-Common database

    Dear all,
    I am getting following error in addon.
    Error Code:-111
    Error Message: Unable to access SBO-Common database
    My SAP version is : SAP 9.0 PL 11
    Please give me some solution

    Hi Pravin,
    mostl likely your sa password is wrong.
    On what line do you get this error?
    Regards
    Ad

  • How to fill bean area with values from database

    i have a bean area in form which act as acombobox autocomplete , i want to fill it with dynamic values from database , any help will be appreciated.
    http://forms.pjc.bean.over-blog.com/article-16369664.html "this is the example i'm working on"
    Best Regards.

    An example with the EMP table:
    DECLARE
      cursor cur is select empno,ename from emp;
    BEGIN
      -- initialise the ComboBox twin values --
      for c in cur loop
       if c.empno is not null then
        Set_Custom_Property('BL.BEAN',1,'ADD_TWIN',c.empno||','||c.ename);
       else
        Set_Custom_Property('BL.BEAN',1,'ADD_TWIN_NULL',c.empno||','||c.ename);
       end if ;
      end loop;
      Set_Custom_Property('BL.BEAN',1,'ADD_TWIN','[END_DATA]');
      Set_Custom_Property('BL.BEAN',1,'SET_ALIGNMENT','right');
    END;Francois

  • HT4623 unable to access itunes from ipad

    I am unable to access itunes from remote devices which include my ipad and iphone. When I try to purchase apps etc, I am advised "Cannot connect to itunes Store" 

    Hello marie-louise,
    I recommend taking a look at this section of the article Can't connect to the iTunes Store found here http://support.apple.com/kb/ts1368.
    Troubleshooting on an iPhone, iPad, or iPod touch
    If you haven't been able to connect to the iTunes Store:
    Make sure that your iOS software is up to date by connecting your iOS device to iTunes and clicking on Check for Update in your device's Summary page in iTunes.
    Check and verify that you are in range of a Wi-Fi router or base station. If you are on a 3G capable device, make sure that cellular data is turned on from Settings > General > Cellular.
    Note: If connected to 3G, larger items may not download. You may need to connect to Wi-Fi to download apps, videos, and podcasts. 
    Check to make sure you have an active internet connection. You can check the User Guide for your device for help with connecting to the internet. 
    Check to make sure other devices (portable computers, for example) are able to connect to the Wi-Fi network and access the internet.
    Try resetting (turning off and then on again) your Wi-Fi router
    If the issue persists, see troubleshooting Wi-Fi networks and connections.
    Note: All iPhone, and iPod touch models support 802.11b/g Wi-Fi networks. In addition, iPhone 4, and iPod touch (4th generation) support 802.11n Wi-Fi networks (2.4 GHz only).
    And if that does not resolve the issue take a look at this article:
    iTunes: Advanced iTunes Store troubleshooting
    http://support.apple.com/kb/ts3297
    All the very best,
    Sterling

Maybe you are looking for