java - Download content from url store in a text area -


I am trying to download content from a URL and put it in my database. I have already downloaded it, but this text is displayed in a row in the field. I want to show the paragraph (if wrapped if necessary) in the text area. Here I have tried:

  string x = ""; Try {conn = DriverManager.getConnection ("jdbc: mysql: // localhost / mirroreddatabase", "root", ""); String data = cmbgeneNames.getSelectedItem (). ToString (); String sql = "omimmirrored to select * where symbol GeneSymbol '%" + data + "%'"; // change table is created pst = conn.prepareStatement (sql); Results set rs = pst.executeQuery (); // checkboxes are checked when ((rs.next ()) {x = rs.getString ("link"); } Conn.close (); } Hold (exception e) {JOptionPane.showMessageDialog (null, e); } Url; InputStream = Faucet; DataInputStream dis; String s; Try {conn = DriverManager.getConnection ("jdbc: mysql: // localhost / mirroreddatabase", "root", ""); String data = cmbgeneNames.getSelectedItem (). ToString (); U = new URL (x); Is = u.openstream (); Dis = New DataInputStream (New BufferedInputStream ()); While ((s = dis.readline ())! = Null {// try {string sql = "omimmirrored set sequence =?" Statement made statement = conn.prepareStatement (SQL); Statement.setString (1, S); Statement.executeUpdate (); // check box //conn.close () is checked; //}} hold (exception e) {JOptionPane.showMessageDialog (null, e); } Finally {try is is.close (); } Try (IOException ioe) {} {conn.close (); } Catch (scllException) {} end of the 'end' section)    

My It is suggested that you can try using the class from the package NIO, for example you can read this file originally:

  int amount = 0; // Number of return bytes, bytefuff buff = byte buffer.alocet (1024); While (zodiac! = -1) {zodiac = source.read (buf); // Source is your input stream, here is the source type object FileChannel buf.rewind (); // Revive this buffer position is set to zero and if the mark (zodiac! = -1) is canceled {for (int i = 0; i & lt; zodiac; i ++) System .out.print ((four) buf.get (i)); }}    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -