Clob Big Data Object

Source: Internet
Author: User

Processing clob Big Data Objects

Import Java. SQL. sqlexception; import Java. SQL. drivermanager; import Java. SQL. resultset; import Java. SQL. connection; import Java. SQL. preparedstatement; import Java. io. file; import Java. io. fileinputstream; import Java. io. inputstream; Class tester {public static final string dburl = "JDBC: mysql: // localhost: 3306/student"; public static final string dbuser = "root "; public static final string dbpass = "I Nclude "; public static final string dbdriver =" org. gjt. mm. mySQL. driver "; public static void main (string ARGs []) throws exception {connection con = NULL; preparedstatement PS = NULL; string name =" Wang dameng "; string SQL = "insert into text (name, note) values (?,?) "; Class. forname (dbdriver); con = drivermanager. getconnection (dburl, dbuser, dbpass); // this sentence will be left blank every time PS = con. preparestatement (SQL); file F = new file ("D:" + file. separator + "in.txt"); inputstream in = new fileinputstream (f); PS. setstring (1, name); PS. setasciistream (2, In, (INT) F. length (); ps.exe cuteupdate (); In. close (); PS. close (); con. close (); system. out. println ("operation successful! ");}}



Read clob Big Data Objects

Import Java. SQL. connection; import Java. SQL. sqlexception; import Java. SQL. drivermanager; import Java. SQL. preparedstatement; import Java. SQL. resultset; import Java. io. inputstream; import Java. io. file; import Java. io. fileinputstream; import Java. util. extends; Class tester {public static final string dburl = "JDBC: mysql: // localhost: 3306/student"; public static final string dbdriver = "org. gjt. mm. mySQL. Driver "; public static final string dbuser =" root "; public static final string dbpass =" include "; public static void main (string ARGs []) throws exception {connection con = NULL; preparedstatement PS = NULL; resultset rs = NULL; int id = 1; string SQL = "Select name, note from text where id =? "; Con = drivermanager. getconnection (dburl, dbuser, dbpass); PS = con. preparestatement (SQL) paips.setint(1. id1_rs1_ps.exe cutequery (); If (RS. next () {string name = Rs. getstring (1); stringbuffer sb = new stringbuffer (); system. out. println ("name:" + name); inputstream in = Rs. getasciistream (2); scanning scan = new scanning (in); // scan the eye. usedelimiter ("\ r \ n"); While (scan. hasnext () {sb. append (scan. next ()). append ("\ n");} system. out. println (SB); In. close ();} Rs. close (); PS. close (); con. close ();}}


Clob Big Data Object

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.