Problem with using Postgres database in java.

Hi ,
I am using netbean netbean IDE 6.1.5 and postgres as my database.
I want to pass a date to a query in java like-
"select count(\"JOBID\") from emp
to_char(\"STARTTIME\",'yyyy-MM-dd')=" + datestr
where STARTTIME is a date field,
but when I run the program it gives the error
error: operator does not exist: text = integer
even if I use this query
ResultSet result1= stmt.executeQuery("select count(\"JOBID\") frrom emp "+
" where to_date(\"STARTTIME\",'YYYY-MM-DD HH:MI:SS')=" + sqlDate);
WHERE STARTDATE is string and
sqlDate=java.sql.Date sqlDate
it gives
error:error: operator does not exist: date = integer
please help
moni

Use PreparedStatement instead of Statement all the way. Not only it is faster and saves you from any SQL injection risks, but it also eases setting complex Java objects in a SQL query. It has for example a setDate() method.
Prepare here: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html].

Similar Messages

  • Problem with using Logical Database PNP

    Hello everybody!
    When I use the logical database PNP in my program,a warning message appeared during the syntax check with Unicode checks actived.The message looks like below:
    <b>Include DBPNPCOM.
    In Unicode programs,the "-" character cannot appear in names,as it does here in the name "PNP-SW-FOUND".
    Include DBPNPCOM.
    In Unicode programs,the "-" character cannot appear in names,as it does here in the name "PNP-SY-TABIX".</b>
    Anybody know how to deal with this problem?
    Regards
    Brian Liu

    Hi,
    You can either ignore the warnings or uncheck the 'Unicode checks Active' checkbox in the program attributes. In fact you get the same warnings off most standard SAP HR Reports.
    Good luck,
    Suresh Datti

  • We encountered a problem during use the Configtool access JAVA engine.

    We encountered a problem during use the Configtool access JAVA engine.
    Our environment of system as below:
    HardWard: IBM i570
    OS: IBM as/400 V5E3
    DB: DB2/400
    Application system:SAP XI 3.0
    The problem we encountered as below:
    Our company used XI 3.0 SR1 for exchange data between SAP R/3 and no-sap system.For now,we wanna create a backup system(for
    offline recovery),so we backup the XI product system throught entiry system save in AS/400(we stopped the XI system before
    save process start).And following,we restored from the tape that we save from XI product system to the new backup system(they
    are whole different paratition),but the problem is coming.Describe as following item:
    1. The application seem to can be started but the java node always restart circularly(We have 4 java node now),I think
    because of different of hardware configure(between XI product and Backup system) and lack of hardware resource.(XI prduction
    have 5 CPUs and 22G Mem,Backup system have 2 CPUs and 16G MEM ).Therefore we wanna decrease the number of java nodes for
    start application in backup system(throught configtool).
    2. We wanna use configtool to decrease the java nodes for start backup system.But we encountered a problem during running the
    configtool ,the information of prompt dialog as following:
    Error occurred while working with Configuration (Scanning).
    Msg:Error while connecting to DB.
    We also see the system.log that below the directory of usr\sap\PXI\DVEBMGS00\j2ee\configtool,and found some error as
    following text:
    #1.5#C0000A0008A8000000000000017A906E000423BFFC7246E0#1165207387826#/System/Configuration/Logging##com.sap.tc.logging.APILogg
    er.LogController[addLog()]#######Thread[main,5,main]##0#0#Info##Java#TC_LOGGING_CONFIGURATION_NEW_ITEMS
    [C0000A305666000000000002018FB1F70003D67C779ECE88]##The () has been added to the !#3#Log#.
    system.log#/System#
    #1.5#C0000A0008A8000000000001017A906E000423BFFC73A670#1165207388006#/System/Server##com.sap.engine.core.configuration#######T
    hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
    Z:
    sapmnt
    PXI
    global
    security
    lib
    tools
    iaik_jce_export.jar#
    #1.5#C0000A0008A8000000000002017A906E000423BFFC73CD80#1165207388016#/System/Server##com.sap.engine.core.configuration#######T
    hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
    Z:
    sapmnt
    PXI
    global
    security
    lib
    tools
    iaik_jsse.jar#
    #1.5#C0000A0008A8000000000003017A906E000423BFFC73CD80#1165207388016#/System/Server##com.sap.engine.core.configuration#######T
    hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
    Z:
    sapmnt
    PXI
    global
    security
    lib
    tools
    iaik_smime.jar#
    #1.5#C0000A0008A8000000000004017A906E000423BFFC73CD80#1165207388016#/System/Server##com.sap.engine.core.configuration#######T
    hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
    Z:
    sapmnt
    PXI
    global
    security
    lib
    tools
    iaik_ssl.jar#
    #1.5#C0000A0008A8000000000005017A906E000423BFFC73CD80#1165207388016#/System/Server##com.sap.engine.core.configuration#######T
    hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###ConfigurationManager: found jar for secure store
    Z:
    sapmnt
    PXI
    global
    security
    lib
    tools
    w3c_http.jar#
    #1.5#C0000A0008A8000000000006017A906E000423BFFC9C25A0#1165207390660#/System/Configuration/Logging##com.sap.tc.logging.APILogg
    er.LogController[setResourceBundleName(String resourceBundleName)]#######Thread[main,5,main]
    ##0#0#Info##Java#TC_LOGGING_CONFIGURATION_IS_CHANGED[C0000A305666000000000000018FB1F70003D67C779CD2B8]##The for the
    has been changed from to )!#5#resource bundle
    name#LogController#com.sap.security.core.server.secstorefs.SecStoreFS#<null>#com.sap.security.core.server.secstorefs.SecStore
    FSResources#
    #1.5#C0000A0008A8000000000007017A906E000423BFFC9C4CB0#1165207390670#/System/Configuration/Logging##com.sap.tc.logging.APILogg
    er.LogController[setResourceBundleName(String resourceBundleName)]#######Thread[main,5,main]
    ##0#0#Info##Java#TC_LOGGING_CONFIGURATION_IS_CHANGED[C0000A305666000000000000018FB1F70003D67C779CD2B8]##The for the
    has been changed from to )!#5#resource bundle
    name#LogController#/System/Security/SecStoreFS#<null>#com.sap.security.core.server.secstorefs.SecStoreFSResources#
    #1.5#C0000A0008A8000000000008017A906E000423BFFCAC7D38#1165207391731#/System/Server##com.sap.engine.core.configuration#######T
    hread[main,5,main]##0#0#Info#1#com.sap.engine.core.configuration#Plain###OpenSQLDataSource successfully created with secure
    store.#
    #1.5#C0000A0008A8000000000009017A906E000423BFFCDA3070#1165207394726#/System/Configuration/Logging##com.sap.tc.logging.APILogg
    er.LogController[setResourceBundleName(String resourceBundleName)]#######Thread[main,5,main]
    ##0#0#Info##Java#TC_LOGGING_CONFIGURATION_IS_CHANGED[C0000A305666000000000000018FB1F70003D67C779CD2B8]##The for the
    has been changed from to )!#5#resource bundle
    name#LogController#/System/Database/sql/jdbc#<null>#com.sap.sql.log.OpenSQLResourceBundle#
    #1.5#C0000A0008A800000000000A017A906E000423BFFCDB41E0#1165207394796#/System/Database/sql/jdbc##com.sap.sql.jdbc.NativeConnect
    ionFactory#######Thread[main,5,main]
    ##0#0#Error#1#com.sap.sql.jdbc.NativeConnectionFactory#Java#com.sap.sql_0002#com.sap.sql.log.OpenSQLResourceBundle#SQL error
    occurred on connection : code={0,number,integer}, state="", message="".#5#-99999#08001#The application requester
    cannot establish the connection. (XIPRD)#jdbc:as400://XIPRD/SAPPXIDB;transaction isolation=read uncommitted;data
    truncation=true;date format=jis;time format=jis;sort=hex;hold input locators=true;hold statements=true;cursor
    hold=false#<null>#
    The "SQL error occurred on connection"  happened during start run configtool.
    We don't know how to solve this problem.
    Thanks

    I am unable to start my configtool.bat to administer JVM memory settings for my J2EE.
    Wait......
    Thanks

  • There is a problem with the Outlook database.  Your database could not be rebuilt. [-18000]

    For home use, I recently changed from Windows PC to MacBook Air.  I have an iPhone 4 which I synched without problem to the PC.  Since I have used Outlook for years on Windows and trusted advisors assured me Microsoft Office on the Mac is the same as Microsoft Office on Windows, I decided to continue using Microsoft Office.  Because I cannot get my Outlook calendar to sync reliably to iCal / iPhone and because I have found a small but meaningful number of features I use daily in Outlook Windows do not work on Outlook Mac, I have never been in so much pain!
    The latest problem is Outlook does not complete startup.  I get this error:
    There is a problem with the Outlook database.  To use the database, you must rebuild it using the Database Utility.
    I run the utility but it never completes successfully. 
    Step 1 of 5: Scannning...
    Step 2 of 5: Verifying...
    Step 3 of 5: Copying records to new database...
    Step 4 of 5: Recovering data...
    Your database could not be rebuilt. [-18000]
    I have found many articles about this problem but they all seem to assume that you can successfully start Outlook then you rebuild the database to fix data corruption in Outlook.
    What if I Outlook never completes startup?

    Here are the steps that solved the Outlook data corruption problem.
    http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macoutlook/your-datab ase-could-not-be-rebuilt/5caff467-3ab2-464a-9fe6-00ad913b5f2e
    The question was:  Your database could not be rebuilt
    The key is to create a new Outlook Identity, remove the database file, then copy your data records into the new identity and use the Outlook database utility to rebuild the database.
    It's a wonderful feeling to see Outlook start up successfully after a few days of downtime!

  • How can i use Unix database in java?

    How can i use Unix database in Java?
    Message was edited by:
    JPro

    I have not a clue about FoxPro, but the db then is FoxPro and not Unix. The better question would be "How do I connect to FoxPro DB running on Unix with JDBC?".
    My answer to that would be, search the Internet for a JDBC driver.

  • There is a problem with the Office database - Office 2011

    Good day!
    I recently installed Office 2011 for Mac and i'm getting the following error message: There is a problem with the Office database. Excel comes up with the error message but i am able to get past the error and open the application, but it freezes when I try on Word. I have to force quit the application to close it completely.
    I've searched online and tried all the suggestions - even those from the discussion board: Problem with Office Mac 2011 database. I've completely removed traces of the software : http://support2.microsoft.com/kb/2398768 and reinstalled using the disc,  as well as followed suggestions to rebuild the database. I also installed the latest Office update: http://www.microsoft.com/en-us/download/details.aspx?id=44026 from Excel (As it was the only one I know of that's functioning after the error message) but to no avail.
    Here are the tech specs:
    OS X
    version 10.9.5
    Office 2011 for Mac
    Version 14.4.4 (140807)
    Update: 14.4.4
    Hope you guys can point me to the right direction. Any suggestions are greatly appreciated.

    Best ask question on one of the Microsoft boards.
    Could try NeoOffice.
    https://www.neooffice.org/neojava/en/index.php

  • Problem with use of COM+ Transaction and DB Transaction

    Problem with use of COM+ Transaction and DB Transaction
    We build a Web site that use sometime COM+ Transaction and sometime DB
    Transaction. If we use a COM+ Transaction and a few seconds later we try to use
    a Database Transaction (OracleConnection.BeginTransaction), we get the error
    Connection is already part of a local or a distributed transaction
    Of course the error does not produce everytime; it takes some try before we get
    the problem. And of course, if i use pooling=false on the connection string,
    the problem does not appear.
    i run the Web page
    and push the COM+ Transaction and DB Transaction one after the other for some
    times and the problem should appear.
    Environment: Windows server 2003, .Net Framework 1.1, ODP.Net 9.2.0.401,
    Database Server 9.2.0.4

    > Why in form builder can't I...
    Is this happening at runtime or at buildtime? You'll need to provide more info on what you are actually doing that's causing the problem.
    Regards,
    Robin Zimmermann
    Forms Product Management

  • Problem with making a database link.

    Hello All
    I got a problem with making a database link.
    When I execute this query
    CREATE PUBLIC DATABASE LINK DBNAME
    CONNECT TO database IDENTIFIED BY name
    USING 'DBNAME.europe.company.com';
    I am using other names because its private information
    But when I look at the table dba_db_links I see this
    OWNER | DB_LINK | USERNAME |HOST
    PUBLIC| DBNAME.europe.company.com| name| DBNAME.europe.company.com
    So the DB_Link name is changed. And this causes a problem with my asp website. I get the fault message
    ORA-02085: database link DBNAME.europe.company.com connects to DBNAME
    Cause: a database link connected to a database with a different name. The connection is rejected.
    The global_names = true and I prefer to keep it that way.
    So does anyone knows what is wrong about my Query or how I can change the DB_Link name.
    Thanks for the support,
    Remco

    Thanks for the help Mohit
    But thats whats I was doing.
    The query in the first post is the same as what you are posting.
    But by an (for me) unknown reason the database converts DBNAME to DBNAME.europe.company.com

  • I am going to buy unlocked iphone 5.. i will be going to india nxt months and will stay there for a while... so my question is will i get warrenty in india.. and will there be any problem with using indian sims..?? thnx for the help..

    i am going to buy unlocked iphone 5.. i will be going to india nxt months and will stay there for a while... so my question is will i get warrenty in india.. and will there be any problem with using indian sims..?? thnx for the help..

    The warranty for the iPhone is not and has never been International.
    Warranty and support are ONLY valid in the country of origin.  The only exception is the EU where the entire EU is treated as one country.
    If the device will be used in India, buy it in India.
    An unlocked iPhone will work on any supported GSM carrier world wide.  The LTE portion of a US purchased, unlocked iPhone is unlikely to work outside North America as it does not support the appropriate bands used in other countries.

  • I have two Iphones with different email addresses sharing one Apple ID. Will that cause problems with using messaging and FaceTime?

    I have two Iphones 5 with different email addresses sharing one Apple ID account.Both are using IOS 8.
    I would like to set up a new Apple Id for one of the phones and remove it from the old account.
    If I do that, can I move all of the purchased apps and songs to the new Apple account?
    Also, will sharing one Apple ID account with two devices cause problems with using messaging and FaceTime?

    Sharing an iCloud account between two devices can be done without causing issues with iMessage and FaceTime, just go into Settings for each of these functions and designate separate points of contact (i.e. phone number only, or phone number and unique email address).  While that works, you'll then face the problem where a phone call to one iPhone will ring both if on the same Wi-Fi network -- but again, that can be avoided by changing each phone's settings.
    Rather than do all that, don't fight it -- use separate IDs for iCloud.  You can still use a common ID for iTunes purchases (the ID for purchases and iCloud do not have to be the same) or you can use Family Sharing to share purchases from a primary Apple account.

  • Can I Design a Forum with using web dynpro for java?

    Hi All:
        Can i design a forum with using web dynpro for java?
        I want to design an application like a simple forum which maybe has many replies.So if i use
    the UI technology "web dynpro for java", i will to create UI elements dynamically.How can i control this
    dynamical UI elements to keep layout ?

    Hi,
    yes you can do that....
    for exaple if you observe SDN...
    you can imagine like....
    A big Transparent Container(TC)....
    Inside that number of other TCs(depending upon the question nd its replies...)....
    In side each TC, again around 9 UIElements....
    one for menioning what is the question/reply?
    other for your description of question/reply...
    other for your name,
    displaing your fourm point... etc...
    So it will be
    for(loop till your (Question+No of replies))
    Create Transparent Container....
    Add Childs to the Container...
    Decide your layout....
    In case if you want to know how to create UIElements dynamically....
    http://help.sap.com/saphelp_nw04/helpdata/en/4f/07cf3dd28b5610e10000000a114084/frameset.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/wdjava/dynamic%2bui%2bgeneration
    Regards,
    Srinivas.
    Regards,
    Srinivas.

  • I purchased Adobe Creative Suite C2 and have been using it for years on the same computer no problem with using it. Recently upon opening Photoshop I received a pop up window saying due to Adobe Software security we need you to activate your CS2 software.

    I purchased Adobe Creative Suite C2 and have been using it for years on the same computer without any problems with using it. Recently upon opening Photoshop I received a pop up window saying due to Adobe Software security we need you to activate your CS2 software. I tried, phone activation, web activation, nothing is working. I have the serial number and my Adobe account information. Any suggestions?

    Error: Activation Server Unavailable | CS2, Acrobat 7, Audition 3
    Mylenium

  • Problems with use cases in JDeveloper 11.1.1.1.0

    Use cases made with JDeveloper 11.1.1.0.2 can not be used and edited in JDeveloper 11.1.1.1.0.
    Same problems with Use Case Diagrams.
    And it seems to be impossible to create new use cases in JDeveloper 11.1.1.1.0.
    What are the differences between 11.1.1.0.2 and 11.1.1.1.0 if you look at use cases??

    In JDeveloper 11.1.1.0.2 each use case has one file with the folllowing name: *.xhtml_usc.
    In JDeveloper 11.1.1.1.0 each use case has two files with a names like *.xhtml_usc and *.uml_usc (after standard migration with JDeveloper). I can still edit the *.xhtml_usc files, but I have no idea what to do with the *.uml_usc files. I can only open a Property-editor, but the properties I see have no relation with the text I used in my original use cases . New use cases only have a *.uml_usc file and a Property-editor. In javadoc the new use case does not appear.
    My question is: why do I have two different use case files in JDeveloper 11.1.1.0 and how can I use the Property editor??

  • AxWindowsMediaPlayer problem with using subtitle sami.file in winform

    Hello every body
    I have a problem with using sami caption in axWindowsMediaPlayer;
    how can I use it?
    I used
    axWindowsMediaPlayer1.closedCaption.SAMIFileName="FileNameAddress";
    and
    axWindowsMediaPlayer1.ShowPropertyPages();//and select sami file
    but in both ways the subtitle is not shown in my axWindowsMediaPlayer1 control;
    please help me for solving this problem

    Hi ,
    As i know the Synchronized Accessible Media Interchange (SAMI) file must use an .smi or .sami file name extension.
    set the smi-file direclty like following
    AxWindowsMediaPlayer.closedCaption.SAMIFileName = "subtitles.smi";
    Please also refer here
    for more details.
    Follow the steps below for your Windows Media Player to display captions and subtitles.
    http://support.3playmedia.com/entries/21934486-windows-media-files-windows-media-player-settings
    Related thread, please note the Style secttion.
    http://answers.microsoft.com/en-us/windows/forum/windows_7-pictures/wmp-12-doesnt-play-sami-files-closed-captions/96fe98b7-1cdf-41f5-aa9e-a4e55fd07c0a
    In addition, Could you please provide your smi or sami file and full code? It could be better to help us do some test on my side.
    Have a nice day!
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I am having problem with using the Basic brush definition

    I am having problem with using the Basic brush definition. When I try to click on it will not allow me to use it and will automatically use the 5 pt. oval brush definition. The only way I can use the basic brush is after I have already drawn something and then I have to click on the stroke and then press basic. This is incredibly annoying and if anyone could help I would greatly appreciate it. (I have Adobe CS6)

    for whatever reason, the basic 'brush' you see in the brushes palette effectively means removing any brush from a path. to draw with the brush tool you need a brush defined. in your case the last one selected being the 5 pt oval one.

Maybe you are looking for

  • Can I use an external SSD drive as main drive?

    I would like to use an external SSD drive as my boot/operating drive.  Basically a clone of my current HD but have the option of booting to and using the external SSD drive for system and apps and data.  Is it possible and if so how?

  • PS CS6 / Bridge / ACR 8.5 - Camera RAW Cache settings reset non-stop

    Adobe Bridge/Photoshop doesn't remember the folder path in Camera RAW Cache Settings in Camera RAW Preferences window. Every time when I want to set my own folder Camera Raw Cache and its maximum size, I click OK and return to Camera RAW Preferences,

  • Can't get internet to work

    I'm trying to get a pc laptop running windows xp to connect to my airport express. The laptop sees my network and i enter the key correctly but it won't connect. I have tried everything. Even disabling all security and it still doesnt work. Please he

  • Can I covert text to columns like I can in Excel?

    If I have a numbers cell that reads:  Mr. Tom Jones; can I parse that cell so I get Mr. in one cell; Tom in another cell; and Jones in a third cell?

  • Count function on months column gives wrong result

    Hi, I am on OBIEE 11.1.1.7.150120. I used the count function on the month column and rather than getting 12 as the answer i get 365. (i used a filter on the year column to restrict it to one year) How could this happen? Any help would be appreciated.