mysql´æ´¢¹ý³Ì
1¡¢Ð½¨±ítest create table test1( field1 int not null ) ENGINE=MyISAM DEFAULT CHARSET=gbk; insert into test1(field1) values(1); 2¡¢É¾³ýÒÑ´æÔڵĴ洢¹ý³Ì -- ɾ³ý´¢´æ¹ý³Ì delimiter // -- ¶¨Òå½áÊø·ûºÅ drop procedure p_test; 3¡¢mysql´æ´¢¹ý³Ì¶¨
1¡¢Ð½¨±ítest
create table test1(
field1 int not null
)
ENGINE=MyISAM DEFAULT CHARSET=gbk;
insert into test1(field1) values(1);
2¡¢É¾³ýÒÑ´æÔڵĴ洢¹ý³Ì
-- ɾ³ý´¢´æ¹ý³Ì
delimiter // -- ¶¨Òå½áÊø·ûºÅ
drop procedure p_test;
3¡¢mysql´æ´¢¹ý³Ì¶¨Òå
create procedure p_test(in temp int,out cc int)
begin
insert into test1 values(temp);
set cc=6;
end
4¡¢µ÷Ó÷½·¨
CallableStatement cStmt = conn.prepareCall("{call p_test()}");
cStmt.executeUpdate();
5. CallableStatement ÓÃÀ´µ÷Óô洢¹ý³Ì(Á˽â)
ÔÚ JDBC Öе÷ÓÃÒÑ´¢´æ¹ý³ÌµÄÓï·¨ÈçÏÂËùʾ¡£×¢Ò⣬·½À¨ºÅ±íʾÆä¼äµÄÄÚÈÝÊÇ¿ÉÑ¡Ï·½À¨ºÅ±¾Éí²¢²»ÊÇÓï·¨µÄ×é³É²¿·Ý¡£
{call ¹ý³ÌÃû[(?, ?, ...)]}
·µ»Ø½á¹û²ÎÊýµÄ¹ý³ÌµÄÓ﷨Ϊ£º
{? = call ¹ý³ÌÃû[(?, ?, ...)]}
²»´ø²ÎÊýµÄÒÑ´¢´æ¹ý³ÌµÄÓï·¨ÀàËÆ£º
{call ¹ý³ÌÃû}
ʾÀý´úÂ룺
String procedure="{call Operator_login(?,?,?)}";
//×¢²á´æ´¢¹ý³Ì
CallableStatement callStmt=conn.prepareCall(procedure);
//×¢²á´æ´¢¹ý³ÌÊä³ö²ÎÊýµÄÀàÐÍ
callStmt.registerOutParameter(3,java.sql.Types.INTEGER);
//ÌṩÊäÈë²ÎÊýµÄÖµ
callStmt.setString(1,this.operatorID);
callStmt.setString(2,this.password);
//Ö´Ðд洢¹ý³Ì
callStmt.execute();
//·µ»ØÊä³ö²ÎÊý
login_state=callStmt.getInt(3);
CallableStatement cs = conn.prepareCall("{call ec_get_cust_terms(?)}");
cs.setInt(1, cus
Ïà¹ØÎĵµ£º
Ê×ÏÈÈ¥MySQL¹ÙÍøÏÂÔØMySQL connector/C++
http://dev.mysql.com/downloads/connector/cpp/1.0.html
ÏÂÔصڶþ¸ö°ü£¬windows32λ·Ç°²×°°æ£¨¸öÈ˾õµÃÕâ¸ö°ü¸É¾»£©¡£Ä¿Ç°µÄ°æ±¾ÊÇConnector/C++ 1.0.5¡£
Windows (x86, 32-bit), ZIP Archive
(mysql-connector-c++-noinstall-1.0.5-win32.zip)
½«Õû¸ö°ü½âѹµ½ÏîÄ¿Îļþ¼Ðϵ ......
MySQLÖÐÓÃselectʵÏÖTOP N¹¦ÄÜ
ÏÈ˵¼¸¸ö¹Ø¼ü×Ö£º
distinct ·µ»Ø²»Öظ´µÄ¶àÁÐ
count() ¼ÆÊý
limit m,n µÚm¸öÆðn¸ö
ÄÇô£¬Èç¹ûÐèÒª²éÕÒÃûΪcolµÄijһ¸öÁеÄTop N£¬²¢Áгö¶ÔÓ¦µÄÖµµÄselectÓï¾ä¾ÍÈçÏ£º
select dinstinct(col),count(col) from tablename group by 1 order  ......
mysql·þÎñÆ÷°²×°ÅäÖãº
1. sudp apt-get install mysql-server-5.0
2. ´´½¨¿âsecond_proxy, ΪsecProxyÌí¼ÓÓû§£ºgrant all privileges on second_proxy.* to secProxy@'%' identified by 'passwd';
3. ÉèÖÃmysql.user±íÈçÏ£º
+-----------+------------------+-------------------------------------------+
| Host& ......
mysql ibdata1ÎļþµÄËõС(2009-12-22 15:29:46)
±êÇ©£ºit
mysql ibdata1´æ·ÅÊý¾Ý£¬Ë÷ÒýµÈ£¬ÊÇMYSQLµÄ×îÖ÷ÒªµÄÊý¾Ý¡£
Èç¹û²»°ÑÊý¾Ý·Ö¿ª´æ·ÅµÄ»°£¬Õâ¸öÎļþµÄ´óСºÜÈÝÒ×¾ÍÉÏÁËG£¬ÉõÖÁ10+G¡£¶ÔÓÚijЩӦÓÃÀ´Ëµ£¬²¢²»ÊÇÌ«ºÏÊÊ¡£Òò´ËÒª°Ñ´ËÎļþËõС¡£
·½·¨£ºÊý¾ÝÎļþµ¥¶À´æ·Å¡£
²½Ö裺
1£¬±¸·ÝÊý¾Ý¿â
......
½â¾ömysql“Access denied for user
ÎÒµÄϵͳÊÇubuntu6.06£¬×î½üÐÂ×°ºÃµÄmysqlÔÚ½øÈëmysql¹¤¾ßʱ£¬×ÜÊÇÓдíÎóÌáʾ:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ʹÓÃÍøÉϽéÉܵķ½·¨ÐÞ¸ÄrootÓû§µÄÃÜÂ룺
# mysqladmin -uroot -p p ......