Can server side notify client automatically instead of client refreshing

generally, when we get messages to client, we use refresh requests from server make changes. Dose anyone know in Java has any mechanism that the server can notify client automatically, and dosen't need the client request server initially?
how to implement this?

Thanx, but if not in Http, can java relealize this? For instance, use socket or something else?

Similar Messages

  • Can i use same Server for server side and client??

    Hi,
    i m developing webservices in java and using two different server for server side and client.
    e.g. i m using one tomcat server on a machine to run webservice and again using one more tomcat server on client side at different machine.
    and hence it need two tomcat server.
    But i want only one server to run webservice and client.
    So please help me out...
    Thanks

    Hi,
    It is always recommended to maintain different servers
    REgards,
    Ravi.

  • Copy a .swf file from server side to client using signed applet

    Hello All,
    I already have my applet signed and its working pretty well. However I want to know how can I import a .swf file into clients machine. The .swf file initially is on server side, my applet checks whether this .swf file exists already on client machine. If not it copies it to his machine.
    I know how to chk if the file already exits on client machine but I am not sure how to copy this .swf file to his machine if its missing.
    May be I need to set some input buffers from server side and then copy them to his machine.
    Can some one throw some light on this issue ??

    Hello to all Java Code Masters out thr,
    I am trying to copy a .swf file from server side to client side, however I am unsuccessful in writing the correct data. By correct data I mean that , the data does gets saved on the client side in the .swf file, and the size of the .swf file on client side is as expected, but some how I don't know why the data is not the same as expected.
    I tried opening up both the swf file, one which is on server side and the other which is on client side. And both looked different in the notepad.
    When I opens up the client side .swf file on browser it shows nothing while the .swf file on server side worked fine.
    Here is a snap shot of the two .swf files when opened in notepad:
    clientside.swf
    坃ࡓ죃鱸뷤瀉�ᡚ穸s歒斷뛉쭬ⶲ뉯緤░뉋쭬틲��毳띵뺤畮祮୹釯烉쉍‼➀Ƿℵ㼤ꦅ㼌⡉⁈ș㖩䈼ꦓɊጵꨘ妆ၸ쇠鳳ﯯ龜괯䪅�쿾칿칷컹緶履殖㋿罣쯻杬�懨�E�翂䶙幷鿠︡拡ﬦ댨꾖政ᯋὣꯤ糥䧩缿䨗捫嶺깼瘶羋⯞勹쪾癞ঞ頁韧୘롻ⱖ撯貊攗閩㫙↳萰Ⳁ⼈쳂荡᧰ﻶ顠꓈鸎싔㿄㰧柂䪄러䂀좹㏠ꕊ㌏힟䘜㦴⌙⍈㽾ꙴ㿯렑㽔serverside.swf
    CWS�� x���     p��ZxzS�Rk�e��l��-o��}�%K�l�������]��ku���nu��nyy���pM�< �'�5!$����I
    (H �
    5<B
    ��J5��Yx��������/����J������w����}���
    k�2c��lg���a��\�%��serverside.swf is what I expect to be saved, but clientside.swf is what i get.
    Below is a code snippet which I am trying :
      public void writeswftoclient(String swfcontent) {
        String userHome = System.getProperty("user.home" );
        String ImoracleDirectory = userHome + "\\MyFolder";
        File fdirectory = new File(ImoracleDirectory);
        if(!fdirectory.isDirectory()) {
          fdirectory.mkdir();
        String playlist = ImoracleDirectory + "\\clientside.swf";
        File fplaylist = new File(playlist);
        try {
          Writer output = null;
          output = new BufferedWriter(new FileWriter(fplaylist,true));
          *System.out.println(swfcontent);*
          *output.write(swfcontent);*
          output.close();
        catch (Exception e) {
          System.out.println("Cannot create or write to the playlist");
      }In above code I am trying to write the string swfcontent, which contains the data shown above in serverside.swf, to clientside.swf.
    Interesting thing is that I am doing System.out.println(swfcontent); just before writing the data to clientside.swf using output.write(swfcontent);. And System.out.println does print the write data on the java console. However I dont know out of what reason the data doesnt get written correctly on the client's computer.
    Kindly help me in this plzzzzzzzzzz.

  • Sockets: How can server detect that client is no longer connected?

    Hi,
    I really need help and advice with the following problem:
    I have a Client - Server socket program.
    The server listens on port 30000 using a server socket on one machine
    The client connects to localhost on port 20000, previously creating an ssh port forward connection using the Jsch package from www.jcraft.com with
    "session.setPortForwardingL(20000, addr, 30000);"
    Then the client sends Strings to the server using a PrintWriter.
    Both are connected to each other through the internet and the server uses a dynamic dns service.
    This all works well until the IP address of the Server changes, The client successfully reconnects to the server using the dynamic dns domain name, but the server keeps listening on the old socket from the previous connection, while opening a new one for the new client connection. The server doesn't seem to notice that Client has disconnected because of this IP address change.
    looks like the server is stuck inside the while loop. If i cut the connection manually on the client side, the server seems to notice that the client has disconnected, and jumps out of the while look (see code below)
    this is the code I'm using for the server:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.Socket;
    import java.util.logging.Logger ;
    public class SocketHandler extends Thread {
        static Logger logger = Logger.getLogger("Server.SocketHandler");
        private Socket clientSocket = null;
        private BufferedReader in = null;
        private InputStreamReader inReader = null;
        public SocketHandler(Socket clientSocket) throws IOException {
            this.clientSocket = clientSocket;
            inReader = new InputStreamReader(clientSocket.getInputStream ());
            in = new BufferedReader(inReader);
        public void run() {
            try {
                String clientMessage = null;
                while ((clientMessage = in.readLine()) != null) {
                    logger.info("client says: " + clientMessage);
            } catch (IOException e) {
                logger.severe(e.getMessage());
                e.printStackTrace();
            } finally {
                try {
                    logger.info("closing client Socket: " + clientSocket);
                    clientSocket.close();
                    in.close();
                    ServerRunner.list.remove(clientSocket);
                    logger.info("currently "+ServerRunner.list.size()+" clients connected");
                } catch (IOException e) {
                    logger.severe (e.getMessage());
                    e.printStackTrace();
    }I've tried making the server create some artificial traffing by writing some byte every few seconds into the clients OutputStream. However I get no exceptions when the IP address changes. The server doesn't detect a disconnected socket connection.
    I'd really appreciate help and advice

    If a TCP/IP peer is shut down "uncleanly", the other end of the connection doesn't get the final end of connection packet, and read() will wait forever. close() sends the final packet, as will killing the peer process (the OS does the close()). But if the OS crashes or for some other reason can't send the final packet, the server never gets notification that the peer has gone away.
    Like you say, one way is timeout, if the protocol is such that there always is something coming in at regular intervals.
    The other way is a heartbeat. Write something to the other end periodically, just some kind of "hello, I'm here, ignore this message". The other end doesn't even have to answer. If the peer has gone away, TCP will retransmit your heartbeat message a few times. After about a minute it will give up, and mark the socket as broken. read() will then throw an IOException. You could send heartbeats from the client too, so that the client detects if the server computer dies.
    TCP/IP also has a TCP-level heartbeat; see Socket.setKeepAlive(). The heartbeat interval is about two hours, so it takes it a while to detect broken connections.

  • How to send Subtopic Message From Server-Side to Client ?

    I’m new at flex and i have a new question about Flex
    Message Service.
    How to send messages from Server-Side Java Code with
    Subtopic?
    For example.
    I customed a Flex Message Adapter in Tomcat Server , with
    this Adapter , i can send message to Client with following code .
    ---------------------Send message to Client------------
    MessageBroker msgBroker =
    MessageBroker.getMessageBroker(null);
    String clientID = UUIDUtils.createUUID(false);
    AsyncMessage msg = new AsyncMessage();
    msg.setDestination("CustomMsgServiceDes");
    msg.setClientId(clientID);
    msg.setMessageId(UUIDUtils.createUUID(false));
    msg.setTimestamp(System.currentTimeMillis());
    msg.setBody(clientID + "this is my message from server! \n");
    msgBroker.routeMessageToService(msg, null);
    ---------------------Send message to Client------------
    But i want send a message that have Subtopic to the Client ,
    How to do ?
    Thank you for reply.

    There's a white paper that talks about this subject -
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=8f1eb6ea

  • Generating feedback messages on server-side vs client-side?

    Hello,
    I am maintening a client/server app (Swing client, no Web pages), basically an order processing system. The biggest part of it is to verify the conformity of orders to a set of business rules.
    As usual, some of the verification can be made early on the client-side, but most of the verification work is done on the server-side. My problem is, I don't find a very satisfactory way to generate the user feedback to be displayed to the user.
    If I generate them as Strings (or HTML Strings) on the server, where the rules are checked, this constrains the way these can be displayed on the client, and makes maintenance of the human-readable strings awkward and risky (e.g. localization, or restructuring the messages, like sorting them by severity vs by affected entity).
    If I generate them on the client, I need a class to vehicle the diagnosis form server to client, and this class and its usage tends to become awkward in itself.
    Concretely:
    The initial version generated human-readable strings on the server, which assumed the messages would be displayed as strings in a JOptionPane.
    Moreover, the logic evolved to distinguish between Info, Warning and Error messages, to be displayed in different colors of course, so the Strings evolved into HTML Strings, still generated on the server.
    Do you think this approach is safe?
    I'm afraid a simple maintenance of the strings (like, sorting the errors by severity vs by affected entity, filtering the strings,...) becomes a server-side development, which is a bit more risky (I would have to review code ownership policies, VCS and code-sharing policies,... to let less experienced staff maintain the darn error Strings).
    Moreover, if the client app evolve to display the errors in complex widgets (colors in a tree/table, with tooltips), the server-side generated HTML strings would be constraining : coloring or tooltipping Tree nodes would now mean parsing the String to extract the "error level" or the "affected entity", which is quite inelegant and inflexible.
    My current idea was then to use a collecting parameter to collect validation messages on the server, and traverse them on the client:
    I designed a naive ErrorList class, with methods such as addInfo(String), addWarning(String), addError(Strin), and the corresponding getErrors() and hasErrors()/hasWarnings() methods. I can then generate the Strings (or whatever widget fits better, such as a table) on the client side. Moreover, I can add the client-side messages to the bag...
    All nice and well, but the customer requested that the error messages be formatted such as "The profile <profile name in bold> does not allow you to order service <service name in italics>".
    To format that on the client, my ErrorList class should evolve so that for a given message, I know that the error is of type ("incompatibility between profile and service", that the service is X and the prodile is Y).
    That forces me to add in some API (shared by the client and server) the list of error types, and the data each error type requires.
    I can evolve my ErrorList API to break up messages into a DTO giving (type, affected entity, arg1, arg2,...), but anyway the server and client have to agree on what is arg1, etc... which is a hidden coupling.
    Do you use and recommend such an approach for server-to-client feedback: a collecting parameter in which the server puts the "errors", and that the client traverses to display the messages)? In particuler, isn't the coupling hard to maintain?
    Thansk in advance,
    J.

    Presumably you are not over-engineering in that you
    know that localization is a problem rather than that
    in all possible worlds in might be.I appreciate your delicate questioning... I definitely have read much ruder ways to say YAGNI to a poster...
    I do know that the customer will knit-pick to reword and reformat the messages. But I won't need to translate the messages to other locales. In that regard, I ackowledge my usage of the term localization is a bit liberal, but I think I should to extract the messages from the code, to be able to maintain them separately - keeping only experienced staff's hand in the server's core.
    That is actually my question 1): from experience, is it worth the trouble to separate code and human-readable text, knowing that the text WILL have to be maintained?
    Question 2 is about how to implement this.
    In particular, the built-in MessageFormat templating engine, though originally introduced for i18n, actually suits my needs (including MessageFormat-built messages) and developing or using any other templating engine would probably be an overkill.
    Given that there are two types of messages.
    1. Fixed
    2. Parameter driven.
    In both cases you need to return an id which
    identifies the message. The client has a locale
    specific resource source which has a matching id.
    From there a string is derived.
    If the error requires parameters then the string has
    formatting values in it and it s written with the
    returned parameters. See java.text.MessageFormat.Yes. In some cases I don't know yet whether parameters will be displayed. I can conservatively assume the message requires a MessageFormat, and give all parameters (in my case, use rname, profile name, command id, service name, order date,...), whether thay are displayed or not in the final message.
    Be warned you MUST deal with the possibility that a
    id does not exist in the client, if so have a default
    message that displays the id and any parameters.Good point.
    "The customer name field can not be longer than 15
    characters".
    In the above the "15" would a parameter.Yes. The trouble is, you have to document somewhere (Sun suggests in the resource bundle file), that for error id #123456, the number of characters in in the '{0}', or in the {6}. I don't feel confident with that (this is the "coupling" part in my question 2�).
    Thanks for your advices.

  • Load Balancing, Server and / or Client ?

    Hi
    I am experiencing a problem with the connection pooling in odp.net. I have a simple test app that creates a connection, executes a query, populates an object then closes the connection. I have found that when I have client side load balancing on via the odp.net connection string property many connections are made unnecessary (sometime the actual number created reaches the max pool size but the numbers differ randomly). It appears that rather than a free connection in the pool being used more connections are being created which defeats the point of having a connection pool. I do have server side load balancing configured correctly also. Due to this finding can someone possibly answer the following questions.
    a) Do I need both server side and client side load balancing set?
    b) If I do why is the above behaviour being seen? If not could you give me a short explanation as to why not?
    Current set up is 11g (patched to 6, awaiting 7 to be applied) RAC, 2 nodes.
    Below is the C# code used while testing this. The table queried is a simple person table containing 16000 rows if data.
    OcConnection = "User Id=XXX; Password=XXX; Connection Lifetime = 60; Data Source=(DESCRIPTION=(ADDRESS_LIST=(FAILOVER=on)(LOAD_BALANCE=off)(ADDRESS=(PROTOCOL=tcp)(HOST=XXX)(PORT=1521))(ADDRESS=(PROTOCOL=tcp)(HOST=XXX)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=MyFirstTest))); Pooling=true; HA Events = true; Load Balancing = true";
    Code:-
    Oracle.DataAccess.Client.OracleConnection con;
    con = new Oracle.DataAccess.Client.OracleConnection();
    con.ConnectionString =OcConnection;
    con.Open();
    // the command object to use for this test
    OracleCommand cmd = con.CreateCommand();
    cmd.CommandText = "select * from PERSON";
    OracleDataReader rdr = cmd.ExecuteReader();
    List<test> listTest = new List<test>();
    while (rdr.Read())
    test dc = new test();
    if (!rdr.IsDBNull(0))
    dc.id = Convert.ToInt32(rdr.GetValue(0));
    if (!rdr.IsDBNull(1))
    dc.forename = rdr.GetString(1);
    if (!rdr.IsDBNull(2))
    dc.surname = rdr.GetString(2);
    if (!rdr.IsDBNull(3))
    dc.street = rdr.GetString(3);
    if (!rdr.IsDBNull(4))
    dc.city = rdr.GetString(4);
    if (!rdr.IsDBNull(5))
    dc.postcode = rdr.GetString(5);
    if (!rdr.IsDBNull(6))
    dc.country = rdr.GetString(6);
    if (!rdr.IsDBNull(7))
    dc.email = rdr.GetString(7);
    if (!rdr.IsDBNull(8))
    dc.dateadded = rdr.GetDateTime(8);
    if (!rdr.IsDBNull(9))
    dc.randWords = rdr.GetString(9);
    if (!rdr.IsDBNull(10))
    dc.uniqueNumber = Convert.ToInt32(rdr.GetValue(10));
    listTest.Add(dc);
    rdr.Close();
    con.Close();
    rdr.Dispose();
    cmd.Dispose();
    con.Dispose();
    Thanks for your time
    Victoria

    Here are the HTTP Headers as monitored on the client side. Notice the good.txt file includes a GET as it's initial request. All works fine in this case. However, the initial request in the bad.txt is a POST. This is odd since the URL was opened using the same shortcut in both incidents and the browser was closed between each trace that was taken. I've also reviewed the shortcut with notepad to verify it does not include unwanted data such as the JSESSIONID info....etc.
    Once you have reviewed the HTTP headers, I have these questions.
    1. IIS is sending the 100 Continue messages as you mention, but why is the CSS injecting the cookie in a 100 response that is not typically processed by the client? The bad.txt file shows the client receiving two ARPT cookies because the first cookie in the 100 continue response was ignored.
    2. I know Cisco is not really in the business of troubleshooting browser behaviour. But do you know why the browser would behave differently....GET in one request and a POST in the next? We do not wish to get into modifying the browser, so I'm hoping we can provide a solution on the server side that will allow the browser to function this way if it chooses to do so. Do you think it would make sence to push the state management up a level to the cookie handed out by JRUN? This way, the cookie would not be handed back in a 100 response from IIS, and we could tell the CSS to monitor the JRUN cookie. Of course this would require we determine how to manage this cookie either by modifying to cookie to have static data for each server, or by using the right method of hashing...etc.
    Chris

  • Server side does not detect network failure

    Hi folks,
    I coded a simple chat program. When a client connects to the multi-thread server, server shows newly connected client's IP address. Now, if the connection between client and server is down, client detects and terminates itself but server does not. The server still shows that client as connected. when I traced the server side, I found out that server was waiting at the readObject (client object input stream) line but it didn't throw any IOException. I tried to send some message to all connected client at every 20 seconds, so I expected to catch IOException when the server did not reach the client. Unfortunately, it didn't work. That is my question how can server side detect network failure?
    Thanks for help.
    Regards
    Bulent

    That is how TCP works (noting that it has nothing to do with java.)
    Your solution is one of the following or some combination...
    - If the server does not receive something every X time period then it disconnects.
    - If the server has not received something after X time period it sends a keep alive message to the client. If the client does not respond (or the message fails) then the server disconnects.

  • How to automate accept client of the server side?

    Hi.....
    I am a beginner of using J2ME to developing my final year project. I have some problem of using bluetooth packet. I can't accept again the client message when the server accepted before. Any one can solve my problem? How can I using the loop or timer to accept the client message without using acceptAndOpen() packet? Thank a lot.....
    The sample code is here:
    - Server side
    public class BluetoothServer implements Runnable {
         private GameMIDlet gameMIDlet;
         private HandleSetting setting;
         private HandleScore score;
         private ScreenGame screenGame;
         private int playerMethod;
         //private GUIGameServer guiGameServer;
    StreamConnectionNotifier notifier;
    StreamConnection conn;
    LocalDevice localDevice;
    ServiceRecord serviceRecord;
    InputStream input;
    OutputStream output;
    private boolean isInit;
    private boolean isReady;
    private static String serverUrl = "btspp://localhost:" + ScreenMultiPlay.SHARE_UUID + ";name=GameServer;authorize=true";
    public BluetoothServer(GameMIDlet gameMIDlet,HandleSetting setting, HandleScore score, int playerMethod) {
         this.gameMIDlet = gameMIDlet;
    this.setting = setting;
              this.score = score;
              this.playerMethod = playerMethod;
         isReady = false;
    isInit = false;
    Thread accepterThread = new Thread(this);
    accepterThread.start();
    public void run() {
    if (!isInit) {
    // Initialization is done in the thread to avoid dead lock 'isInit' ensures it is done once only
    try {
    conn = null;
    localDevice = LocalDevice.getLocalDevice();
    localDevice.setDiscoverable( DiscoveryAgent.GIAC );
    notifier = (StreamConnectionNotifier)Connector.open(serverUrl);
    } catch (BluetoothStateException e) {       
    System.err.println( "BluetoothStateException: " + e.getMessage() );
    } catch (IOException e) {       
    System.err.println( "IOException: " + e.getMessage() );
    isInit=true;
    System.out.println( "Starting Echo Server" );      
    try {
    System.out.println("\n\nServer Running...");
    isReady=true;
    if (isReady) {
         try {
                        screenGame = new ScreenGame(this.gameMIDlet,this.setting,this.score,playerMethod);
              screenGame.start();
    Display.getDisplay(gameMIDlet).setCurrent(screenGame);
                   } catch(Exception e) {
                        gameMIDlet.showErrorMsg(null);
    // Pauses thread until Transmission occurs
    conn = notifier.acceptAndOpen();
    // Read Data Transmission
    String msg = ScreenMultiPlay.readData(conn);
    System.out.println("Received Message from Client: " + msg);
    // Send Back a Message
    msg = "Hello Back from Server";
    output = conn.openOutputStream();
    output.write(msg.length()); // length is 1 byte
    output.write(msg.getBytes());
    output.close();
    } catch (Exception ex) {
    System.err.println("Bluetooth Server Running Error: " + ex);     
    public void destroy() {
    //isClosed = true;
    // finilize notifier work
    if (notifier != null) {
    try {
    notifier.close();
    isInit=false;
    } catch (IOException e) {} // ignore
    // wait for acceptor thread is done
    /*try {
    accepterThread.join();
    } catch (InterruptedException e) {} // ignore*/
    -Client side
    class BluetoothClient implements DiscoveryListener {
         private GameMIDlet gameMIDlet;
         private HandleSetting setting;
         private HandleScore score;
         private ScreenGame screenGame;
         private int playerMethod;
    private DiscoveryAgent discoveryAgent;
    private RemoteDevice[] remoteDevices;
    private UUID[] uuidSet;
    private String serviceUrl;
    public BluetoothClient(GameMIDlet gameMIDlet,HandleSetting setting, HandleScore score, int playerMethod) {
    this.gameMIDlet = gameMIDlet;
    this.setting = setting;
              this.score = score;
              this.playerMethod = playerMethod;
    try {
    LocalDevice localDevice = LocalDevice.getLocalDevice();
    discoveryAgent = localDevice.getDiscoveryAgent();      
    discoveryAgent.startInquiry(DiscoveryAgent.GIAC, this);
    //-----go to deviceDiscovered()-----------------
    } catch (Exception e) {
    System.out.println(e);
    public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
    try {
    // Get Device Info
    System.out.println("Device Discovered");
    System.out.println("Major Device Class: " + cod.getMajorDeviceClass() + " Minor Device Class: " + cod.getMinorDeviceClass());
    System.out.println("Bluetooth Address: " + btDevice.getBluetoothAddress());
    System.out.println("Bluetooth Friendly Name: " + btDevice.getFriendlyName(true));
    // Search for Services
    uuidSet = new UUID[1];
    uuidSet[0] = ScreenMultiPlay.SHARE_UUID;
    int searchID = discoveryAgent.searchServices(null,uuidSet,btDevice,this);
    //-------------go to inquiryCompleted()----------------------
    } catch (Exception e) {
    System.out.println("Device Discovered Error: " + e);     
    public void inquiryCompleted(int discType) {
    System.out.println("InquiryCompleted");
    //---------------go to servicesDiscovered()------------------------
    public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
    System.out.println("ServicesDiscovered");
    // in this example there is only one service
    for(int i=0;i<servRecord.length;i++) {      
    serviceUrl = servRecord.getConnectionURL(0,false);
    //---------------go to serviceSearchCompleted()--------------------
    public void serviceSearchCompleted(int transID, int responseCode) {   
    if(responseCode == SERVICE_SEARCH_ERROR)
    System.out.println("SERVICE_SEARCH_ERROR\n");
    if(responseCode == SERVICE_SEARCH_COMPLETED) {
    System.out.println("SERVICE_SEARCH_COMPLETED\n");
    System.out.println("Service URL: " + serviceUrl);
    StreamConnection conn = null;
    try {
         String msg = "Say Hello World";
    conn = (StreamConnection)Connector.open(serviceUrl);
    OutputStream output = conn.openOutputStream();
    output.write(msg.length());
    output.write(msg.getBytes());
    output.close();
    System.out.println(ScreenMultiPlay.readData(conn));
    } catch (Exception ex) {
         System.out.println(ex);
    } finally {
         try {
         conn.close();
         } catch (IOException ioe) {
         System.out.println("Error Closing connection " + ioe);
    if(responseCode == SERVICE_SEARCH_TERMINATED)
    System.out.println("SERVICE_SEARCH_TERMINATED\n");
    if(responseCode == SERVICE_SEARCH_NO_RECORDS)
    System.out.println("SERVICE_SEARCH_NO_RECORDS\n");
    if(responseCode == SERVICE_SEARCH_DEVICE_NOT_REACHABLE)
    System.out.println("SERVICE_SEARCH_DEVICE_NOT_REACHABLE\n");

    This question isn't logical at all. You don't execute javascript on the server. But if you want to waste time on it. .. look at Rhino http://www.mozilla.org/rhino/
    Best of luck...

  • How can i load file into database from client-side to server-side

    i want to upload file from client-side to server-side, i use the following code to load blob into database.
    if the file is in the server-side, it can work, but if it in the client-side, it said that the system cannot find the file. i think it only will search the file is in the server-side or not, it will not search the client-side.
    how can i solve it without upload the file to the server first, then load it into database??
    try
    ResultSet rset = null;
    PreparedStatement pstmt =
    conn.prepareStatement ("insert into docs values (? , EMPTY_BLOB())");
    pstmt.setInt (1, docId);
    pstmt.execute ();
    // Open the destination blob:
    pstmt.setInt (1, docId);
    rset = pstmt.executeQuery (
    "SELECT content FROM docs WHERE id = ? FOR UPDATE");
    BLOB dest_lob = null;
    if (rset.next()) {
    dest_lob = ((OracleResultSet)rset).getBLOB (1);
    // Declare a file handler for the input file
    File binaryFile = new File (fileName);
    FileInputStream istream = new FileInputStream (binaryFile);
    // Create an OutputStram object to write the BLOB as a stream
    OutputStream ostream = dest_lob.getBinaryOutputStream();
    // Create a tempory buffer
    byte[] buffer = new byte[1024];
    int length = 0;
    // Use the read() method to read the file to the byte
    // array buffer, then use the write() method to write it to
    // the BLOB.
    while ((length = istream.read(buffer)) != -1)
    ostream.write(buffer, 0, length);
    pstmt.close();
    // Close all streams and file handles:
    istream.close();
    ostream.flush();
    ostream.close();
    //dest_lob.close();
    // Commit the transaction:
    conn.commit();
    conn.close();
    } catch (SQLException e) {

    Hi,
    Without some more details of the configuration, its difficult to know
    what's happening here. For example, what do you mean by client side
    and server side, and where are you running the upload Java application?
    If you always run the application on the database server system, but can't
    open the file on a different machine, then it sounds like a file protection
    problem that isn't really connected with the database at all. That is to
    say, if the new FileInputStream (binaryFile) statement fails, then its not
    really a database problem, but a file protection issue. On the other hand,
    I can't explain what's happening if you run the program on the same machine
    as the document file (client machine), but you can't write the data to the
    server, assuming the JDBC connection string is set correctly to connect to
    the appropriate database server.
    If you can provide some more information, we'll try to help.
    Simon
    null

  • How can I convert client-side Shared Object in server-side Shared Object?

    Hello world....
    I have a problem...
    I have a program that uses client-side shared Object, like the Example "Ball" il the FMS 3.5 guide: I can move a ball around the stage...
    I need to convert this program so I can use server side shared object. This is because I can load the .swf to another .swf and I must to be able to reset, or delete, the properties of my shared object. With client-side sahred object I can't delete or reset the shared object after I loaded my external .swf....
    My script is:
    private var pointer1_so:SharedObject;
    nc=new NetConnection  ;
    nc.connect (rtmpNow);
    nc.addEventListener (NetStatusEvent.NET_STATUS,doSO);
    Cerchio=new cerchio ;
    addChild (Cerchio);
    Cerchio.x=220;
    Cerchio.y=280;
    Cerchio.addEventListener (MouseEvent.MOUSE_DOWN,beginDrag1);
    Cerchio.addEventListener (MouseEvent.MOUSE_UP,endDrag1);
    private function doSO (e:NetStatusEvent):void
                 good=e.info.code == "NetConnection.Connect.Success";
                 if (good)
                       //Shared object
                       pointer1_so=SharedObject.getRemote("point1",nc.uri,false);
                       pointer1_so.connect (nc);
                       pointer1_so.addEventListener (SyncEvent.SYNC,doUpdate1);
    private function doUpdate1 (se:SyncEvent):void
                 for (var cl1:uint; cl1 < se.changeList.length; cl1++)
                       trace(se.changeList[cl1].code);
                       if (se.changeList[cl1].code == "change")
                            switch (se.changeList[cl1].name)
                                 case "xpos" :
                                       Cerchio.x=pointer1_so.data.xpos;
                                       break;
                                 case "ypos" :
                                       Cerchio.y=pointer1_so.data.ypos;
                                       break;
    private function beginDrag1 (e:MouseEvent)
                     Cerchio.addEventListener (MouseEvent.MOUSE_MOVE,moveMc1);
                     Cerchio.startDrag (false,Rect1);
    private function endDrag1 (e:MouseEvent)
                     Cerchio.stopDrag ();
    private function moveMc1 (e:MouseEvent)
                e.updateAfterEvent ();
                   pointer1_so.setProperty ("xpos",Cerchio.x);
                   pointer1_so.setProperty ("ypos",Cerchio.y);
    Can someone helps me?
    I know I need of a server side script but...
    Please...
    Emiliano.

    ResultSet is not serializable. It is an active connection. If you wish to serialize the info, then read it into an ArrayList in your serializable class and pass the Data that way.

  • How to start streaming from server side after applet initialized on client

    Hi,
    I am using JSP for on demand streaming server.
    I have included an applet in jsp page which start new player on client side after on streamreceive event.
    But my problem is how to give call to server that applet on client side has been initialized and now streaming can go on.
    Is there any method / way to call class file which will start streaming?

    Oracle is designed to support connection from client to server. The client originates the connection.
    If you want the server to initiate the connection, you need to make the server pretend it is a client. Oracle even does this internally, when they want to use 'External Procedures'
    You may also use Oracle's Message Queue mechanism, called 'Advanced Queueing' to use a 'publish subscribe' model instead of a connection model. That is discussed in the Advanced Queue manual in the documentation at http://docs.oracle.com
    Finally, you can explore the possibility of using RMI from the database, as discussed in the Java related documentation at the same location.

  • How can I disable excel addin on the Server side?

    Hi, is there any way to disable excel addin on the server side?
    We want to disable it so that no one can modify or read data in the cube in the production environment, even if he or she had installed the add in. Instead, we provide the Planning data forms as the only interface for end-users to read and write. we do this because the add in is very easy to install and users can read and write data in the cube at their will.
    As we designed to keep the security filters simple, it is not a good idea to controll data access through security filters.
    so, what i'm asking is how to disable excel addin on the server side?
    Thank you for replying.
    Edited by: user4592285 on 2012-10-18 上午6:48

    Hi,
    As Gurus suggested, you will have to restrict viewing of data through dimension level security.
    Give access of members to users, only which are relevant to users so that they can't view other user's data/members.
    Like give access of members belonging to HR dept only to HR users and give access of Finance dept related members to finance users only.
    Hence HR users will view only HR relevant data and won't be able to view (read or write) finance related data and vice-sa-versa.
    Hope this helps
    Regards
    -SM
    Edited by: 918547 on Oct 18, 2012 8:40 PM

  • RUN SERVER SIDE OS COMMAND OR ANY EXECUTABLE FILE FROM CLIENT

    Would you provide a complete example regarding execution Server side OS command or program from ORACLE SQL CLIENT OR FORM. This client may be a remote client.

    instead of just copying jvm.dll, I would recommend installing Java through the installer as there are most likely other files that jvm.dll is dependent on, etc.
    It's been a while since I have worked with HAL integrations (Vignette), but I believe you will need HFM client installed on the end user machine.
    If you have a lot of machines, this could be a bit annoying. Because of that when we used HAL, we made a custom web front-end that ran on a server with the HAL programs. It was more work to build the web U/I; however, from a management perspective, it was a lot easier to control/maintain.
    $.02

  • How to implement server side methods in client side player from main.asc?

    Hi,
    I am developing video player using RTMP NetConnection and NetStream object but it is giving me below Error. Can you please tell me how can I handle this. I have main.asc file form FMS server side but I don't know how to use it. 
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback setUserID.
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback syncChat.
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback playingNotComplete.
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback nowPlaying.
    Can anyone please help me ot solve this issue?
    Best regards,
    Sunil kumar

    javascript are run on the client side.. but i think what you actually mean is getting some validation to your database without submitting the form?. yes it doesn't consumes time and memory of server.. why not use ajax so you can only submit a little request.. rather than submitting the whole page..

Maybe you are looking for