JDBCÁ¬½ÓMySQLÊý¾Ý¿âʵÏÖÔöɾ²é¸Ä
package com.qll.operate;
import java.sql.*;
public class OperateUser {
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/test";
String name = "root";
String password = "123456";
static Connection conn = null;
Statement st = null;
ResultSet rs = null;
String sql = null;
public void add() {
try {
sql = "insert into tuser values(60024054,'È«ÀÚÀÚ','ÄÐ',24,'¹ã¶«Ê¡ÉîÛÚÊÐ')";
Class.forName(driver);
conn = DriverManager.getConnection(url, name, password);
st = conn.createStatement();
st.executeUpdate(sql);
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public void delete() {
try {
sql = "delete from tuser where id=60024054 ";
Class.forName(driver);
conn = DriverManager.getConnection(url, name, password);
st = conn.createStatement();
st.executeUpdate(sql);
st.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public void find() {
try {
sql = "select * from tuser";
Class.forName(driver);
conn = DriverManager.getConnection(url, name, password);
st = conn.createStatement();
rs = st.executeQuery(sql);
while (rs.next()) {
System.out.println(rs.getInt(1) + "\t" + rs.getString(2) + "\t"
+ rs.getString(3) + "\t" + rs.getInt(4) + "\t"
+ rs.getString(5));
}
rs.close();
st.close();
&nb
Ïà¹ØÎĵµ£º
´ÓÓû§µÄ½Ç¶È¿´£¬MySQL±»SunÊÕ¹º£¬ÓÖ±»OracleÊÕ¹º¿ÉÄÜÕæ²»ÊÇʲôºÃÊ¡£MySQL±¾À´¾Í±»Oracleͨ¹ý²¢¹ºÆäÒÀÀµµÄ´æ´¢ÒýÇæInnobase¡¢BerkeleyDBÕÛÌڵIJ»ÐУ¬ÓÖÔÚ±»SunÊÕ¹ººó·¢ÉúÁËMonty´´½¨Ð·ÖÖ§MariaDBÕâÑùµÄÊÂÇ飬×îÖÕ»¹ÊÇËæ×ÅSunÒ»Æð±»Oracle²¢¹º£¬Ã»ÓÐÌÓÍÑLarry ElisonµÄħצ¡£Ò²Ðí£¬¿ªÔ´Èí¼þµÄºÃ´¦¾ÍÔÚ ......
ÓÃÔÚSELECTºÍWHERE×Ó¾äµÄº¯Êý
--------------------------------------------------------------
1 ·Ö×麯Êý
( ... ) À¨ºÅ¡£Ê¹ÓÃËüÃÇÀ´Ç¿ÖÆÔÚÒ»¸ö±í´ïʽµÄ¼ÆËã˳Ðò¡£
--------------------------------------------------------------
2 ³£ÓõÄËãÊõÔËËã
£¨+ - * /£©
Ò»°ãµÄË ......
Èç¹ûÄãËÑË÷GOOGLE£¬Äã»áÕÒµ½ºÜ¶à¹ØÓÚmysqlµÄËæ»úÊý£¬ËûÃÇ»áÕâÑù˵
Éú³É£³£¬£¶Ö®¼äµÄËæ»úÕûÊý
FLOOR(3 + (RAND() * 6))
ÔÚ4ºóÃæÌí¼ÓÒ»¸ö3µ½6Ö®¼äµÄÕûÊý
CONCAT(343,FLOOR(3 + (RAND() * 6)))
ÔÚijһ×ֶκóÃæÌí¼Óһλ£³£¬£¶Ö®¼äµÄÕûÊý
UPDATE test SET xx= CONCAT(xx,FLOOR(3 +(RAND() * 6)));
µ«ÊÇÎÒ˽×Ô²âÊÔÁËһϣ¬ ......
MySQL ODBC connection strings
Open connection to local MySQL database using MySQL ODBC 3.51 Driver
"Provider=MSDASQL; DRIVER={MySQL ODBC 3.51Driver}; SERVER= localhost; DATABASE=Your_MySQL_Database; UID= Your_Username; PASSWORD=Your_Password; OPTION=3"
MySQL OLE DB & OleDbConnection (.NET fr ......
http://www.mysql.cn/
ÊÂÎñ£¬²ÎÊý£¬Ç¶Ì×µ÷Óã¬Óα꣬ѻ·, ´¥·¢Æ÷£¬ÊÓͼ£¬Ô¼Êø, Ë÷Òý£¬¡£¡£¡£
1. ´´½¨ÊµÀýÊý¾Ý¿â
create database db5;
use db5;
2.´´½¨Ò»¸ö¼òµ¥µÄ¹¤×÷±í,²¢²åÈëÊý¾Ý
create table t(s1 int);
insert into t values(5);
3.´´½¨³ÌÐòʵÀý crea ......