Java, postgres and jasper help

hi all,
i am trying to fix this bug within my program. its a java, postgres and
jasper based program which generates charts. now i am generating a
chart which does not show any 0 data points if they exist, only
non-zero ones. obviously i am trying to do everything in just one sql
query, but i am not sure if its possible or not. i also need to
generate a temporary table and then delete it.
I have broken the tasks into,
1. create a temp table
2. create records for 0 data points
3. update with non 0 records
4. delete temp table.
now this is what i have and i would appreciate all help with fixing
this,
public void createTempTubProdTable(String filter, String tableName)
throws SQLException {
String sqlStr = "";
String sqlWhereStr = " WHERE ";
Debug.println("FILTER: " + filter);
if (filter != null)
sqlWhereStr = sqlWhereStr + filter;
else
sqlWhereStr = sqlWhereStr + "'?' = '?'";
String sqlCreateTableStr = "" +
"CREATE TABLE \"public\".\"tubprod_temp\" ( " +
" \"tubprod_event\" BIGSERIAL, " +
" \"edit_time\" TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT now(), " +
" \"edit_time_count\" BIGINT, " +
" CONSTRAINT \"tubprod_temp_pkey\" PRIMARY KEY(\"tubprod_event\") " +
") WITHOUT OIDS; ";
String sqlInsertDataStr = " " +
" INSERT INTO tubprod_temp (edit_time,edit_time_count) " +
" SELECT to_timestamp(to_char (last_edit_timestamp,'YYYY-MM-DD
HH24:00:00'), 'YYYY-MM-DD HH24:00:00')AS edit_time, count(to_char
(last_edit_timestamp,'YYYY-MM-DD HH24:00:00')) as edit_time_count " +
" FROM " + tableName + " " + sqlWhereStr +
" GROUP BY to_char (last_edit_timestamp,'YYYY-MM-DD HH24:00:00') " +
" ORDER BY to_char (last_edit_timestamp,'YYYY-MM-DD HH24:00:00'); ";
Debug.println("sqlInsertDataStr: " + sqlInsertDataStr);
Statement stmt = conn.createStatement();
// Create temporary tub production table
sqlStr = sqlCreateTableStr + sqlInsertDataStr;
Debug.println(sqlStr);
stmt.executeUpdate(sqlStr);
public void deleteTempTubProdTable() throws SQLException {
Statement stmt = conn.createStatement();
// Drop temporary tub production table
String sql = "DROP TABLE tubprod_temp;";
stmt.executeUpdate(sql);
}

Crosspost

Similar Messages

  • Java mail and jsp -HELP!! HELP!!

    Hi all
    I have a simple email module with a jsp page and a html page I am trying to connect to a yahoo smtp server and send a mail from the webpage to the smtp server - I am getting an Authentication required error.
    error ##
    org.apache.jasper.JasperException: Sending failed;
    nested exception is:
         class javax.mail.MessagingException: 530 authentication required - for help go to http://help.yahoo.com/help/us/sbc/dsl/mail/pop/pop-11.html
    Can anyonne tell me how to use a simple smtp email facility
    how to use an authenticator in the jsp
    ciao
    laodingdockjavaguy

    It's required that you authentificate yourself at the smpt server
    The following snipplet sends a msg using the smtp protocol.
    Transport tr = session.getTransport("smtp");
    tr.connect(smtphost, username, password);
    msg.saveChanges();     // don't forget this
    tr.sendMessage(msg, msg.getAllRecipients());
    tr.close();If this still fails You can also try to set the property mail.smtp.auth to true.
    mail.smtp.auth      boolean      If true, attempt to authenticate the user using the AUTH command. Defaults to false.see also http://java.sun.com/products/javamail/1.3/docs/javadocs/com/sun/mail/smtp/package-summary.html
    for a complete description of the properties supported by the smpt transport.
    hope it helps

  • Java Matching and Patterns - help please.

    Ok, so I'm trying to take a CSV file and store it as an XML file using Java. Here's a sample line of the data file I'm working with:
    1001,"Fitzsimmons, Des Marteau, Beale and Nunn",109,"COD","Standard",,109,8/14/1998 8:50:02
    I'm trying to use regular expressions to match each field separately. I can't use split on "," because of the commas in the quotes (which is one whole field). So far, the first field matches to "[0-9]+," What would be the regex for the second field? "\".+\"," doesn't work, and I'm running out of ideas.

    I know this doesn't help the immediate problem, but I just have to say that this is the reason why comma is not a good separator. Why doesn't the world wake up and use tabs? I would assert that the chance of a value containing an embedded tab character is slim to none, whereas the chance that it contains any "printable" character is much greater - leading to this very headache.
    So actually this might help afterall, if you can get the separator changed.

  • Help Needed in Creating Java Class and Java Stored Procedures

    Hi,
    Can anyone tell how can i create Java Class, Java Source and Java Resource in Oracle Database.
    I have seen the Documents. But i couldn't able to understand it correctly.
    I will be helpful when i get some Examples for creating a Java Class, Java Source and Stored Procedures with Java with details.
    Is that possible to Create a Java class in the oracle Database itself ?.
    Where are the files located for the existing Java Class ?..
    Help Needed Please.
    Thanks,
    Murali.v

    Hi Murali,
    Heres a thread which discussed uploading java source file instead of runnable code on to the database, which might be helpful :
    Configure deployment to a database to upload the java file instead of class
    The files for the java class you created in JDev project is located in the myworks folder in jdev, eg, <jdev_home>\jdev\mywork\Application1\Project1\src\project1
    Hope this helps,
    Sunil..

  • Dropdown and Value Help in Adobe Form (WebDynpro Java)

    Hi Experts,
    I need to develop a Adobe form where i have to implement Dropdown and Value Help, which will coming from custom BAPI. I am using WebDynpro Java, EP 7.0 and ALD 8.0. Please let me know how can i implement those 2 UI Elemnts..
    Regards
    Subhrajyoti

    Hi Jyothi,
    Herewith I had Explained detailed Procedure,
    For Dropdown,
    1.     Create a node and attribute to the dropdown ,
    2.     call the bapi,
    3.     Assign the Bapi attribute to the Dropdown node attribute
    4.     Place the Interactive form UI to the Java Application
    5.     Create an another  attribute for read the interactive form
                  a.Name: pdf_src
                  b.Type :byte, Assign this attribute to PDF Source property of the Interactive form UI Element.
    6.     Give the Name to the Template source property of the Interactive form UI and double click the        template source.
    7.     It asking Name for the Interactive form, Give the name for that
    8.     Once give the Name, It ask context for Adobe form, assign the already created node for dropdown in Webdynpro application to the interactive form.
    9.     Now Context Bounded with Webdynpro and Interactive form
    10.     Interactive form screen will be open into the studio
    11.     Place the Dropdown UI element  to the Interactive form and bind the attribute to the dropdown
    12.     Select the Dropdown UI Element, go to the object property, Click the Specify Item values. The pop window displayed, here give the $ value to the Item Text, Item value. The Data Connection dropdown and Default Binding , it has value when the attribute bounded to the dropdown UI .
    13.     Save and Test the Application
    For Value Help,
    1.     Do the Same Procedure for up to 10 steps,
    2.     Place the Text field UI and Value Help UI Element
    3.     Select the Value Help, go the Script Editor give the name of the text field attribute name in var fieldName = "*INSERT_NAME_HERE*";
    4.     Save and Test the Application
    By
    Parthi

  • I have creative suite 5.5 and have recently updated my iMac to Yosemite. Now I can't open the adobe apps. I have done the suggested Java update and mac OS X Java patch update.. still no go. Can you HELP?

    I have creative suite 5.5 and have recently updated my iMac to Yosemite. Now I can't open the adobe apps. I have done the suggested Java update and mac OS X Java patch update.. still no go. Can you HELP?

    uninstall, clean (Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6) the install using the installation files.  do not migrate adobe programs.
    Downloadable installation files available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 | 12 | 11, 10 | 9, 8, 7 win | 8 mac | 7 mac
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7 win | 8 mac | 7 mac
    Lightroom:  5.7.1| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5.5, 5 | 1
    Contribute:  CS5 | CS4, CS3 | 3,2
    FrameMaker:  12, 11, 10, 9, 8, 7.2
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • KDE, Konqueror and Java... HELP!!!

    i'm running RedHat 8.0 w/ KDE and i can't seem to get applets running at all, i know that my JVM works fine since i use it to compile and run my apps but i can't seem to get applets running at all! under settings have i "enabled java globally" and have tried to set the "path to ajva executable" but i'm not sure what to point it to... any help is useful

    I'm not entirely sure about Konqueror, but this is what I did to get it to work on Mozilla and Galeon. I be that Konqueror won't be too much different < http://members.shaw.ca/trollking >.

  • b font color ='red' Java JDBC and Oracle DB URGENT HELP PLEASE /font /b

    Hello, I am a newbie. I'm very interested in Java in relation to JDBC, Oracle and SAP.I am trying to connect to an Oracle DB and I have problems to display the output on the consule in my application. What am I doing wrong here . Please help me. This is my code: Please Explain
    import java.sql.*;
    import java.sql.DriverManager;
    import java.sql.Connection;
    public class SqlConnection {
         public static void main(String[] args) {
              Class.forName("oracle.jdbc.driver.OracleDriver"); //Loading the Oracle Driver.
              Connection con = DriverManager.getConnection
              ("jdbc:orcle:thin:@34.218.5.3:1521:ruka","data","data"); //making the connection.
              Statement stmt = con.createStatement ();// Sending a query to the database
              ResultSet rs = stmt.executeQuery("SELECT man,jean,test,kok FROM sa_kostl");
              while (rs.next()) {
                   String man = rs.getString("1");
                   String jean = rs.getString("2");
                   String test = rs.getString("3");
                   String kok = rs.getString("4");
                   System.out.println( man, jean, test,kok );//here where my the
                                                 //compiler gives me errors
              stmt.close();
              con.close();
    }

    <b><font color ='red'>Java JDBC and Oracle DB URGENT HELP PLEASE</font></b>Too bad your attempt at getting your subject to have greater attention failed :p

  • Help with Java JNI and C++

    Hi everyone! I have a problem with Hello World example. I wrote java code in Visual Age 4.0:
    <HelloGinja.java>
    package jnitest;
    public class HelloGinja {
         static {
              System.load("c://c++//hellotest//release//hellotest.dll");
          * HelloGinja constructor comment.
         public HelloGinja() {
              super();
         public native void displayHelloGinja();
         public static void main (String args[]) {
              System.out.println("Calling displayHelloGinja...\n");
              new HelloGinja().displayHelloGinja();
              System.out.println("Finished displayHelloGinja...\n");
    }I made header file from command line:
    javah -jni jnitest.HelloGinja
    I wrote C++ code in Visual Studio 6.0:
    <hellotest.cpp>
    #include "stdafx.h"
    #include "hellotest.h"
    #include <jni.h>
    #include "jnitest_HelloGinja.h"
    #include <stdio.h>
    BOOL APIENTRY DllMain( HANDLE hModule,
                           DWORD  ul_reason_for_call,
                           LPVOID lpReserved
        switch (ul_reason_for_call)
              case DLL_PROCESS_ATTACH:
              case DLL_THREAD_ATTACH:
              case DLL_THREAD_DETACH:
              case DLL_PROCESS_DETACH:
                   break;
        return TRUE;
    // This is an example of an exported variable
    HELLOTEST_API int nHellotest=0;
    // This is an example of an exported function.
    HELLOTEST_API int fnHellotest(void)
         return 42;
    // This is the constructor of a class that has been exported.
    // see hellotest.h for the class definition
    CHellotest::CHellotest()
         return;
    extern "C" {
         JNIEXPORT void JNICALL Java_jnitest_HelloGinja_displayHelloGinja(JNIEnv *env, jobject obj)
              printf("\nHello Ginja Glisic!\n");
              return;
    }What is the problem? I compile program well but when I run it from VAJ I am getting:
    Calling displayHelloGinja...
    Finished displayHelloGinja...
    It seems like it does not call native method at all. I exported file out from VAJ and run it from command line.I got:
    Calling displayHelloGinja...
    Hello Ginja Glisic!
    Finished displayHelloGinja...
    Everything is ok.It works. why then it won't work in VAJ?
    Can anyone have idea? I will be very thankfull for any help or advice.

    Ok, I solved my problem. I returned string from native method to java code and I got it. The point is native method is being called but I couldn't see it's output from VAJ.
    Does anyone know any good tutorial about VAJ? If does, please post it .

  • Help:java card and rfid

    I searched a lot about java card and rfid, but don't have a clear idea about the relationship between the two. Please help me....

    They have NO common grounds.
    A java card needs a real "smart" processor because it contains a Java Virtual Machine, can do crypto and other stuff. The cost to produce one is in the multi dollar range. Some java cards can communicate contactless by "radio".
    RFID is the term to describe a very primitive device, all it can do is report a unique identification (ID) and it does this contactless (RF). the cost to produce one is in the cent range. You can use it to track products or containers or other stuff.
    Since RFID is also a very popular buzzword these days, the exact meaning of RFID varies.
    Of course, you could use a java card to play RFID tag, but that would be
    very expensive. Java cards are usually used for bank cards and similar applications.

  • Hi frnds i want to help in servlet,java bean and JSP

    hi friends i'm right now in M.SC(IT) and i want to do project in SERVLET,,JAVA BEANS and JSP ,
    so pls give me a title about that
    NOTE: I develop a project in group(2 persons there)
    my email id is : [email protected] , [email protected] , [email protected]

    You cannot pair your iPod to a cell phone, so forget about it.
    The only way you can get free WiFi is to hang out at a Denny's, a Starbucks, or a truck stop, and I don't think your parents would approve....

  • Help with Java program and PKGBUILD

    Hey guys, I'm fairly new to Arch and very new to making packages. I write a lot of my stuff in Java, and I know that Java is normally a pain to package on Linux systems. I have had a good look at the Java Packaging Guidelines, http://wiki.archlinux.org/index.php/Jav … Guidelines and I see that it says about not bothering compiling from Java source and just provide the JARs (am I correct?). So my question is, if I were to make a PKGBUILD for my Java based program, would the build() block just basically create the folders in the filesystem and move the content (JARs etc) to the folders? And then create the shell script in the appropriate location?
    Forgive me I have the completely wrong idea...
    Many thanks

    Hey guys, I'm fairly new to Arch and very new to making packages. I write a lot of my stuff in Java, and I know that Java is normally a pain to package on Linux systems. I have had a good look at the Java Packaging Guidelines, http://wiki.archlinux.org/index.php/Jav … Guidelines and I see that it says about not bothering compiling from Java source and just provide the JARs (am I correct?). So my question is, if I were to make a PKGBUILD for my Java based program, would the build() block just basically create the folders in the filesystem and move the content (JARs etc) to the folders? And then create the shell script in the appropriate location?
    Forgive me I have the completely wrong idea...
    Many thanks

  • First use of jsp and java bean and "Unable to compile class for JSP" error

    Hi,
    I am trying to create my first jsp + java bean and I get a basic error (but I have no clue what it depends on exactly). Tomcat seems to cannot find my class file in the path. Maybe it is because I did not create a web.xml file. Did I forgot to put a line in my jsp file to import my bean?
    Thank you very much for your help.
    Here is my error:
    An error occurred at line: 2 in the jsp file: /login.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    /usr/local/tomcat/jakarta-tomcat-5/build/work/Catalina/localhost/test/org/apache/jsp/login_jsp.java:43: cannot resolve symbol
    symbol : class CMBConnect
    location: class org.apache.jsp.login_jsp
    CMBConnect test = null;
    I only have this in my directory:
    test/login.jsp
    test/WEB-INF/classes/CMBConnect.java
    test/WEB-INF/classes/CMBConnect.class
    Do I need to declare another directory in classes to put my class file in it and package my bean differently?
    Here is my login.jsp:
    <%@ page errorPage="error.jsp" %>
    <jsp:useBean id="test" type="CMBConnect" scope="session" />
    <html>
    <head>
    <title>my test</title>
    </head>
    <body>
    <h3>Login information</h3>
    <b><%=session.getValue("customerinfo.message")%></b>
    <form> ....... </form>
    </body>
    </html>
    and here is my CMBConnect.java:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class CMBConnect
    public CMBConnect () { }
    public String openConnection(String id, String password) {
    String returnText = "";
    try {
    Connection con = null;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection("jdbc:oracle:thin:@myserver.abc.com:1521:TEST", id, password);
    if(con.isClosed())
    returnText = "Cannot connect to Oracle server using TCP/IP...";
    else
    returnText = "Connection successful";
    } catch (Exception e) { returnText = returnText + e; }
    return returnText;
    Thanks again!

    Thanks for you help
    I created the package and I get this error this time:
    javax.servlet.ServletException: bean test not found within scope
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:822)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:755)
         org.apache.jsp.login_jsp._jspService(login_jsp.java:68)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:268)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:277)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:223)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

  • JSP and Servlet - help please

    Hello,
    I am making this feedback for fun and a bit of learning too. I have an INDEX.JSP page, where the user selects the very first option. Depending upon the selected option he is moved another page PRODUCTFEEDBACK.JSP (so far I have completed this). Here as usual there are many fields to be filled in. As a spams protection i have done this;
    I have a AdditionClass, which is a seperate class where two number are generated at random. This numbers are called by PRODUCTFEEDBACK.JSP. The user is then asked to perform the addition. The completed form is then sent to ProductFeedback servlet.
    When I compile my PRODUCTFEEDBACK.JSP I get this error. Can you please tell whats wrong?
    PRODUCTFEEDBACK.JSP
          *<td>Please help us to prevent Spams by performing this simple mathematical Calculation. We appreciate your effort </td>*
        *</tr>*
      *</table>*
      *<jsp:useBean id = "AddTest" class = "go.AdditionClass" />*
      *<table width="53%"  border="0" align="center">*
        *<tr>*
          *<td><div align="center">*
      *<input name="textfield8" type="text" size="3" value ="<jsp:getProperty name="AddTest" property = "randNum1" />">*
    *  + * 
      *<input name="textfield9" type="text" size="3" value="<jsp:getProperty name="AddTest" property = "randNum2" />">*
    *  = *
    *<input name="_total" type="text" size="5">*
          </div></td>
        </tr>
        <tr>
          <td> </td>
        </tr>
      </table>
      <br>
      <table width="37%" height="23"  border="0" align="center">
        <tr>
          <td width="33%"> </td>
          <td width="67%"><input type="submit" name="Submit" value="Click here to send us this form"></td>
    AdditionalClass.java
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package go;
    import java.util.Random;
    * @author MAC
    public class AdditionClass {
        Random generator = new Random();
        int randNum1; // First Random Number
        int randNum2; // Second Random Number
        public void SetNum1(){
            randNum1 = generator.nextInt(10); // Generate First Random Number
        public int getNum1(){
            return randNum1; //Return First Random Number
        public void SetNum2(){
            randNum2 = generator.nextInt(10); // Generate Second Random Number
        public int getNum2(){
            return randNum2; // Return Second Random Number
        // send the Random Numbers to ProductFeedback class
        public void productFeedbackRandNum1(){
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber1(randNum1);
        public void productFeedbackRandomNum2(){
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber2(randNum1);
    }Erros that I am getting:
    org.apache.jasper.JasperException: Cannot find any information on property 'randNum1' in a bean of type 'go.AdditionClass'
    C:\Documents and Settings\MAC\My Documents\NetBeansProjects\FeedBack\nbproject\build-impl.xml:462: The following error occurred while executing this line:
    C:\Documents and Settings\MAC\My Documents\NetBeansProjects\FeedBack\nbproject\build-impl.xml:440: Java returned: 1
    BUILD FAILED (total time: 1 second)

    Thank you for replying. I modified my Bean class then what is posted above, so thought to repost the code again and seek help. There seems to be no error now but it just dont generate any random numbers, All i get very time is 0. I am wondering, is my code generating 0 as random number, every time :-)
    package go;
    import java.util.Random;
    public class AdditionBean {
        int randNum1; // First Random Number
        int randNum2; // Second Random Number
        public void generateRandomNum1(){
            Random generator = new Random();
            int num1 = generator.nextInt(10);
            SetRandNum1(num1);
            // Send num1 value to ProductFeedback.java
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber1(num1);
        } // End of generaeRandomNum1
        public void generateRandomNum2(){
            Random generator = new Random();
            generator = new Random();
            int num2 = generator.nextInt(10);
            SetRandNum2(num2);
            // Send num1 value to ProductFeedback.java
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber2(num2);
        } // End of generateRandomNum2
        public void SetRandNum1(int num1){
            randNum1 = num1;
        public int getRandNum1(){
            return randNum1; //Return First Random Number
        public void SetRandNum2(int num2){
            randNum2 = num2;
        public int getRandNum2(){
            return randNum2; // Return Second Random Number
    }// End of classThank you,

  • Whats is difference between Java JRE  and  Java SDK

    Hi,
    what is the difference between Java JRE and Java SDK...
    i think both of them have the same set of files to be installed...
    I am not able to understand where they differ

    The JRE (Java runtime Environment) contains just the stuff necessary to run Java and the SDK (System Development Kit) contains the extra stuff necessary (and also helpful) to develop in Java.

Maybe you are looking for