PostgreSQL JDBC Timeout

Hello... how can i set a timeout to my PostgreSQL jdbc connections? My application cant wait the large solaris default tcp timeout....
thanks...

I tryed to use the loginTimeout propertie and it appear work fine, but when the timeout occurs he keeps locked a thread called "PostgreSQL JDBC driver connection thread" that confuses my thread counter based on ThreadGroup.... i think that this loginTimeout does not use the setSOTimeout....

Similar Messages

  • Postgresql-jdbc on Suse Linux

    Hi,
    I am writing a Java Swing application on Suse Linux and want to add Embedded SQL to it. The application should interact with a PostgreSQL database running on my local machine. The compiler complains that it cannot find the org.postgresql package included in the code. I'm guessing the problem is that the classpath is not set properly. But when I try to add the postgresql-jdbc driver to the classpath using "export CLASSPATH=$CLASSPATH:/usr/share/pgsql/pg73b1jdbc1.jar", the program stops recognizing the other Java files it uses. How do I set the classpath up properly?
    Code sample:
    import java.awt.*;
    import javax.swing*;
    import java.sql.*;
    import org.postgresql.*;
    public class MyClass
    public static void main (String [] args)
    MyFrame frame = new MyFrame();
    MyPanel panel = new MyPanel();
    // more code here
    MyClass.java:4: package org.postgresql does not exist
    import org.postgresql.*;
    ^
    1 error
    Any help is much appreciated.
    Marina.

    Hi, I figured it out - thanks to JimDinosaur's response, although to a different thread. I am posting a reply in case other people had the same question.
    So, I had two problems: first, the package wasn't recognized; second, the rest of the Java files used by the code.
    Jim suggested to use javac -classpath, listing all the directories needed, for the packages and the files. So I did, with the files directory being my current directory:
    javac -classpath /usr/share/pgsql/pg73b1jdbc1.jar:. CloningGUI.java
    Jim, you rock! :)

  • PostgreSql JDBC from Red Hat Linux works on Windows not on Linux

    I started using ODI from a Windows XP box in development and Beta, and was successfully connecting to and loading data from several different database platforms including a PostgreSql database. I copied the PostgreSql JDBC driver to the ODI drivers folder, set up the connection information and it worked. When I moved from Windows XP to "Red Hat Enterprise Linux AS release 4 (Nahant Update 6)", I could no longer connect to this PostgreSql database. I put the same driver jar file "postgresql-8.3-603.jdbc3.jar" in the drivers folder and used the same connection string. All of the other drivers (Oracle, MS SQL, etc.) in that driver folder work correctly on this Linux box. I can even tell ODI to connect to the PostgreSql through the agent on the Windows XP machine and it works. That suggests that the URL must be OK, but for some reason it can't connect from the Linux box. I also tried updating to the newest driver"postgresql-8.3-604.jdbc3.jar" with no success.
    Any Ideas on what I may have missed?

    I started using ODI from a Windows XP box in development and Beta, and was successfully connecting to and loading data from several different database >>>>platforms including a PostgreSql database. I copied the PostgreSql JDBC driver to the ODI drivers folder, set up the connection information and it worked.
    When I moved from Windows XP to "Red Hat Enterprise Linux AS release 4 (Nahant Update 6)", I could no longer connect to this PostgreSql database. I >>>>put the same driver jar file "postgresql-8.3-603.jdbc3.jar" in the drivers folder and used the same connection string.
    All of the other drivers (Oracle, MS SQL, etc.) in that driver folder work correctly on this Linux box. I can even tell ODI to connect to the PostgreSql through >>>>the agent on the Windows XP machine and it works.
    That suggests that the URL must be OK, but for some reason it can't connect from the Linux box. I also tried updating to the newest driver
    "postgresql-8.3-604.jdbc3.jar" with no success.
    Any Ideas on what I may have missed?Hi,
    I'm having a problem in connecting to a PostGreSQL database, I was just wondering how you did it? I'm using a Windows Server 2003 R2 Standard Edition.
    Thanks,
    Randy

  • JDBC Timeout

    Hi,
    We are using a JDBC connection to Oracle for some reports we migrated from 3.1 to 4.0.  All reports under about 20 minutes work fine, but when you hit the 20 minute mark, the report errors out.  We had a similar issue in 3.1 that we fixed by adding a -RequestTimeout X (where X is milliseconds - 3600000 in our case) in the Crystal Job Server command line switch.  (in addition to changing the timeout in CRConfig.xml)  The Crystal Job Server doesn't seem to exist in 4.0, and adding it to the Adaptive Job Server command line doesn't work (the AJS ends up in failure status).  Anyone know how to get similar behaviour to the -RequestTimeout in version 3.1?

    Hi Jin-Chong,
    We have that value set to 10800 which I believe is 3 hours.  We also set the timeout up top from 10 to 180, and upped the JVM Heap sizes.
    <?xml version="1.0" encoding="utf-8"?><CrystalReportEngine-configuration>
        <timeout>180</timeout>
    <IORFileLocation>${TEMP}</IORFileLocation>
    <JavaServerTimeout>10800</JavaServerTimeout>
    <JavaServerStartupTimeout>30</JavaServerStartupTimeout>
    <JVMMaxHeap>512000000</JVMMaxHeap>
    <JVMMinHeap>64000000</JVMMinHeap>
    No luck with that though.  Still waiting from a response from SAP also, I think they will call me today.
    I did some searching,  and I don't know if its related, but there is a timeout in the following file (on linux)
    .../webapps/BOE/WEB-INF/eclipse/plugins/webpath.CrystalReports/web/WEB-INF/web.xml
        <!-- Define the default session timeout for your application,
            in minutes.  From a servlet or JSP page, you can modify
            the timeout for a particular session dynamically by using
            HttpSession.getMaxInactiveInterval().
        -->
        <session-config>
          <session-timeout>20</session-timeout>    <!-- 20 minutes for session objects -->
        </session-config>
    Regards,
    Sabir

  • Installing Postgresql JDBC Driver WLS 8.1

    Hi,
    Can somebody explain how I install the JDBC Driver for postgresql? I have WLS
    8.1.2 on Win XP. I think the solution would be to set the CLASSPATH to the appropriate
    location. But how do I do this permanently?
    Thanks,
    Oliver

    Oliver wrote:
    Hi,
    Can somebody explain how I install the JDBC Driver for postgresql? I have WLS
    8.1.2 on Win XP. I think the solution would be to set the CLASSPATH to the appropriate
    location. But how do I do this permanently?
    Thanks,
    OliverHi. Read the startWeblogic script to see how it constructs the -classpath argument for
    the weblogic JVM. You can either add the postgres classes to an environment variable
    PRE_CLASSPATH, or edit the startup script etc.
    Joe

  • Synchronous JDBC Timeout

    Hi Experts, I have a synchronous proxy-jdbc with SQL_QUERY (Select) as action. When the query is executed directly in the DB, it's only taking 3-4 minutes to get the results. But when it's run thru PI, we always encounter synchronous timeout exceeded error (20 minutes). Since the query is getting results on time in the DB, I'm thinking the problem could be in PI side but I'm running out of options to check. Has anyone faced this problem before? Any inputs will be greatly appreciated. Thanks!

    Hi Mark,
    It looks like a network problem. Can you ping the database hostname in your PI system (create ping command in SM69)? Also take a look at this note: Note 1085539 - XI JDBC/FTP connection Test and XML Validation Application
    Hope this helps,
    Mark

  • BLOB support in standard postgresql jdbc driver - OutOfMemoryError

    Hi all,
    I have a problem with PostgreSQL and BLOBs.
    Small BLOBs work, but with BLOBs of a certain size my code throws a java.lang.OutOfMemoryError.
    The file I tried has about 2-3 MB.
    Environment:
    - PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.96
    - Mandrake 8.2
    - 192 MB RAM
    - blob column created as datatype "bytea" (maybe that is the problem)
    - code posted below (BlobPostgresTest.java)
    - console output posted below
    - java command to run program:
        java -verbose:gc -Xmx128m -classpath .:pgjdbc2.jar BlobPostgresTest- java version as follows from "java -version" command:
        java version "1.4.0_01"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
        Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)do you have an idea how to solve this problem ?
    Console output (including GC activities):
    =========================================
    java -verbose:gc -Xmx128m -classpath .:pgjdbc2.jar BlobPostgresTest
    BLOB/PostgreSQL Demo started
    [GC 511K->230K(1984K), 0.0163708 secs]
    preparing statement
    setting binary stream
    [GC 402K->273K(1984K), 0.0092325 secs]
    [Full GC 273K->273K(1984K), 0.0771294 secs]
    [GC 4351K->4058K(4908K), 0.0046329 secs]
    [Full GC 4058K->3770K(4908K), 0.0831070 secs]
    [GC 4922K->4922K(6860K), 0.0009556 secs]
    [Full GC 4922K->4346K(6860K), 0.0890570 secs]
    [GC 6650K->6650K(7820K), 0.0011110 secs]
    [Full GC 6650K->5496K(7820K), 0.1420860 secs]
    [GC 10104K->10104K(14480K), 0.0012827 secs]
    [Full GC 10104K->7800K(14480K), 0.1236744 secs]
    [GC 17016K->17016K(24084K), 0.0015421 secs]
    [Full GC 17016K->12408K(24084K), 0.1688843 secs]
    [GC 30840K->30840K(43224K), 0.0020800 secs]
    [Full GC 30840K->21624K(43224K), 0.2547274 secs]
    [GC 76920K->74616K(81500K), 0.0041685 secs]
    [Full GC 74616K->49272K(81500K), 0.5688448 secs]
    [GC 67704K->67704K(88332K), 0.0033407 secs]
    [Full GC 67704K->58488K(88332K), 0.2558231 secs]
    executing update
    [GC 95352K->95352K(104844K), 0.0932741 secs]
    [Full GC 95352K->40056K(104844K), 0.9644251 secs]
    [GC 69245K->69245K(104844K), 0.0036631 secs]
    [Full GC 69245K->69245K(104844K), 0.0814962 secs]
    [Full GC 69245K->66324K(129728K), 1.1439123 secs]
    Exception in thread "main" java.lang.OutOfMemoryError
    BlobPostgresTest.java
    =====================
    import java.sql.*;
    import java.io.*;
    drop table blobdemo;
    drop sequence blobdemo_id_seq;
    create table blobdemo(
      id serial not null primary key,
      name varchar(50),
      content bytea);
    public final class BlobPostgresTest {
        private final static String NAME = "TEST";
        //private final static String FILE_NAME = "/tmp/blob/2mb.xxx";
        private final static String FILE_NAME = "BlobPostgresTest.java";
        public final static void main(String[] args) throws Throwable {
         Connection con = null;
         Statement statement = null;
         PreparedStatement insertStatement = null;
         ResultSet rs = null;
         File file = null;
         FileInputStream fis = null;
         BufferedInputStream bis = null;
         try {
             System.out.println("BLOB/PostgreSQL Demo started");
             Class.forName("org.postgresql.Driver");
             con = DriverManager.getConnection
              ("jdbc:postgresql://localhost/template1",
               "postgres", "");
             con.setAutoCommit(true);
             statement = con.createStatement();
             // cleanup
             statement.executeUpdate("delete from blobdemo");
             // file
             file = new File(FILE_NAME);
             fis = new FileInputStream(file);
             bis = new BufferedInputStream(fis);
             // insert one record
             System.out.println("preparing statement");
             insertStatement = con.prepareStatement
              ("insert into blobdemo ( name, content ) values ( ?, ? )");
             insertStatement.setString(1, NAME);
             System.out.println("setting binary stream");
             insertStatement.setBinaryStream(2, bis, (int)file.length());
             System.out.println("executing update");
             insertStatement.executeUpdate();
             // retrieve
             rs = statement.executeQuery
              ("select id, name, content from blobdemo");
             while(rs.next()) {
              System.out.println("id=" + rs.getObject(1));
              System.out.println("name=" + rs.getObject(2));
              byte[] bytes = rs.getBytes(3);
              String content = new String(bytes);
              //System.out.println(content);
              System.out.println("retrieved " + bytes.length +  " bytes");
         } finally {
             if(rs != null) rs.close();
             if(statement != null) statement.close();
             if(insertStatement != null) insertStatement.close();
             if(con != null) con.close();
             if(fis != null) fis.close();
             if(bis != null) bis.close();
         System.out.println("BLOB/PostgreSQL Demo complete");
    }

    FYI: I'm in contact with the postgres team to work on the problem. it is caused by the way blobs are implemented in the jdbc driver.
    http://archives.postgresql.org/pgsql-jdbc/2002-08/msg00096.php

  • Postgresql,jdbc PLEASE HELP

    hi
    I have downloaded and installed and built ant, but i don't know how to continue, please help

    try here: http://jdbc.postgresql.org/doc.html

  • HAVE POSTGRESQL JDBC 2.0 ??? HELPPPPPPPPPPP

    i am using jdbc7.0-1.2.jar
    this jdbc driver implements the jdbc 2.0 api ????
    when i run this code above a \n error ocurrs
    SQLEXCEPTION: this method is not yet implemented
    here is the code:
    stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    Content[] aContent = new Content[iRows];
    rs.absolute(1);
    while (rs.next()) {
    aContent[i] = new Content(rs.getInt(1), rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getString(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getInt(10),rs.getInt(11));      i++;
    }

    i found where the error but i can't solve this ....
    i changed the line above
    stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    and it still having problem
    im using java 1.4 and its features is since the 1.2 ... i am using jakarta
    4.0 ....
    whats is the problem ????? i cant understand ....

  • PostgreSQL & JDBC - ClassNotFoundException

    I'm trying to get my servlet to play nicely with postgresql, but I keep getting a ClassNotFoundException at compile time. I have added only one line (Class.forName("org.postgresql.Driver");) to a previously working servlet - it should initialize the driver as per the postgresql documentation, but it keeps throwing this error.
    I recognize that this should have to do with the classpath, but I've tried many different configurations and it's still broken. $CLASSPATH currently looks like this:
    :/usr/local/tomcat/webapps/test/WEB-INF/servlet-api.jar:/usr/local/tomcat/webapps/test/WEB-INF/postgresql-8.1-405.jdbc3.jar:/usr/local/tomcat/webapps/test/WEB-INF/classes/i looked into that postgresql-8.1-405.jdbc3.jar file, and the org.postgresql.Driver is present. running simply "java org.postgresql.Driver" successfully finds the class. I've tried setting the classpath at the command line when running javac too, and i still get the same error. I'm out of ideas!
    Below is (the relevant part of) my code. Any help is most appreciated!
    package mypackage;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.util.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.sql.*;
    public final class Map extends HttpServlet {
       List<Location> aList = new ArrayList<Location>(2);
       Location a = new Location("Apartment #1","Residence"," West 4th St", -74.001634, 40.732889);
       Location b = new Location("Apartment #2","Residence","Bank St", -74.003161, 40.737430);
       public void doGet(HttpServletRequest request,
                          HttpServletResponse response)
          throws IOException, ServletException {
             aList.add(0, a);
             aList.add(1, b);
         Class.forName("org.postgresql.Driver");
         response.setContentType("text/html");
         PrintWriter writer = response.getWriter();
         writer.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"");
    //And it goes on for a while like that, then ends with...
    }

    I'm trying to get my servlet to play nicely with
    postgresql, but I keep getting a
    ClassNotFoundException at compile time. "at compile time" - now I see.
    Putting the JAR file in the WEB-INF/lib of your app or Tomcat's common/lib only affects runtime behavior. At compile time you have to tell the compiler where to find what you need.
    The Class.forName() call doesn't actually cause the PostgreSQL driver class to be loaded - that's runtime behavior. The compiler was complaining about the lack of the try/catch block.
    The thing is that javac.exe doesn't give a hoot about your system CLASSPATH. Use the -classpath option to add paths to classes and JAR files that you need.
    I kept thinking that you were having a runtime problem.
    %

  • ODI Proc to loop / call scenario launches twice - jdbc timeout?

    Fellow Gurus,
    Bit of a funny one - I have an ODI Proc looping around a set of variables (source and target table names) to dynamically call an interface to builk shift a set of data. The Sync Mode = 1 as I want to run it in Serial so I dont get a clash of C$ / I$ tables , however I have a weird behaviour where in some cases, a duplicate session is launced (when the sub-scenario runs for longer than 5 mins) - with the same variable values as the last session (there are no dupes in my command on source).
    Is there a timeout setting for how long the Parent session waits before launching again ?
    I dont want to go down the route of using WaitForChildsession if I can help it as it complicates the chain somewhat - Any other workarounds ?
    Basic set up is :
    Proc (Command on source, StartScen command on target)
    --- Calls package (declare Variable, Run Interface)
    Loop.
    Thanks
    Alastair

    I experienced the same behaviour in one of my scenarios recently - multiple sessions spawning for the same scenario without any apparent reason. It was caused by a timeout on the agent host server and increasing the timeout value resolved it in my case.
    My setup was 2 agent Linux servers (JavaEE), load balanced.
    Edited by: _Phil on Jan 16, 2013 3:44 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • SAP BI 4.0 SP2 on Linux and Postgresql Datasource via JDBC drivers

    Hi,
    I installed SAP BI Platform 4.0 SP2 on Redhat 5.2 and i try to access as a universe datasource a postgresql database (v8.4). But i don't know how to configure the postgresql JDBC driver on linux server.
    does anyone have a step by step procedure to configure this JDBC postgresql driver on linux ?
    I download this driver : http://jdbc.postgresql.org/download/postgresql-8.4-703.jdbc3.jar
    I read the SAP Data Access document for SAP BI 4.0 SP2 about JDBC connexions, they talk about a SBO file located in $ROOT_DIR/sap_bobj/enterprise_xi40/dataAccess/connectionServer/jdbc , but there isn't any SBO file for postgresql database ?
    Thanks in advance
    JP
    Edited by: Jean-Philippe ARNALOT on Oct 6, 2011 6:58 PM

    Hi
    I found a solution alone, this note 1347514 helps me :
    My conf : Redhat 5.2 + SAP BI 4.0 SP2 + postgresql 8.4 datasource + jdbc drivers
    My solution :
    1) Download JDBC drivers on client side (http://jdbc.postgresql.org/download/postgresql-8.4-703.jdbc3.jar)
    2) Create and export a JDBC connexion for postgresql8
    3) Create and export a universe using this connexion (test a query in universe design tool tools/Querybuilder)
    4) install JDBC drivers on server side, i copied the jar file in this location : $ROOT_DIR/sap_bobj/enterprise_xi40/dataAccess/connectionServer/drivers/java/postgresql-8.4-703.jdbc3.jar
    5) Set your classpath in your .profile : CLASSPATH=$CLASSPATH:/export/logiciels/tes-boxi/sap_bobj/enterprise_xi40/dataAccess/connectionServer/drivers/java/postgresql-8.4-703.jdbc3.jar; export CLASSPATH
    6) Source your .profile
    7) Restart servers (i think restarting only webi server would be ok)
    8) Open BI LaunchPad, start Webi and execute a query on postgresql universe
    It Works with my configuration
    Thanks for your help 
    JP

  • Set Timeout in TopLink JPA

    Hi
    I am using a standalone JPA application with Toplink
    I need to implement a timeout feature
    But I do not find any options for setting the timeout in any of
    javax.persistence.EntityManager;
    javax.persistence.Query etc
    nor do i find any property that I can add in the persistence.xml
    My persistence.xml is as below
    <persistence-unit name="CHN" transaction-type="RESOURCE_LOCAL">
    <provider>
         oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
    </provider>
    <class>com.TestJPA</class>          
    <properties>
         <property name="toplink.jdbc.driver"
    value="oracle.jdbc.driver.OracleDriver" />
         <property name="toplink.jdbc.url"
         value="jdbc:oracle:thin:@localhost:1521:XE" />
         <property name="toplink.jdbc.user" value="JEN" />
         <property name="toplink.jdbc.password" value="JEN" />
    </properties>
    </persistence-unit>
    Thanks
    lad

    Unfortunately, the eclipselink.jdbc.timeout hint is only in EclipseLink. If you are using TopLink Essentials, the only query hints available are in the oracle.toplink.essentials.config.TopLinkQueryHints class and does not include the jdbc timeout. If you cannot upgrade/migrate to EclipseLink, you can set it directly using the DatabaseQuery.setQueryTimeout() method. You will need to cast the EJBQuery and get the underlying TLE query:
    ((oracle.toplink.essentials.ejb.cmp3.EJBQuery)jpaQuery).getDatabaseQuery().setQueryTimeout(yourIntValue);
    jpaQuery.getResultList();
    Best Regards,
    Chris

  • Impossible to detect an AUTO_INCREMENT column in a table of PostgreSQL DB.

    Hello,
    I need to detect an AUTO_INCREMENT column in a table of PostgreSQL DB.
    Note : PostgreSQL uses sequence number to create an AUTO_INCREMENT column.
    From a ResultSetMetaData, I call the methode isAutoIncrement(int index) which returns true if the column index is AUTO_INCREMENT.
    But it doesnt work.
    It seems that this methode is not implemented in postgreSql JDBC driver.
    Any idea about that?
    Thank for your attention.
    Sopheap

    Is it true that nobody knows how to detect an AUTO_INCREMENT column in a table of PostgreSQL DB?
    Sopheap

  • Whether postgresql-8.2-506.jdbc4 works in a 64 bit operating system?

    Whether **postgresql-8.2-506.jdbc4** works in a 64 bit operating system?
    Especially I would like to know whether it works in windows server 2008 64 bit operating system.

    masijade. wrote:
    :sigh:
    IOW, Go to a PostGreSQL site and ask there!
    The Driver is produced by them, they should know. I don't believe it would be a problem, but all you can do is try it.Agreed.
    The postgresql JDBC driver is a type 4 driver and therefor a pure Java implementation without JNI dependencies. That should work without problems on a 64 bit system.

Maybe you are looking for

  • CSS positioning problem in IE 6 and earlier only

    Hello Forum Amigos, This page has a problem in IE 6 which I cannot figure out. Any help would be much appreciated! http://fuentek.com/sites/GRC/index.html If you look at the page with any newer browser, the section with the heading "What We Offer" -

  • Problem with archiving print lists

    Hi all, we have an issue with asynchronous archive requests. The archiving of some spool lists fails. Here the error message in OAM1: Order History 12.03.2010 19:36:10     Request Created 12.03.2010 19:36:10     Asynchronous request started; awaiting

  • Agentry Server Communications error (14)

    Hi All, We are trying to use WPF client for testing the application, but we were getting the below error message To resolve that we used the local certificate generated by using steps mentioned in the below link    http://infocenter.sybase.com/help/t

  • Callable Object Type as Web Page

    Hi, I am trying to create a GP programatically.  I want to use the CO tyoe as web page, but I am not able to understand how to set the URL for the CO. Here is my code:      IGPCallableObjectTypeManager coTypeManager =  GPCallableObjectTypeFactory.get

  • Exchange portlet suite automation

    We're using v3.1 of the Exchange Portlet Suite, on our ALUI G6 SP1 environment. It works OK when the user goes into their user preferences and sets up: userid password mailbox mail server login domain I want to automate this login process, by passing