Android uses jdbc1.3.0 to operate SQL Server

Source: Internet
Author: User

String connectdb = "Jdbc:jtds:sqlserver://172.16.1.15:1433;databasename=yanbu";//The connection string is replaced with this try {                    Class.forName ("Net.sourceforge.jtds.jdbc.Driver");//load driver replaced by this} catch (Exception e) {                    E.printstacktrace ();                    System.out.println ("Failed to load Database engine");                System.exit (0);                } System.out.println ("Database-driven success");                    try {String user = "sa";                    String password = "sa"; Connection con = drivermanager.getconnection (connectdb, user, password);//Connect Database object System.out.println ("                    Connection database succeeded ");                    int i = 1;                    Statement Statement = con.createstatement (resultset.type_scroll_sensitive, resultset.concur_updatable);                    ResultSet ResultSet = Statement.executequery ("select * from Maxsns where Name = ' quality inspection number '); while (Resultset.next ()) {//<code>reSultset</code> initially points to the first row System.out.println (Resultset.getint ("SN"));//output nth row, the value of the column named "test_id"                        i + = Resultset.getint ("SN");                        Resultset.updateint ("SN", I);                    Resultset.updaterow ();                    } resultset.close ();                Statement.close ();                } catch (SQLException e) {e.printstacktrace (); }

  

Android uses jdbc1.3.0 to operate SQL Server

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.