Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

mysql procedure ·µ»Ø½á¹û¼¯

mysql procedure ûÓÐreturn²ÎÊý ¿ÉÒÔoutÒ»¸ö±äÁ¿¸ø¿Í»§¶Ë µ«ÊÇout²ÎÊýÓÖ²»Ö§³ÖÓαêÀàÐÍ£¬ÈçºÎÄÜout³öÒ»¸ö½á¹û¼¯ÄØ£¿
·½·¨ºÜ¼òµ¥ ¾ÍÊÇÔÚprocedureÀïÖ´ÐÐÒ»¸öselect £¨select ....  from ...£©
eg.
CREATE PROCEDURE `CREATE_ACCOUNT`(
ACCOUNT CHAR(32),
PASSWORD CHAR(32),
OUT I_RETURN_CODE INT
)
BEGIN

UPDATE
ACCOUNT
SET
Flag = 0
WHERE
Account = S_ACCOUNT;
SET I_RETURN_CODE = 1;
SELECT Flag from ACCOUNT WHERE Account = S_ACCOUNT;
END;   
ÕâÑù£¬ÔÚ¿Í»§¶Ë³ÌÐòµ÷ÓõÄÖ±½Ó»ñÈ¡½á¹û¼¯¾ÍokÁË£¬¸½Ò»¶Îjava´úÂë
Connection conn = null;
CallableStatement ps = null;
String url = "jdbc:mysql://192.168.1.13:3306/adb";
String user = "user", pass = "password";
try{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("regedit driver seccess!");
System.out.println("now,getting a connection .... ...");
conn = DriverManager.getConnection(url, user, pass);
System.out.println("getting connection seccess!");
ps = conn.prepareCall("{call CREATE_ACCOUNT(?,?,?)}");
ps.setString(1,"24ADB4E2F0");
ps.setString(2,"apassword"); e
ps.registerOutParameter(3, Types.INTEGER); //ret code
System.out.println("binding parameters seccess!");
ps.execute();
System.out.println("execute procedure seccess!");
int ret = ps.getInt(3);
ResultSet rs = ps.getResultSet(); // the result set that procedure return
if(rs != null)
{
while(rs.next())
{
System.out.println(rs.getInt(1));
}
}
conn.close();
System.out.println("closing this connection seccess!");
}
catch(Exception e)
{
System.out.println("Exception: "+e);
}


Ïà¹ØÎĵµ£º

[MySQLÓÅ»¯] ÈçºÎ¶¨Î»Ð§Âʽϵ͵ÄSQL


[MySQLÓÅ»¯] -- ÈçºÎ¶¨Î»Ð§Âʽϵ͵ÄSQL
ʱ¼ä:2010-2-28À´Ô´:HaCMS¿ªÔ´ÉçÇø ×÷Õß:zhenpao
Ò»°ãͨ¹ýÒÔÏÂÁ½ÖÖ·½Ê½¶¨Î»Ö´ÐÐЧÂÊ½ÏµÍµÄ SQL Óï¾ä¡£ Âý²éѯÈÕÖ¾ÔÚ²éѯ½áÊøÒÔºó²Å¼Í¼£¬ËùÒÔÔÚÓ¦Ó÷´Ó³Ö´ÐÐЧÂʳöÏÖÎÊÌâµÄʱºò²éѯÂý²éѯÈÕÖ¾²¢²»Äܶ¨Î»ÎÊÌ⣬¿ÉÒÔʹÓà show processlist ÃüÁî²é¿´µ±Ç° MySQL ÔÚ½øÐеÄỊ̈߳¬° ......

cmd ÃüÁîÐÐÏÂmysqlµÄ֪ʶ


*************************×Ö·û´®º¯Êý***********************************
mysql> select concat('aa','bb');//×Ö·û´®µÄÁ¬½Ó
mysql> select insert ('beijing2008you',12,3,'me');//×Ö·û´®µÄ²åÈë
+-------------------------------------+
| insert ('beijing2008you',12,3,'me') |
+----------------------- ......

MySQLÊý¾Ý±íÀàÐÍ(ij¹«Ë¾µÄÃæÊÔÌâ)

MySQLµÄÊý¾Ý±íÀàÐͺܶ࣬MySQLÒ»¹²ÏòÓû§ÌṩÁË°üÀ¨DBD¡¢HEAP¡¢ISAM¡¢MERGE¡¢MyIAS¡¢InnoDBÒÔ¼°GemeniÕâ7ÖÖ±í¡£ÆäÖÐDBD¡¢InnoDBÊôÓÚÊÂÎñ°²È«Àà±í£¬¶øÆäËûÊôÓÚÊÂÎñ·Ç°²È«Àà±í¡£
DBD
Berkeley DB(DBD)±íÊÇÖ§³ÖÊÂÎñ´¦ÀíµÄ±í£¬ÓÉSleepycatÈí¼þ¹«Ë¾¿ª·¢¡£ËüÌṩMySQLÓû§ÆÚ´ýÒѾõŦÄÜ--ÊÂÎñ¿ØÖÆ¡£ÊÂÎñ¿ØÖÆÔÚÈκÎÊý¾Ý¿âϵͳÖÐ ......

wampÈçºÎÐÞ¸ÄmysqlĬÈÏ¿ÕÃÜÂë


cmdÏÂÇл»µ½ mysql °²×°Ä¿Â¼
Àý
d:/mysql/bin
  
(Èç¹ûÓÃWAMP°²×°ÔòÊÇD:\wamp\bin\mysql\mysql5.1.30\bin)
Ç°Ì᣺mysqlÓû§rootÃÜÂëΪ¿Õ.
Êä
Èë mysql -u root mysql
mysql> ״̬ÏÂÊäÈë 
 update user set password=password('ÐÂÃÜÂë') where user='root';
ȯ
ÏÔ   
Quer ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ