Zero resultset for MYSQL despite data in tables

I've been getting zero for all my query result sets even though my database is not empty. I don't know if the problem lies with my servlet code or my resin deployment. Can someone tell me what's wrong?
Here's part of the codes.
Login.java
public class Login extends HttpServlet {
final String LOGIN_HOME = "/login.jsp";
final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
final String JDBC_URL = "jdbc:mysql://localhost/algebar";
String errorMsg = "";
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String loginId = request.getParameter("loginId");
String password = request.getParameter("password");
if (loginId != null && password != null)
try {
Class.forName(JDBC_DRIVER);
Connection conn = DriverManager.getConnection(JDBC_URL,"root","algebar");
Statement stmt = conn.createStatement();
ResultSet r = stmt.executeQuery("Show databases");
System.out.println("number rows="+r.getRow());
String nextPage = this.LOGIN_HOME;
byte loginType = validateUser(loginId,password,conn);
--- snipped --
private byte validateUser(String loginId, String password, Connection conn)
throws SQLException {
Statement stmt = conn.createStatement();
ResultSet results = stmt.executeQuery(
"select login_type from login where login_id = '"+loginId+
"' AND password='"+password+"'");
if (results.getRow()==0) {
String query = "select * from login where login_id = '"+loginId+"'";
results = stmt.executeQuery(query);
if (results.getRow()==0) {
System.out.println(query);
setMessage("Invalid user name.");
else setMessage("Invalid password.");
return 0;
else {
return results.getByte("login_type");
Did I miss out something in my web.xml ? I'm currently using Netbeans5.5 but I have trouble deploying this servlet to test it with the pre-installed Tomcat5.5 . I have Tomcat6.0 and Apache 2.2 as well but I'm also having trouble starting TOmcat6.0 so that's why I'm using Resin3.11. I have no problems accessing login.jsp and the Login servlet but the executeQuery() all return zero ResultSet .
Hope someone can give me an idea of what I'm missing or have done wrong.

Oh my god... I really forgotten abt it..
I kept thinking the problem was elsewhere and never paid attention to it. Kept thinking there was something wrong with my deployment or my queries. Thanks so much. I've changed all to prepared statements already.
Rather embarrassing mistake..
Thanks BalusC :)

Similar Messages

  • Extracting data with zero values for periods without data

    Hello Together,
    i extracted data from our hfm application from period 1 to 3.
    Now i found that some rows begin with period 2 or 3 because there are no data in period 1 or 2.
    So my question is, how i can get zero values for periods with no data.
    Hope someone can help me.
    Many thanks in advance.
    Martin
    P.S.: Our actual hfm version is 11.1.1.3
    edit

    For the periods with no data, HFM does not have a "0" to offer for the data extraction. Since the default data extract from HFM has each period on it's own row in the *.dat file, I don't understand your comment about rows starting with period 2 or 3. In the *.dat file the row for period 1 simply won't exist. Are you using a custom approach/tool for data extraction?
    The only time HFM will offer a "0" where there is indeed no data, is if you extract derived data. You must include calculated data, and even then I believe HFM will only extract a "0" for the first period after a period where there was data, and only for flow accounts (Revenue/Expense). so if you have "100" in period 1, and no data in period 2, such that the derived value YTD for period 2 is "0", then you must include calculated values in the extract and you should see "0" for period 2. However, I don't believe HFM will extract "0" for period 3 - instead it will be blank/missing.
    In general it could be very dangerous to force HFM to give zeros where there is no data.
    --Chris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Insert query for insert all data into table in vb6 but it insert 1 row in table

    This is My insert query in vb6 but it insert 1 row in table
    But i want insert all data in the table which contain the id =1.
    Note that billtabsuport is blank
    i want solution for this
    strSQL = " select * from billtabsuport1 where StockID=" & lblid.Caption
    Set DBrecordset = DBConnection.Execute(strSQL)
    strSQL = " Insert into billtabsuport values('" & DBrecordset("StockID") & "','" & DBrecordset("C_Name") & "','" & DBrecordset("C_Add") & "','" & DBrecordset("C_Mobile") & "','" & DBrecordset("Invoice_No") & "','" & DBrecordset("Date") & "','" & DBrecordset("Order_No") & "','" & DBrecordset("T_Name") & "','" & DBrecordset("Dest") & "','" & DBrecordset("D_Date") & "','" & DBrecordset("Tyres_Serial_No") & "','" & DBrecordset("P_Desc") & "','" & DBrecordset("PR") & "','" & DBrecordset("Branded_NonBranded") & "','" & DBrecordset("Claim_No") & "','" & DBrecordset("Qty") & "','" & DBrecordset("U_Price") & "','" & DBrecordset("I_Value") & "','" & DBrecordset("V_Rate") & "','" & DBrecordset("V_Amt") & "','" & DBrecordset("Size") & "','" & DBrecordset("Pattern") & "','" & DBrecordset("TypesOfStock") & "','" & DBrecordset("TypesOfTube_Flap") & "','" & DBrecordset("VatAmount") & "')"
    DBConnection.Execute (strSQL)

    The syntax for inserting from one set of tables to a new table is:
    insert into newtable
    (field1, field2, etc)
    select somefield1, somefield2, etc
    from some other tables
    where whatever

  • Interfaces used for insert/update data in tables

    for providing security the procedures are not allowed to directly insert/update the values in tables.some one suggested that use interfaces for this .i want infomation about this interfaces. how this works and how to use

    An interface is an intermediate set of procedures/functions that do the job for you.
    You haven't explained what it is you're trying to achieve exactly, but here's an example scenario.
    We don't want to allow our developers to query, or write to the tables directly so they are set up with certain database users that have no permissions granted on the tables for such things.
    Instead they have been granted permission to call procedures and functions belonging to another schema, and it is those procedures and functions that do the required table access and/or pass information/data back or write to the tables.
    The developers have to write their applications to call these procedures to do any access to the tables. This means that they are limited to the functionality provided by these interface procedures so, if there is internal auditing or columns of data etc. on the tables then it may be that they can't access this data, but only the "user facing" data.
    The interface can also ensure that data meets certain requirements before being written to tables, allowing for business or technical level restrictions to be implemented.

  • How do i save the data in table ??? URGENT

    how do i save the data in table ???  URGENT
    Hope can attach some example VI for reference =]
    Attachments:
    data in table.JPG ‏271 KB
    block diagram.JPG ‏459 KB

    You didn't mention which version of LabVIEW you are using. I adapted your method in this example. Not sure this is an efficient method. I just pass the 2d array through in the false case.
    Using LabVIEW 2010SP1 and TestStand 4.5
    Attachments:
    WriteTable.PNG ‏35 KB

  • Import data in to tables for MySQL, DB2 and others

    The documentation says that you can right click and select import data and import from a file. But apparently this doesn't work for MySQL, DB2 or other databases? Is that correct? There is no way to do mass data entry or editing of data?

    Correct. We're trying to help you move data from MySQL, DB2, or other (non-Oracle) databases TO Oracle.

  • Table for Plant Creation Date

    Hi,
    Can anyone tel me the  table name for Plant Creation date .?
    I searched in SDN but DBLOGTAB in my case has ZERO entries .Is thr any other way ?

    Hello,
    So i hope you get the reason why your are not getting the table changes in DBTABLOG
    You should take help of the basis team for doing this. PLease go through the SAP documentation for details:
    [http://help.sap.com/saphelp_nw04/helpdata/en/7e/c81ec852c511d182c50000e829fbfe/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/7e/c81ec852c511d182c50000e829fbfe/content.htm]
    [http://help.sap.com/saphelp_nw2004s/helpdata/EN/32/a479f0e083fc4386e66380e932497e/content.htm|http://help.sap.com/saphelp_nw2004s/helpdata/EN/32/a479f0e083fc4386e66380e932497e/content.htm]
    BR,
    Suhas

  • Java datatype for MySQL DATE?

    Hello!
    I want to read the content of a database table and store it in a linked list.
    My problem is that i dont know what datatype in Java to use for storing the MySQL type DATE.
    Can i use different types for that purpose? Which type is best?
    Thank you

    mattias_westerberg wrote:
    Hello!
    I want to read the content of a database table and store it in a linked list.
    My problem is that i dont know what datatype in Java to use for storing the MySQL type DATE.
    Can i use different types for that purpose? Which type is best?
    Thank you[java.sql.Date|http://java.sun.com/javase/6/docs/api/java/sql/Date.html]
    The best way to store it depends on what you want to do with it. Ultimately you could store it however you wish: bytes, a string, serialized to disk somehow, but a java.sql.Date is what your JDBC API will be taking so it would be convenient to use that if you want to modify the date and store it back to the database.

  • MySQL move date from one table to another

    I was wondering if there is a MySQL command that will let me move a selected row of data from one table to another. both tables have the same columns and declaration type (one table is actually an archived table on old data)
    example
    I wasnt to move all data in Table1 where the date is greater than 30 days old to Table 2
    -- so the result should be...import all rows to Table 2 where the date is greater than 30 days old..and delete all date from Table 1 that is greater than 30 days.
    currently..I'm doing three process
    1) get all row that is greater than 30 days  
        "SELECT * FROM Table1 WHERE TO_DAYS(NOW()) - TO_DAYS(dateField) > 30"
    2) insert data into Table2
        while (res.hasNext())
              TableData data = ..... // .get row
              dataList.add(data);
              for (int i = 0; i < dataList.size(); i++){
                    pstm.setString.....
                    pstm.addBatch()
              pstm.executeBatch();
    3) delete data from Table1
        "DELETE FROM Table 1 WHERE  TO_DAYS(NOW()) - TO_DAYS(dateField) > 30"

    for this app..losing a few rows does not
    impact on how we analyze the data.That's what everyone always tells me too. But 99% of the time they come back and want to know why the cannot balance and/or validate the data between two runs taken only minutes from each other.
    I've seen people puzzle over data for days that they swear they ran the exact same utility for their tests, but they were in fact using live data, and additional data had accrued but since all they had to do was execute the a script without parameters (they didn't put in a stop time), they got two different answers and it always, and I mean always confuses people. Be safe, and put the option in for and end date/time, then when they waste days trying to figure out why the two different observations gave them different numbers, they cannot blame you (because you gave them the option)!
    My 2 cents for the day...

  • No Resultset for query containing multiple tables

    Hi, I am new to Oracle and I have a problem concerning the Oracle datasource/query I am using.
    I am using Websphere Application Server v5.1 Test environment, which connects to an Oracle 10g database and a DB2 database.
    So basically, I have 2 datasources in my webservice application, one for each database. I have tested both datasources from the admin console of the server and both return no errors. Both datasources are loaded on startup of the application and again, there are no errors.
    The problem basically is that I have no resultset elements ( rs.next() is false ) when I have a query that queries multiple tables.
    Eg. Case1: Select * From table1
    Case2: Select * From table1, table2
    Case3: Select * From table1 t1 INNER JOIN table2 t2 on t1.column = t2.column
    Case1: Contains resultset
    Case2 and Case3: NO resultset
    When these queries (case 2 and case3) are run from within the webservice application, there is no resultset; only case1 returns a resultset. However, if I run the same queries above from within Oracle SQL developer, there is a resultset containing the matching records. This problem only happens when using the Oracle datasource; the same problem does not happen for the DB2 datasource.
    Basically, I do not have any resultset for a valid query and there aren't any errors as well.
    Any ideas as to why this happens?
    Thanks for any help.
    Edited by: user11220677 on Jun 3, 2009 3:08 AM

    Finally got to the bottom of this. Turns out that the problem has nothing to do with the Oracle datasource in the webservice application, as what I have initiially thought.
    The cause of the problem seems to be related to an import problem/issue in the Oracle SQL developer. Everytime I open Oracle SQL developer, one table (table2 in my example from previous post) is missing its data, so I import the data using the application's import wizard. Once the import is done, I use SQL developer's query interface to verify the data is there, and there are records returned - which made me think the database table was updated successfully. The problem was, I still do not have results when the query is run from the webservice containing the datasource.
    We used another SQL command editor to verify if the said table was really updated in the database and to our surprise, it was still empty (even after the import from Oracle SQL developer). That explains why I am not able to retrieve anything from the webservice.
    We just imported the data using another SQL command editor and the issue is now fixed.
    Thanks anyway.

  • FDMEE Import error "No periods were identified for loading data into table 'AIF_EBS_GL_BALANCES_STG'

    Hi,
    We are having trouble while importing one ledger 'GERMANY EUR GGAAP'. It works for Dec 2014 but while trying to import data for 2015 it gives an error.
    Import error shows " RuntimeError: No periods were identified for loading data into table 'AIF_EBS_GL_BALANCES_STG'."
    I tried all Knowledge docs from Oracle support but no luck. Please help us resolving this issue as its occurring in our Production system.
    I also checked all period settings under Data Management> Setup> Integration Setup > Global Mapping and Source Mapping and they all look correct.
    Also its only happening to one ledger rest all ledgers are working fine without any issues.
    Thanks

    Hi,
    there are some Support documents related to this issue.
    I would suggest you have a look to them.
    Regards

  • Table for Valid To date field in C203 Tcode

    Let me know the table name for "Valid To Date" field in C203 transaction.
    Thanks,
    Angavai.E

    Hi Angavai,
    Check with table PLMW.
    Regards,
    Raghu

  • Table for Job effective date

    Please let me know the table and field for the Effective date the employee moved into the job
    Lisa

    Hi Lisa,
    the fileds BEGDA and ENDDA represent the Effective date and end date of the EE assigned to the Job
    Thanks
    Cheera

  • Table for Reservation creation Date

    All SAP Gurus,
    What is the Table for Reservation creation Date?
    Regards,

    Hi Vijay,
    Thanks for reply.
    Tables yiu have recommended do not have the reservation creation or updation date.
    Please correct me if I'm wrong.
    Regards,

  • Get frequent data for each column of a table

    What is the best way to get the most frequent data in each column of a table.
    we have around 25 tables and each table has around 20 columns , so rather than writing group by for each column of table , is there any easy way to find this?
    example we have table
    Column A       Column B         Column C
    Apple             Monday             Red
    orange            Tuesday            Green
    Apple              Monday            Red
    Lemon            Wednesday       Green
    Apple               Thursday         Red
    in this table, column A's frequnt data is Apple , column B's frequent data is Monday , Column C's frequnt data is Red
    Apple 3          Monday 2                  Red 3
    Orange 2        Tuesday 1                 Green 2
    Lemon 1          Wednesday 1         
                          Thursday 1
    Group by kind of query will give this result, but with 20 tables each having 20 - 30 columns if we need similar kind of result ..  is there any way to get this data.

    Hi,
    GROUP BY (using aggregate functions) is the best way to do what you described.
    PIVOT and UNPIVOT are probably what you'd want in this case.  The phrase "GROUP BY" may not actually appear in your code, but you'll essentially be doing a GROUP BY.
    Analytic functions (rather than aggregate functions) can do the job, too, but they'll be less efficient.  Analytic functions get you results about the groups, without losing each row's identify, but in this case, losing each row's identity is eactly what you want to do.  You only want 'Apple' to appear 1 time, not 3 times.
    The fact that you need to do the same query on 20 different tables suggests that there's something wrong with your table design.  Wouldn't it be better to have 1 big table, with a new column that has 20 unique values instead?
    I hope this answers your question.
    If not, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Simplify the problem as much as possible.  For example, instead of posting a problem with 20 tables, each having 25 columns, post a similar problem involving, say, 2 tables, each with 3 columns.
    Always say which version of Oracle you're using (for example, 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

Maybe you are looking for

  • Macbook pro not connecting wirelessly to my FiOS

    I just got a Macbook Pro last Wednesday immediately after having Verizon FiOS installed in my house on Tuesday. Unfortunately I can't get Airport to connect to the internet at my house. I would say it's just FiOS but my neighbor has the exact same se

  • Reg  Order reservation not deleting after PGI (VL01N)

    Hi All, ETO scenario, For production, reservation will be create through WBS element. After production , If I do delivery and PGI,  production order reservation is not deleting. Same material If I do delivery(LP) through CNS0, then order reservation

  • How can I get Exchange to work?

    I cannot get exchange to work. Here is how I am setting it up. email - [email protected] server - webmail.company.com username - company.local\first.last password - ****** Am I doing something wrong? I can't connect on the company network or at home.

  • Transporting "Deleted records" with TABU

    Hi everybody, I have a Z table defined as customizing (Delivery Class C) We are updating it using a special dialog program we developed that doesn't creates change request. usually the changes in this table are small (only a few records) and we repea

  • MacMini and HDTV?

    i'm thinking about getting a MacMini to connect to my HDTV, and then just connecting my bluetooth keyboard and mouse to it, thus Macatizing my living room. if i connect the Mini to the TV, will i be able to watch DVDs in HD on it? what if i make movi