MySQL Basic notes

Source: Internet
Author: User

1, the installation of MySQL diagram.

2, the difference between different databases on the impact of the program

1) Data type

2) Paging problem

SQL paging is fairly simple, and the paging is different for different databases. SQL Server is also simpler, only Oracle is more difficult.

3 Automatic increment field of database

3, the date of MySQL processing

4, connect to the Java connection to the MySQL verification instance:

Import java.sql.*; public class Testmysqlconnection {/** * @param args */public static void main (string[] args) {Connection conn
		= NULL;
		Statement stmt = null;
		ResultSet rs = null;
			try {class.forname ("com.mysql.jdbc.Driver");
			conn = DriverManager. getconnection ("jdbc:mysql://localhost/mstx?user=root&password=123456");
			stmt = Conn.createstatement ();
			rs = Stmt.executequery ("SELECT * from Mstx_head");
			while (Rs.next ()) {System.out.println (rs.getstring ("Tname"));
		} catch (ClassNotFoundException e) {e.printstacktrace ();
			catch (SQLException ex) {System.out.println ("SQLException:" + ex.getmessage ());
			System.out.println ("SQLState:" + ex.getsqlstate ());
		System.out.println ("Vendorerror:" + ex.geterrorcode ());
					Finally {try {if (rs!= null) {rs.close ();
				rs = null;
					} if (stmt!= null) {stmt.close ();
				stmt = null;
					} if (conn!= null) {conn.close ();
				conn = null;} catch (SQLException e) {e.printstacktrace ();
 }
		}
	}
}

5, English documents, personal fear, do not dare to move caused. Find Example Programs

6, show databases, show tables;

Attention:

Before building a table, you must add a use---to the front;

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.