ASAP: How to track connection lickage in Java

1) How to track is their any connection linkage at any point during my program execution ?
If yes than how to do that? Is their any java API or java program to track and solve that?
Or I have to check in Database?? If in Database what will be the procedure to do that?
How to track is their any connection linkage at any point during my program execution ?
If yes than how to do that? Is their any java API or java program to track and solve that?
Or I have to check in Database?? If in Database what will be the procedure to do that? Help Please

Hi
I am not sure how you obtain a DB connection...
but you could use the class below to wrap an instance of a real database connection (java.sql.Connection)
like this
public static java.sql.Connection getDBConnection() throws java.sql.Exception
  java.sql.Connection conn = ....... here you obtain connection from ... somewhere... like driver class of server connection pool .......
  //wrapp it here in the class I pasted below...  and return for other parts of code to use it..
  return new TestConn( conn );
}Now, a HashSet variable available in TestConn.openedConnections will give you a set of objects OpenedConnection also defined below..
Every time you obtain a connection with the method above an information about the connection gets added to the HashSet and every time
the connection gets closed, an information about the connection is taken out from the HashSet...
TestConn class:
import java.sql.*;
import java.util.*;
public class TestConn implements java.sql.Connection, java.io.Serializable
    public static final int TRANSACTION_NONE = Connection.TRANSACTION_NONE;
    public static final int TRANSACTION_READ_UNCOMMITTED = Connection.TRANSACTION_READ_UNCOMMITTED;
    public static final int TRANSACTION_READ_COMMITTED = Connection.TRANSACTION_READ_COMMITTED;
    public static final int TRANSACTION_REPEATABLE_READ = Connection.TRANSACTION_REPEATABLE_READ;
    public static final int TRANSACTION_SERIALIZABLE = Connection.TRANSACTION_SERIALIZABLE;
    public static HashSet openedConnections = new HashSet();
    private java.sql.Connection conn = null;
    public TestConn (Connection conn)
        this.conn= conn;
        OpenedConnection newConn = new OpenedConnection(this.conn.toString(),System.currentTimeMillis());
        openedConnections.add(newConn);
    public void setTypeMap(Map<String, Class<?>> map) throws SQLException
        this.conn.setTypeMap(map);
    public void setReadOnly(boolean readOnly) throws SQLException
        this.conn.setReadOnly(readOnly);
    public void setAutoCommit(boolean autoCommit) throws SQLException
        this.conn.setAutoCommit(autoCommit);
    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
     PreparedStatement pstmt = this.conn.prepareStatement(sql,columnIndexes);
     pstmt.setQueryTimeout(10);
        return pstmt;
    public Savepoint setSavepoint(String name) throws SQLException
        return this.conn.setSavepoint(name);
    public void setCatalog(String catalog) throws SQLException
        this.conn.setCatalog(catalog);
    public void rollback(Savepoint savepoint) throws SQLException
        this.conn.rollback(savepoint);
    public void releaseSavepoint(Savepoint savepoint) throws SQLException
        this.conn.releaseSavepoint(savepoint);
    public String nativeSQL(String sql) throws SQLException
        return this.conn.nativeSQL(sql);
    public CallableStatement prepareCall(String sql) throws SQLException
        return this.conn.prepareCall(sql);
    public PreparedStatement prepareStatement(String sql) throws SQLException
        return this.conn.prepareStatement(sql);
    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
        return this.conn.prepareStatement(sql,columnNames);
    public void setTransactionIsolation(int level) throws SQLException
        this.conn.setTransactionIsolation(level);
    public void setHoldability(int holdability) throws SQLException
       this.conn.setHoldability(holdability);
    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
        return this.conn.prepareCall(sql, resultSetType, resultSetConcurrency);
    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
        return this.conn.prepareCall( sql,  resultSetType,  resultSetConcurrency,  resultSetHoldability);
    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
        return this.conn.prepareStatement( sql,  autoGeneratedKeys);
    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
        return this.conn.prepareStatement( sql,  resultSetType,  resultSetConcurrency);
    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
        return this.conn.prepareStatement( sql,  resultSetType,  resultSetConcurrency,  resultSetHoldability);
    public Savepoint setSavepoint() throws SQLException
        return this.conn.setSavepoint();
    public void rollback() throws SQLException
        this.conn.rollback();
    public SQLWarning getWarnings() throws SQLException
        return this.conn.getWarnings();
    public Map<String, Class<?>> getTypeMap() throws SQLException
        return this.conn.getTypeMap();
    public int getTransactionIsolation() throws SQLException
        return this.conn.getTransactionIsolation();
    public DatabaseMetaData getMetaData() throws SQLException
        return this.conn.getMetaData();
    public int getHoldability() throws SQLException
        return this.conn.getHoldability();
    public String getCatalog() throws SQLException
        return this.conn.getCatalog();
    public boolean getAutoCommit() throws SQLException
        return this.conn.getAutoCommit();
    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
        return this.conn.createStatement( resultSetType,  resultSetConcurrency,  resultSetHoldability);
    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
        return this.conn. createStatement( resultSetType,  resultSetConcurrency);
    public Statement createStatement() throws SQLException
        return this.conn. createStatement();
    public void commit() throws SQLException
        this.conn.commit();
    public void close() throws SQLException
        OpenedConnection toRemoveConn = new OpenedConnection(this.conn.toString(),System.currentTimeMillis());
        this.conn.close();   
        this.openedConnections.remove(toRemoveConn);
    public void clearWarnings() throws SQLException
        this.conn.clearWarnings();
    public boolean isClosed() throws SQLException
        return this.conn.isClosed();
    public boolean isReadOnly() throws SQLException
        return this.conn.isReadOnly();
OpenedConnection class
import java.util.*;
public class OpenedConnection implements Comparable, java.io.Serializable
    public String connectionID = null;
    public long openTime = 0L;
    public OpenedConnection(String connectionID, long openTime)
        this.connectionID = connectionID;
        this.openTime = openTime;
    public int hashCode()
        return this.connectionID.hashCode();
    public int compareTo(Object o)
     return this.connectionID.compareTo( ((OpenedConnection) o).connectionID );
    public boolean equals(Object obj)
     return this.connectionID.equals( ((OpenedConnection) obj).connectionID );
    public String toString()
     return this.connectionID;
}I hope it helps
Thomas

Similar Messages

  • How to make Connection Pooling in JAVA

    Dear Members
    I want to know that how can i make connection pooling in java and also how can i use that pool in my jsp/servlet application.
    Plz Describe in Detail.
    Thanks
    Vasim

    vasim_saiyad2000 wrote:
    Dear Members
    I want to know that how can i make connection pooling in java and also how can i use that pool in my jsp/servlet application.
    Plz Describe in Detail.
    Thanks
    VasimAs the previous poster is trying to suggest, the server you use will have datasource and connection pooling support. so look up in the manual how to set it up, or do a google search. For example if you use Tomcat, look here:
    http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

  • How can I connect a client java desktop aplication with the server of jsf

    I need to connect a desktop aplication with a jsf, I need to know how I plug the desktop aplication. I open a connection and then what. I need to send faceBean or a HTML documment or a EL document class. Please help me. I don't know how to do this. If u have examples or code would be great.

    ok, the problem is how to send events to the jsf, how to maintain the session, and other kind of stuffs, this works with the browsers but not with my connection. The problem is not the conecction. The problem is keep the advantages of jsf with my connection. Im using a button in a jsp page connecting to jsf implementation mojarra and works for the events. but with my desktop connection and the same parameters crash with a exception java.util.zip.ZipException: incomplete dynamic bit lengths tree.
    this happens when I try to send the next parameter to jsf, javax.faces.ViewState=ANY VALUE.

  • How to track session in Webdynpro Java application

    Hi All,
    How to get the session reference of any Webdynpro Java Application . My purpose is that thr is one WD application is getting launched , now if suppose user didn't perform any action on it and session for that application got expired . After the session got expired i have to update the table with the status . So to track that i need the session reference of WD application which i m looking for .
    How could i get the same . Kindly help me on this .
    Thanks & Regards,
    Mitul.

    Hi ,
    HttpSession session = request.getSession(false); //get the current session, if there is no session yet, return null
    if (session == null) //forward to first page
    else //do normal work
    Then u can update ur session right ,
    Regards ,
    Venkat

  • How to compile connection pool sample java code

    I recently bought David Knox's "Effective Oracle Database 10g Security by Design", and have been working through his examples with client identifiers and how to leverage database security with anonymous connection pools.
    The database side of things I totally understand and have set up, but I now want to compile/run the java code examples, but don't know what is required to compile this.
    I'm running Oracle 10.2.0.4 (64-bit) Enterprise Edition on a Linux (RHEL 5) PC. Java version is 1.6.0_20. Relevant .bash_profile environment variables are as follows:
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
    export CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
    When I try to compile, I get:
    oracle:DB10204$ java FastConnect.java
    Exception in thread "main" java.lang.NoClassDefFoundError: FastConnect/java
    Caused by: java.lang.ClassNotFoundException: FastConnect.java
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: FastConnect.java. Program will exit.
    The java source code of one of the examples is below. Is someone able to point me in the right direction as to how I get this to compile? Do I just have a syntax and/or environment configuration modification to do, or is there more to it than that to get this example working? Any help much appreciated.
    oracle:DB10204$   cat FastConnect.java
    package OSBD;
    import java.sql.*;
    import oracle.jdbc.pool.OracleDataSource;
    public class FastConnect
      public static void main(String[] args)
        long connectTime=0, connectionStart=0, connectionStop=0;
        long connectTime2=0, connectionStart2=0, connectionStop2=0;
        ConnMgr cm = new ConnMgr();
        // time first connection. This connection initializes pool.
        connectionStart = System.currentTimeMillis();
        Connection conn = cm.getConnection("SCOTT");
        connectionStop = System.currentTimeMillis();
        String query = "select ename, job, sal from person_view";
        try {
          // show security by querying from View
          Statement stmt = conn.createStatement();
          ResultSet rset = stmt.executeQuery(query);
          while (rset.next()) {
            System.out.println("Name:   " + rset.getString(1));
            System.out.println("Job:    " + rset.getString(2));
            System.out.println("Salary: " + rset.getString(3));
          stmt.close();
          rset.close();
          // close the connection which resets the database session
          cm.closeConnection(conn);
          // time subsequent connection as different user
          connectionStart2 = System.currentTimeMillis();
          conn = cm.getConnection("KING");
          connectionStop2 = System.currentTimeMillis();
          // ensure database can distinguish this new user
          stmt = conn.createStatement();
          rset = stmt.executeQuery(query);
          while (rset.next()) {
            System.out.println("Name:   " + rset.getString(1));
            System.out.println("Job:    " + rset.getString(2));
            System.out.println("Salary: " + rset.getString(3));
          stmt.close();
          rset.close();
          cm.closeConnection(conn);
        } catch (Exception e)    { System.out.println(e.toString()); }
        // print timing results
        connectTime = (connectionStop - connectionStart);
        System.out.println("Connection time for Pool: " + connectTime + " ms.");
        connectTime2 = (connectionStop2 - connectionStart2);
        System.out.println("Subsequent connection time: " +
                            connectTime2 + " ms.");
    }Code download is at: http://www.mhprofessional.com/getpage.php?c=oraclepress_downloads.php&cat=4222
    I'm looking at Chapter 6.

    stuartu wrote:
    When I try to compile, I get:
    oracle:DB10204$  java FastConnect.java
    Exception in thread "main" java.lang.NoClassDefFoundError: FastConnect/java
    Caused by: java.lang.ClassNotFoundException: FastConnect.java
    I will try to explain what is happening here.
    You are launching java telling it to run a class named 'java' in a package named 'FastConnect'
    and java says it cannot find that class.
    What you intended to do:
    $ # make the directory structure match the package structure
    $ mkdir OSBD
    $ # move the source file in the directory structure so it matches the package structure
    $ mv FastConnect.java OSBD/
    $ # compile OSBD/FastConnect.java to OSBD/FastConnect.class
    $ javac OSBD/FastConnect.java
    $ # launch java using the OSBD/FastConnect class
    $ java -cp . OSBD.FastConnectNote that the package 'OSBD' does not follow the recommended naming conventions
    you might consider changing that to 'osbd'.

  • Connecting a Local Java Program with a Mysql Database Hosted on the Interne

    I need help. I want to connect a java program running on local user computers to read and write to a mysql database hosted in my domain by an internet service provider.
    What code do i use?
    How do i connect?

    http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html
    You'll ned to downloda the JDBC driver file from MySQL, and check their docs for the format of the connection URL.

  • How to track Entered info at ADF UI page in ApplicationModuleImp.java

    Hi All,
    I am working on one ADF Requirement ,where i ll be configuring DB multiple table(there ll be FK-relationship between all these tables) through ADF UI page.
    requirement is:
    I will be having ADF UI Page (I have my VO based on multiple EO's)
    At runtime if i provide Details in UI page ,those data should go respective tables through single control. UI wont be having all the Columns, I will be tracking related columns through java method then i am updating the same to Other table.
    I can track these values in managed Bean class by using Below Code
    ViewObject vo = ADFUtils.findIterator("OeAttrMappingVO1Iterator").getViewObject();
    vo.getCurrentRow().getAttribute("DeletedFlag");
    But, I want to do same Logic In AMIml.Java
    Can anyone suggest me, how i can track entered info in UI in my AMImpl.java ??? Because I hav some other logic which i can implement in AMImpl.java
    thanks
    Santosh

    Hi,
    look you directly have a control of UI entered data in your managed bean. then you just create a custom method in am impl with parameters. expose the same in client interface, then call the impl method from managed bean and paas the entered values as parameters.
    see if this helps http://xmlandmore.blogspot.com/2011/05/invoking-application-module-custom.html
    ~Abhijit

  • How to track the connection pool refresh details

    Hi,
    Could you please help to track the connection pool refresh details.
    Thanks
    Panneer

    Hi,
    I want track connection pool refresh details for oracle application server 10.1.3.4.
    Please help me to get this info.
    Thanks
    Panneer

  • How can I connect my guitar to ipad2 to create tracks in GarageBand at the best quality leveks

    How can I connect my electric guitar to ipad2 and GarageBand to ensure best quality recordings

    The analog input of the iOS devices is horrible. I have no idea why but there is horrendous crosstalk between the input and the output. I'm a guitar player and I've been fighting with this since I first purchased my iPad. I also do podcasting.
    The cleanest input is obtained by using either the camera kit USB and a compatible device or a unit that specifically utilizes the 50 pin connector.
    It also seems like with each iOS update Apple messes with the current available at the 50pin connector so compatible units may become not so compatible. I have used the ART dual pre successfully until this last OS update and now the power supply seems to be an issue.
    There is a Griffin USB audio device that works well. I don't have the name handy.

  • Help-how can i connect to the XE through my java application?

    Hi, i am trying to connect to the XE through my java application. I have downloaded the jdbc driver tho. but the error occured: cant find the symbol (class oracledatasource not found) . could anyone here tell me what else should i try to fix it? where should i put the jdbc packages ? anyone's prompt reply would be much appreciated! thanks a lot.

    Hi ,thank you very much for your guide.
    i am actually trying to connect to the XE server through my JSP files.
    i download the Oracle jdbc driver packages and put them in the same folder with JSP files. but i did not set the class path tho.
    do i have to set the enviroment variables for the classpath of Oracledatasource class? thanks a lot.
    another problem i got is installing the JDeveloper, it seemed my computer just got stuck there when installing JDeveloper. my laptop is with 256MB memory tho.
    the code i used to connect to the XE server in my jsp file is as below:
    <%@ page language="java" contentType="text/html"%>
    <%@ page import="java.sql.*" %>
    <%@ page import java.sql.Connection%>;
    <%@page import java.sql.SQLException%>;
    <%@page import oracle.jdbc.pool.OracleDataSource%>;
    <%@ page import="java.io.*" %>
    <% String jdbcUrl = "jdbc:oracle:thin:@localhost";
    Connection conn;
    OracleDataSource ds;
    ds = new OracleDataSource();
    ds.setURL(jdbcUrl);
    conn = ds.getConnection(jdbcUrl);
    %>
    dose it have some problems there?
    thanks a lot.
    Message was edited by:
    Novice

  • How to convert Property files into Java Objects.. help needed asap....

    Hi..
    I am currently working on Internationalization. I have created property files for the textual content and using PropertyResourceBundles. Now I want to use ListResourceBundles. So what I want to know is..
    How to convert Property files into Java Objects.. I think Orielly(in their book on Internationalization) has given an utitlity for doing this. But I did not get a chance to look into that. If anyone has come across this same issue, can you please help me and send the code sample on how to do this..
    TIA,
    CK

    Hi Mlk...
    Thanks for all your help and suggestions. I am currently working on a Utility Class that has to convert a properties file into an Object[][].
    This will be used in ListResourceBundle.
    wtfamidoing<i>[0] = currentKey ;
    wtfamidoing<i>[1] = currentValue ;I am getting a compilation error at these lines..(Syntax error)
    If you can help me.. I really appreciate that..
    TIA,
    CK

  • How can i connect to SQL Server 7.0 on Windons Using JDBC

    How can i connect to Microsoft SQL Server 7.0 on a windows enviroment ?
    in sql server 2000 some jar files are required that is
    What you need to do is actually add all three jar files to your class path individually. There are three jar files that come with this driver the msbase.jar, msutil.jar, and mssqlserver.jar. for sqlQ server 2000.
    now the problem is that i cant find these files on my system. firstly where these files will be located. secondly are they will be used to connect to SQL Server 7.0. thirdly if not what is the procedure.
    My next Problem is that I have Websphere Studio Application Developer. in which their is this facility of Database Webpages its like a wizard which makes automatically beans servlets and JSP but before that you need a Driver Name and and Class Name for to Connect to the Database.
    Can you tell what is the specific Driver Path for the Microsoft SQL Server 7.0 . secondly is this the class which is used to connect to SQL server 7.0 "com.microsoft.jdbc.sqlserver.SQLServerDriver" where can i find this one. for SQL server 7.0.
    please provide some guidance in this regard.

    You can search for the JDBC drivers at, http://industry.java.sun.com/products/jdbc/drivers
    All the three jars that you specified are part of MsSQL Server jdbc driver. You need them (in the classpath) to get connected to the database.
    "com.microsoft.jdbc.sqlserver.SQLServerDriver" is the class in mssqlserver.jar. This is the driver class which will be used to get connected to the database.
    You can search in this forum for writting jdbc code (for Sql Server). If you don't find these jars, give me your e-mail id.
    Sudha

  • How to set proxy authentication using java properties at run time

    Hi All,
    How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
    => Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
    import java.io.*;
    import java.net.*;
    public class DnldURLWithoutUsingProxy {
       public static void main (String[] args) {
          URL u;
          InputStream is = null;
          DataInputStream dis;
          String s;
          try {
              u = new URL("http://www.yahoo.com.au/index.html");
             is = u.openStream();         // throws an IOException
             dis = new DataInputStream(new BufferedInputStream(is));
             BufferedReader br = new BufferedReader(new InputStreamReader(dis));
          String strLine;
          //Read File Line By Line
          while ((strLine = br.readLine()) != null)      {
          // Print the content on the console
              System.out.println (strLine);
          //Close the input stream
          dis.close();
          } catch (MalformedURLException mue) {
             System.out.println("Ouch - a MalformedURLException happened.");
             mue.printStackTrace();
             System.exit(1);
          } catch (IOException ioe) {
             System.out.println("Oops- an IOException happened.");
             ioe.printStackTrace();
             System.exit(1);
          } finally {
             try {
                is.close();
             } catch (IOException ioe) {
    }However, it generated the following message when run behind the firewall:
    cd C:\Documents and Settings\abc\DnldURL\build\classes
    java -cp . DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:452)
    at java.net.Socket.connect(Socket.java:402)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:320)
    at sun.net.www.http.HttpClient.New(HttpClient.java:315)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    I have also tried the command without much luck either:
    java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
    There is no problem pinging www.yahoo.com from this system.
    I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
    I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
    Java Control Panel - Use browser settings without success.
    Thanks,
    George

    Hi All,
    How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
    => Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
    import java.io.*;
    import java.net.*;
    public class DnldURLWithoutUsingProxy {
       public static void main (String[] args) {
          URL u;
          InputStream is = null;
          DataInputStream dis;
          String s;
          try {
              u = new URL("http://www.yahoo.com.au/index.html");
             is = u.openStream();         // throws an IOException
             dis = new DataInputStream(new BufferedInputStream(is));
             BufferedReader br = new BufferedReader(new InputStreamReader(dis));
          String strLine;
          //Read File Line By Line
          while ((strLine = br.readLine()) != null)      {
          // Print the content on the console
              System.out.println (strLine);
          //Close the input stream
          dis.close();
          } catch (MalformedURLException mue) {
             System.out.println("Ouch - a MalformedURLException happened.");
             mue.printStackTrace();
             System.exit(1);
          } catch (IOException ioe) {
             System.out.println("Oops- an IOException happened.");
             ioe.printStackTrace();
             System.exit(1);
          } finally {
             try {
                is.close();
             } catch (IOException ioe) {
    }However, it generated the following message when run behind the firewall:
    cd C:\Documents and Settings\abc\DnldURL\build\classes
    java -cp . DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:452)
    at java.net.Socket.connect(Socket.java:402)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:320)
    at sun.net.www.http.HttpClient.New(HttpClient.java:315)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    I have also tried the command without much luck either:
    java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
    Oops- an IOException happened.
    java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
    All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
    There is no problem pinging www.yahoo.com from this system.
    I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
    I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
    Java Control Panel - Use browser settings without success.
    Thanks,
    George

  • How to Track changes of Detail and header at purchase document

    Hi
    I have one problem while issueing the output type i created new output type created new output routine and i have to track the header changes and issue proper output and prevent to issue wrong output type
    example : zne1 for header changes and zneu for detail level but i cannot track the header level changes becoz cdhdr and cdpos tables are updated after output routines (800 and 801 newly created and assigned)
    can u please tell me how to track the po level changes so i can solve this problem ASAP
    it is urgent !!! please help me in this !!
    thanks in Advance !!!

    Hi Mr. Modi,
                       Can you clarify your scenario properly that I can analyse it to give you proper solution....I am confuse with your requirement and  example which you have given...
    Cheers,
    Sagun Desai....

  • How to track no of bytes transferred

    Hi there,
    how to track no of bytes transferred
    while downloading a file using java servlets.
    please note that i am not writing any client side application like applet...
    Hence I want to track no of bytes transffered to client end from my server (using servlets)
    Please kindly help me out as soon as possible.
    awaiting the solution immediately.
    thanks,
    venkat

    //the following is the code what i have written in my servlet.
    res.setContentType(MIME); // I hava parameterised the MIME tag
    OutputStream out=res.getOutputStream();
    int counter=0;
    File f1 = new File("c:/x.pdf");
    //int k=(int)f1.length();
    fis = new FileInputStream(f1);
    byte[] buffer=new byte[fis.available()];
    fis.read(buffer);
    for(i=0; i<buffer.length; i++)
    try
    counter=i+1; //getting the number of bytes got transferred
    out.write(buffer,i,1); //write to client's directory
    catch(IOException ex)
    System.out.println("exception while download="+ex.getMessage());
    downloaded=true;
    if(counter!=buffer.length)
    download_error="Not Downloaded";
    download=false;
    //while executing the above servlet, the servlet prompts for a save as dialog (without file extension, please note I have specified the MIME tag also).
    Now the client is entering the file and clicking save
    In between he cancels and file is not downloaded to the client's directory.
    Now the counter length should not match with the buffer.length, but it is matching exactly and stating that the file has been downloaded properly.
    I hope you would have understood my problem.
    Also note that I dont have any client side application to monitor the download.
    Please let me know how to solve the problem as soon as possible
    expecting your reply at the earliest thanks.

Maybe you are looking for

  • Vendor & Customers in FBL3N

    Hi, I want to see Vendor/Customers in FBL3N for Sales/Purchases GL's. I'm able to see the fields in the layout but data is not displaying. is there any special settings required to get the data. I've already seen BSEG table and there KUNNR field is a

  • Pinter enters unexplaine​d start-up

    Printer repeatedly goes into startup cycle when not in use for no apparent reason--day and night.  Very annoying.   What could cause this?

  • My Ipod was disabled. How do I get it to work again?

    Misplaced My Ipod several months ago and when we tried to sign back in we could not remember the passcode. Now the Ipod was disabled. How do I get it to work again?

  • Windows Server 2008 R2 SP1 freezes and cannot access RDP

    The system freezes every 15 minutes after a reboot. I am trying to capture some stats using procmon to see what is going on, but while I am working on it, it freezes so I cannot even save the file. Next, RDP does not work even when the system is up f

  • JVM for AMD64 unable to load 32-bits DLL on Win64

    Hi all, I get an java.lang.UnsatisfiedLinkError while doing a System.loadLibrary() on Windows x64 (AMD64) with following message: %1 is not a valid win32 application Note the same DLL is successfully loaded by standard JVM (32-bits) on same OS. Anyon