How to make the java.sql.Datasource.setLoginTimeout method work

I have an EJB that gets a database connection. At the moment, if it can't get a connection, it waits there for 3 minutes, which is unacceptable. I would like to throw an exception or somehow limit the timeout period. When I found this setLoginTimeout method I thought my troubles were over. But no matter what I set it to, it still blocks and waits about 3 minutes.
I have tried this with MSSQL7 databases, and Sybase databases, using all the inet drivers available and also jConn52 driver (for Sybase). But with no luck (despite inet saying Opta supports this method)
Is it that no drivers yet support this method? If so, could you point me in the direction of some drivers (MSSQL7 and Sybase Server ) that support this method? Otherwise, could someone tell me what I'm doing wrong? Thanks.
This is my code, to try to make it timeout in 30 seconds.
javax.naming.InitialContext ic = new javax.naming.InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)ic.lookup(myDatasourceName);
ds.setLoginTimeout(30);
java.sql.Conection newConn newConn = ds.getConnection();
Thank you for your help.

Hi,
I am using Oracle classes12.jar driver to connect to DB. When i use DriverManager.setLoginTimeout(1). But it is not getting timed out. Why?

Similar Messages

  • How to make The Java Screen Recorder similar to this one?

    Can u talk about this how can make this code with java?
    http://www.devharbor.com/java/300-Screen-Recorder.html
    The author of this application says this maked by Java Swing.
    My Question is:
    What is Java Swing?
    It's easy to make this app?
    What API/Component needed for export video to MP4 Format like this application?
    How can make a similar application for education purpose with Java.
    Thanks

    808154 wrote:
    :) Thank you for answering my question,
    but impossible in nothing bro, Yea, that's what Aleksey Vayner claimed and he didn't do so well.
    I need to know about swing and start to work with java to develop this software and if I need some help I ask here.Clearly yes. You also need to make simple programs and practice for a long time before you're gonna be able to write a screen recorder with MP4 output.
    I try to develop this before 3-4 years ;)I guess 3-4 years is a realistic goal, if you really concentrate on learning Java.

  • How to resolve the java.sql.SQLException: OALL8 is in an inconsistent state

    Hi All,
    I am getting the SQLException "java.sql.SQLException: OALL8 is in an inconsistent state." and in finally block while I am trying to execute another operation on the same database getting another exception "java.sql.SQLException: Io exception: Broken pipe".
    I am using a connection from the connection pool configured in Oracle Application server. I am using the Oracle App server 10.1.3.4 and my database is Oracle Database 11g Enterprise Edition Release 11.1.0.7.0.
    Any help in resolving this issue would really be appreciated.
    Thank you.

    Hi,
    What version of the driver are you using? The "OALL8 is in an inconsistent state" exception usually indicates a problem in the protocol. When this exception occurs the protocol is broken and the connection can't be used anymore. I would suggest that you try using the 11.2.0.1 JDBC driver that you can download from:
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
    Regards,
    Jean

  • How to make the java files compile for a project created outside of Eclipse

    Hi^^,
    I have created a project outside of Eclipse. It has the following folders
    1. config
    2. source
    3. WEB-INF
    I want to execute the project on remote server. Will it compile automatically creating a new folder for .class files corresponding to the source folder or do i need to include a build.xml to enable the project to create a new folder for .class files. Also pls tell me how do I write this build.xml
    Please advise.

    Hi^^,
    Actually I have created a project without using eclipse.
    My source files are inside WEB-INF/source
    Now I want to compile the files using build.xml so that I can create class files. I am using the following build.xml
    <project name="jsp" default="all" basedir="./">
      <property environment="env"/>
      <property file="ArmorJSP.properties"/>
      <!-- set global properties for this build -->
      <property name="source" value="."/>
      <target name="all" depends="copy, jspc, testservlet"/>
      <!-- Creates jsp_servlet directory under WEB-INF\classes of the Examples Web
        APP and places the compiled jsp classes into it -->
      <target name="jspc">
        <!-- Run ejbc to create the deployable jar file -->
        <java classname="weblogic.jspc" fork="yes">
          <arg line="-webapp ${APPLICATION_HOME} -compileAll -d ${APPLICATION_WEB_CLASSES} ${source}/*.jsp"/>
          <classpath>
            <pathelement path="${WL_HOME}/lib/weblogic_sp.jar;${WL_HOME}/lib/weblogic.jar;${ARMOR_HOME}/ARMORSecurity.jar;${ARMOR_HOME}/ARMORUtil.jar"/>
          </classpath>
        </java>
      </target>
      <!-- Creates jsp_servlet directory under WEB-INF\classes of the Examples Web
        APP and places the compiled Servlets classes into it -->
      <target name="testservlet">
        <!-- Run ejbc to create the deployable jar file -->
        <javac destdir="${APPLICATION_WEB_CLASSES}" srcdir="${source}" includes="*.java">
          <classpath>
            <pathelement path="${WL_HOME}/lib/weblogic_sp.jar;${WL_HOME}/lib/weblogic.jar;${ARMOR_HOME}/ARMORSecurity.jar;${ARMOR_HOME}/ARMORUtil.jar"/>
          </classpath>
        </javac>
      </target>
      <target name="copy">
        <copy todir="${APPLICATION_HOME}">
          <fileset dir="${source}">
            <include name="*.jsp"/>
          </fileset>
        </copy>
      </target>
    </project>I do not know how to compile the project using this build.xml
    The motive of doing all this is to understand how is Eclipse doing the build project step. I simply cannot find any build.xml inside any of my projects created in Eclipse however when right click on the project and choose build project, it compiles excellently. ???
    Edited by: pksingh79 on Nov 24, 2008 1:19 PM

  • How to make the buggy DR8-A HD Burn work?

    My HD Burn simply don't work. I have change to another new drive from
    the shop that I bought the DR8-A, but still the same!!!  
    It is always the error - power calibration error when I am burning a 700MB
    with HD burn (tried SmartBuy, Sony and Imation, all cannot work)
    I done testing with the Nero provided and latest Nero 6.3.0.3.
    Actually I fancy this drive over TDK AID 880NA because of HD-Burn!
    Can someone please share how to burn with HD-Burn? Any special medium?
    MSI, can you please do something? Reply us with a FAQ or something helpful?
    I think this is the worse MSI product that I have bought.  
    I used to be a fan of MSI, my whole PC consists of MSI parts.
    Now my impression of MSI products changed big time.
    How to make this HD Burn work?! Anyone got any comment or information?
    Please share???  

    I have the MSI DVD DR-8A and i've already burnt over a dozen HD-burn CDs without any problem  
    My only road block was to find how to use it with nero (it is presented as a different type of disk), but after i read nero doc and chose the right option, it has been flying. I'll report on my media later (i dont have them here).
    Edit: I've used
     - FujiFilm CDR 80minutes 24x
     - Memorex CDR 80 mins 48x
    No problem with either, burnt at the maximum 24x HD burn speed.
    My only gripe with HD burn is that it does not allow any overburning. Not a bit over the 1400Meg limit. not a big problem, though.
    Also, be cautious on WHAT you burn. CD are not a very good archival method. They can degrade quite fast and i would bet that HD-burn, being more precise, is more sensitive to those degradations too.

  • How to make the Java Logging to create the log file

    Hey,
    I need some help. Below is my code that create a log file for my application however, there is no log file being created when i perform a MarsLogger.log.info("test") in my code for my application.
    * LogManager.java
    * Created on April 10, 2006, 11:42 AM
    package comp1.mars.beans.ejb.util;
    import java.util.logging.*;
    import java.io.*;
    public class LogManager {
    /** Creates a new instance of LogManager */
    public LogManager() {
    protected static Logger getLogManager()
    //String dir = "C:/Sun03/studio5u1_se/appserver7/domains/domain1/server1/logs/an/my.log";
    String dir = "my.log";
    Logger logger = Logger.getLogger("compl1.mars.bean.ejb");
    try {
    // Create an appending file handler
    boolean append = true;
    FileHandler handler = new FileHandler(dir, append);
    //FileHandler(String pattern, int limit, int count, boolean append)
    // Add to the desired logger
    logger = Logger.getLogger("compl1.mars.bean.ejb");
    logger.addHandler(handler);
         logger.setLevel (Level.ALL);
    } catch (IOException e)
    e.printStackTrace();
    } catch(SecurityException se)
    se.printStackTrace();
    return logger;
    }//end of method
    }//end of class
    * MarsLog.java
    * Created on April 10, 2006, 3:24 PM
    package comp1.mars.beans.ejb.util;
    import java.util.logging.*;
    * @author Administrator
    public class MarsLogger extends LogManager {
    /** Creates a new instance of MarsLog */
    public MarsLogger() {
    public static Logger log= getLogManager();
    }

    What is the level of thte handler?
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/logging/Handler.html#setLevel(java.util.logging.Level)

  • [SOLVED] How to make the volume knob on my headset work

    I have a Turtle Beach PX3.  It's a USB wireless headset.  I got the sound working and everything and I can control the volume through the XFCE mixer or the ALSA mixer but I would like to be able to use the physical knob.  On Windows 7, it just sends a signal to bump up the volume in the software mixer much like the volume controls on a keyboard would.  For the short time I used Xubuntu 12.04 it recognized that I was moving the knob (it popped up a volume bar) but it seemed to be adjusting the wrong thing because the volume didn't actually change.  On Arch, it doesn't do anything.  I'm just did a fresh install and I'm running XFCE with just straight ALSA but I wouldn't be objecting to trying out PulseAudio or something if it would help (though I've never set this up in Arch so I may need a little help).
    Last edited by weirddan455 (2012-10-09 20:07:10)

    Nevermind, got my Google-fu on and the package was xorg-xev.  It recognized when I moved the knob.
    Here's the volume raise code:
    KeyPress event, serial 38, synthetic NO, window 0x1600001,
    root 0xc6, subw 0x0, time 8056414, (56,97), root:(540,575),
    state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False
    And the volume lower:
    KeyRelease event, serial 38, synthetic NO, window 0x1600001,
    root 0xc6, subw 0x0, time 8054284, (56,97), root:(540,575),
    state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False
    Last edited by weirddan455 (2012-10-09 13:45:12)

  • How to make the Send To function from InfoView work for Email etc?

    Dear Colleagues,
    Which plugin is missing for sending by email? When I choose Send To > Email I get the following message:
    The destination plugin required for this action is disabled. If you require this functionality, please contact your system administrator.  The same goes for FTP Location and File Location as well.
    Hope someone can help!
    Regards Silje
    Edited by: Silje Mari Sunde on Aug 26, 2009 12:25 PM

    Hi,
    BO Administrator has to give access for you for sending a report to mail / other users. If you have admin access then goto CMC -> Servers ->  Click on Properties of Adaptive Job Server -> Click on Destination -> Add all your destination (Email,FTP etc.)
    -> enter Configuration details for email etc else send a mail to your admin if possible with screen shot for the access.
    Cheers,
    Suresh Aluri.
    Edited by: Suresh Babu Aluri on Aug 26, 2009 6:31 PM

  • How to make a Java application that will change the client box's IP address

    HI how to make a Java application( that application would be run on the client ) that will change the client box's IP address ( IP address of itself )

    If you can do that through the command line, then use Runtime.getRuntime().exec(...) to execute your command.

  • How to copy the java concurren program in oracle application

    Hi All
    I am working in oracle Apps R12.
    In AP (Account Analysis Report) is registered as java concurrent Program.
    Now i need to customize this concurrent program and add two new column and two parameter in that.
    Could any one pls provide me the steps that how to copy the Java concurrent,and make a new customized program.
    Whether copying a java concurrent program is same as cp registered as oracle report.
    Thanks & Regards
    Srikkanth

    Hi Sir,
    Thanks for your reply.
    I have find the xml file form data definition and in that they have written Sql query and they have called a Package.
    And the i have also taken the class file from the path as mentioned.
    Now i need to customize this report by adding two parameter and i need to add two new column to display in the rtf.
    Can you pls tell me the steps to copy or how to customize this report.
    Regards
    Srikkanth

  • How to make a Java program that recognises a function of two variables...

    How to make a Java program that recognises a function of two variables to assign values to that?
    First I will give an example and then do the question.
    Ex1.
    We have any function, eg.y = x ^ 2 + 1 (read 'y' equals 'x' high to the square), a function of the second degree.
    To build the graph of this function attach values to 'x' to find the values of 'y'
    And thus mount the pair ordered (x, y) which represents a point on the Cartesian plane.
    Assigning values to 'x' 'we can build up a table that gives us the pairs ordered:
    We can use any numbers, but arfer interval [-3.3]
    X | y = x ^ 2 + 1
    -3 | Y = (-3) ^ 2 +1 = 10
    -2 | Y = (-2) ^ 2 +1 = 5
    -1 | Y = (-1) ^ 2 +1 = 2
    0 | y = (0) ^ 2 +1 = 1
    1 | y = (1) ^ 2 +1 = 2
    2 | y = (2) ^ 2 +1 = 5
    3 | y = (3) ^ 2 +1 = 10
    We then ordered the pairs:
    (-3.10), (-2.5); (-1.2), (0,1), (1,2), (2,5), (3,10)
    Tabem that can be represented by a table:
    X | y
    -3 | Y = 10
    -2 | Y = 5
    -1 | Y = 2
    0 | y = 1
    1 | y = 2
    2 | y = 5
    3 | y = 10
    Now I begin to explain my doubts.
    See this program:
    Ex2
    * To change this template, choose Tools | Templates
    * And open the template in the editor.
    Encontrando_o_valor_de_y package;
    * @ Author des Soldat Gottes
    Import javax.swing.JOptionPane;
    Public class (Main
    * @ Param args the command line arguments
    Public static void main (String [] args) (
    Int x, y;
    String x1;
    X1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',"); / / receives a value for the function y = x + 1
    X = Integer.parseInt (x1); / / tranforma String in int
    Y = x + 1; / / receives the value of 'x' and calculates' y '
    JOptionPane.showMessageDialog (null, "The value of 'y' is: \ t \ t" + y);
    / / Displays the value of 'y'
    System.exit (0);
    We see that the program receives above a value for 'x' and replaces the function contained in the program, y = x + 1, and so is the value of the variable 'y'.
    In: x1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',");
    The entry is a number and that number is assigned aa ja existing function in the (y = x + 1).
    The question is: would it be possible to come to a function?
    Ex: the program ask: DIGITE THE FUNCTION?
    The USUARIO DIGITARIA A FUNCTION ANY, TYPE: y = x ^ 2 +1
    The program would recognize the function and give numerical values to that function as Ex1, at the beginning of this text.
    And then to find the values of the x and y launch a table.
    It would be possible that?
    By invez of entering with a number so that the program sustitua a function ja existing as Ex2, seen above, entering with a function quaquer (type: y = x ^ 2 +1) for the program atribuisse values to that function and then create a table of values as Ex1.
    I hope it has been easier to understand my doubts now.
    Thank you for your attention!
    God bless!

    rafaelmenezes wrote:
    Thanks for the explanation, could understand what fly said.
    But as it applied to a program?
    How to create a program that recognizes that the entry coefficients?Are you asking about how to parse out the coefficients from the string "3x^4 + 4x^3 - 8x^2 + 5x^1 + 2x^0"? If you define the format to strictly follow that example, this should get you started:
    Strip out the spaces
    Split the String on "x^"
    That should give you [3, 4+4, 3-8, 2+5, 1+2, 0]
    Split each resulting String on "+ | -", preserving the operator as a token so you can apply the correct sign to the coeff.
    That should leave you with [3, 4, +, 4, 3, -, 8, 2, +, 5, 1, +, 2, 0]. Every other number is a coeff, the rest are the degrees.
    You can strip out the +, since those coeffs are already positive, and strip out the - after negating the following number. This is all assuming that you have to write this yourself. There is no doubt already a library or 5 out there that does this for you.

  • How to make the diagonal line in the swing table cell?

    Hi all,
    How to make the diagonal line in the swing table cell just like the link below?
    http://61.132.17.188/webber/table.gif

    One improvement.. To get a line that is neat, use a bit of Graphics2D
        public void paintComponent(java.awt.Graphics g)
            int w = getSize().width;
            int h = getSize().height;
            // draw a line between (0,0) and (w,h)  
            g.setColor(getForeground());
            if (strTop == null)
                strTop = "  ";
            if (strBottom == null)
                strBottom = "  ";
                java.awt.Graphics2D g2 = (java.awt.Graphics2D)g;
              g2.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING,java.awt.RenderingHints.VALUE_ANTIALIAS_ON);
              //g2.setStroke(new java.awt.BasicStroke(14.0f));
            g.drawLine(0, 0, w, h);
            //the following lines will draw the two strings,
            //one above the top of the line and the above below it.     
            g2.drawString(strTop, (w/2)+2, (h/2)-2);
            g2.drawString(strBottom, 2, (h / 2) + 2);
            //the x,y for drawString are only based on assumption.   //do necessary changes to suit ur needs.
        }Then create a TableCellRenderer and set it to the Table Header for ur table's 1st row.....
    Cheers

  • How to make the attribute of type object private

    Hi All!
    How to make the attributes of type object private ?
    regards
    Sanjeeb Bose
    Kolkata India

    Sanjeeb,
    Object encapsulation can be enforced at your client/mid-tier API level (e.g., Java, C++).
    Regards,
    Geoff
    Hi All!
    How to make the attributes of type object private ?
    regards
    Sanjeeb Bose
    Kolkata India

  • Please help : How to make the anomalistic table just like below?

    Hi all,
    How to make the anomalistic table just like below? Anyone can give the way detail or thoughtway ?
    http://61.132.17.188/webber/table.gif

    This is just a suggestion.
    If you put your "JTable" in a "JScrollPane", then you can add any "java.awt.Component" to the corner of the "JScrollPane" -- using the "setCorner()" method (of "JScrollPane").
    I would suggest making a custon "JPanel" and overriding its "paintComponent()" method to draw a diagonal line (and the required text) on it.
    You can find out more about how to do this from the links I provided in my first reply.
    Hope this helps.
    Good Luck,
    Avi.

  • How to make the  buttons same size on the toolbar

    Hi All,
    Can anyone please tell me how to make the size of buttons on the toolbar to be same .
    And i also want to add combo box at the right side of my menubar with prefered size.
    Please send me the solution if anyone knows . Thanks in advance.
    Regards,
    Shankar.

    how to make the size of buttons on the toolbar to be same Create a panel with a GridLayout. Add the buttons to the panel then add the panel to the menubar.
    add combo box at the right side of my menubar Read this section from the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html]How to Use Menu Bars for an example.

Maybe you are looking for

  • How to placing objects in a box and avoid to get out of box in wpf

    Hello guys. I do not know what title should I choose for my question but I try to explain what I mean. Look at the following picture: In the number 1, You can see the issue that I want to do design. This section contains a background image and a Rect

  • Pdf file printing causes printer to reboot

    Hello! I got this nasty problem. I'm running OS X 10.9.5 on MBPro. I have HP LaserJet M1536dnf MFP (printer-scanner-fax-copier) connected over USB. All drivers and software installed and running ok. But. If I scan some document (with HP own utility)

  • Upgrade from ALUI 5.0.4 to G6 - objectID question?

    I attended BEAWorld and heard about the obectID problem in 5.0.4. We are planning on upgrading to G6 in December. Is there a way for us to find all of the places where we are using objectID with the opener tag? Should we remove/update these tags befo

  • Where do I find my per ordered music

    I pre order an album but when I got to download it I can't find it where do I look for it on an iPad

  • Pismo Power Problems

    Hi, me again. My Pismo arrived today. It's a 400MHz machine with 192MB RAM, 6GB Hard Drive, DVD-ROM and Tiger. I paid £230 for this machine, and the seller stated as clearly as he could on his auction that this 'Book was 'fully working... passed a fu