The last Java socket problem has been resolved, this time about the trigger problem

Source: Internet
Author: User
Tags flush sql readline socket thread client
Solve | The problem
The way to solve the problem is:

Change the bufferwriter to printwrite on it, wow, what's going on?? Did Bufferwriter and Bufferreader have a conflict? Bufferwriter cannot flush () and close () when Bufferreader is ReadLine ()? Weird

The program is no problem, my data synchronization platform can also operate.

public class Serverthread extends Thread {private int port;    public serverthread (int port) {this.port = port; }

Private Boolean stop = false;

public void Run () {try {serversocket server = new ServerSocket (port);                while (!stop) {Socket client = server.accept ();                BufferedReader read = new BufferedReader (New InputStreamReader (Client.getinputstream ())); PrintWriter StreamWriter = new PrintWriter (Client.getoutputstream ());//The key is here System.out.println ("Send welcome information");

Streamwriter.println ("Welcome xx"); StreamWriter.Flush ()//If Use bufferwriter this sentence does not work, also cannot send out, therefore the client also cannot receive

String linestr = Read.readline (); if ("Start". Equals (Linestr)) {System.out.println ("Start accepting data!") ");

                     while (true) {                         linestr = Read.readline ();                         if ("End"). Equals (LINESTR)) {                             break;                        } else {                             System.out.println ("Data is" + linestr);                         }                    }               }

StreamWriter.Close ();                Read.close ();            Client.close (); }

catch (IOException ex) {ex.printstacktrace (); }    }

public static void Main (string[] args) {Thread server = new Serverthread (10020);    Server.start (); }

public Boolean isstop () {return stop; }

public void Setstop (Boolean stop) {this.stop = stop; }}



Now also encountered a problem is to use Java JDBC in the database generation trigger, unexpectedly will report syntax error, but still in the database generated trigger, and manual with Pl/sql tools to run a good, this is how to return, strange ~

Specifically, this is true:
Stmt.executeupdate (String triggersql); Trigger is generated in the database schema, but the error state (not the Disable state) then runs this pl/sql with the trigger tool, and there's no problem.
According to the information of the error, we find that it seems that the JDBC syntax does not support more complex SQL, so how do we generate trigger with the program??


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.