hibernate mysqlÓ³ÉäÀàÐÍ
integer »òÕß int
int »òÕß java.lang.Integer
INTEGER
4 ×Ö½Ú
long
long Long
BIGINT
8 ×Ö½Ú
short
short Short
SMALLINT
2 ×Ö½Ú
byte
byte Byte
TINYINT
1 ×Ö½Ú
float
float Float
FLOAT
4 ×Ö½Ú
double
double Double
DOUBLE
8 ×Ö½Ú
big_decimal
java.math.BigDecimal
NUMERIC
NUMERIC(8,2)8 λ
character
char Character String
CHAR(1)
¶¨³¤×Ö·û
string
String
VARCHAR
±ä³¤×Ö·û´®
boolean
boolean Boolean
BIT
²¼¶ûÀàÐÍ
yes_no
boolean Boolean
CHAR(1) (Y-N)
²¼¶ûÀàÐÍ
true_false
boolean Boolean
CHAR(1) (T-F)
²¼¶ûÀàÐÍ
2 ¡¢ Java ʱ¼äºÍÈÕÆÚÀàÐ굀 Hibernate Ó³Éä
Ó³ÉäÀàÐÍ
Java ÀàÐÍ
±ê×¼ SQL ÀàÐÍ
ÃèÊö
date
util.Date »òÕß sql.Date
DATE
YYYY-MM-DD
time
Date Time
TIME
HH:MM:SS
timestamp
Date Timestamp
TIMESTAMP
YYYYMMDDHHMMSS
calendar
calendar
TIMESTAMP
YYYYMMDDHHMMSS
calendar_date
calendar
DATE
YYYY-MM-DD
3 ¡¢ Java ´ó¶ÔÏóÀàÐ굀 Hibernate Ó³ÉäÀàÐÍ
Ó³ÉäÀàÐÍ
Java ÀàÐÍ
±ê×¼ SQL ÀàÐÍ
MySQL ÀàÐÍ
Oracle ÀàÐÍ
binary
byte[]
VARBINARY( »ò BLOB)
BLOB
BLOB
text
String
CLOB
TEXT
CLOB
serializable
Serializable ½Ó¿ÚÈÎÒâʵÏÖÀà
VARBINARY( »ò BLOB)
BLOB
BLOB
clob
java.sql.Clob
CLOB
TEXT
CLOB
blob
java.sql.Blob
BLOB
BLOB
BLOB
ÔÚ³ÌÐòÖÐͨ¹ý Hibernate À´±£´æ java.sql.Clob »òÕß java.sql.Blob ʵÀýʱ£¬±ØÐë°üº¬Á½¸ö²½Ö裺
l ÔÚÒ»¸öÊý¾Ý¿âÊÂÎñÖÐÏȱ£´æÒ»¸ö¿ÕµÄ Blob »ò Clob ʵÀý¡£
l ½Ó×ÅËø¶¨ÕâÌõ¼Ç¼£¬¸üÐÂÉÏÃæ±£´æµÄ Blob »ò Clob ʵÀý£¬°Ñ¶þ½øÖÆÊý¾Ý»òÎı¾Êý¾Ýдµ½ Blob »ò Clob ʵÀýÖÐ
Ïà¹ØÎĵµ£º
LAST_INSERT_ID
×Ô¶¯·µ»Ø×îºóÒ»¸ö INSERT »ò UPDATE ²Ù×÷Ϊ AUTO_INCREMENT ÁÐÉèÖõĵÚÒ»¸ö·¢ÉúµÄÖµ. ²Î¿¼ÕâÀï
The ID that was generated is maintained in the server on a per-connection basis.
LAST_INSERT_IDÊÇ»ùÓÚµ¥¸öconnectionµÄ, ²»¿ÉÄܱ»ÆäËüµÄ¿Í»§¶ËÁ¬½Ó¸Ä±ä¡£
¿ÉÒÔÓà SELECT LAST_INSERT_ID(); ²éѯLAST ......
ÓÐÁ½ÖÖ·½·¨¡£
·½·¨Ò»£ºÔÚmysql>Ìáʾ·ûÖÐʹÓÃtee
mysql> tee output.txt
Logging to file 'output.txt'
mysql> notee
Outfile disabled.
»òÕß
mysql> \T output.txt
Logging to file 'output.txt'
mysql> \t
Outfile disabled.
Õâ¸öÀàËÆÓÚsqlplusµÄspool¹¦ÄÜ£¬¿ÉÒÔ½«ÃüÁîÐÐÖеĽá¹û±£´æµ½Í ......
Æô¶¯£ºnet start mySql;
¡¡¡¡½øÈ룺mysql -u root -p/mysql -h localhost -u root -p databaseName;
¡¡¡¡ÁгöÊý¾Ý¿â£ºshow databases;
¡¡¡¡Ñ¡ÔñÊý¾Ý¿â£ºuse databaseName;
¡¡¡¡Áгö±í¸ñ£ºshow tables£»
¡¡¡¡ÏÔʾ±í¸ñÁеÄÊôÐÔ£ºshow columns from tableName£»
¡¡¡¡½¨Á¢Êý¾Ý¿â£ºsource fileName.txt;
¡¡¡¡Æ¥Åä× ......
¡¡1.µ¼³öÕû¸öÊý¾Ý¿â
¡¡¡¡mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû
¡¡¡¡mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
¡¡¡¡2.µ¼³öÒ»¸ö±í
¡¡¡¡mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû ±íÃû> µ¼³öµÄÎļþÃû
¡¡¡¡mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
¡¡¡¡3.µ¼³öÒ»¸öÊý¾Ý¿â½á¹¹
¡ ......
×î½üʹÓÃrootÓû§±àдÁ˼¸¸ö´æ´¢¹ý³Ì£¬µ«ÊÇʹÓÃÆÕͨÓû§Í¨¹ýJDBCÁ¬½ÓÖ´ÐÐÈ´±¨´í£º
java.lang.NullPointerException......
»ò
java.sql.SQLException: User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configure connection with " ......