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

Javaµ÷Óô洢¹ý³Ì(MySqlÊý¾Ý¿â)

Ò»¡¢½¨±í
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `ID` int(11) NOT NULL auto_increment,
  `NAME` varchar(16) NOT NULL default '',
  `REMARK` varchar(16) NOT NULL default '',
  PRIMARY KEY  (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
 
¶þ¡¢½¨Á¢´æ´¢¹ý³Ì
1¡¢»ñÈ¡Óû§ÐÅÏ¢
CREATE DEFINER=`root`@`localhost` PROCEDURE `getUserList`()
BEGIN
  select * from user;
END;
2¡¢Í¨¹ý´«Èë²ÎÊý´´½¨Óû§
CREATE DEFINER=`root`@`localhost` PROCEDURE `insertUser`(nameVar varchar(16),remarkVar varchar(16))
BEGIN
  insert into user(name,remark) values(nameVar,remarkVar);
END;
 
Èý¡¢µ÷ÓÃ
1¡¢»ñÈ¡Óû§ÐÅÏ¢
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/temp?user=root&password=root";
Connection conn = DriverManager.getConnection(url);
String proc = "call getUserList()";
CallableStatement cs = conn.prepareCall(proc);
rs = cs.executeQuery();
while(rs.next()){
    System.out.println(rs.getString(2)+" "+rs.getString(3));
}
2¡¢Í¨¹ý´«Èë²ÎÊý´´½¨Óû§
Connection conn = DriverManager.getConnection(url);
String proc = "call insertUser(?,?)";
CallableStatement cs = conn.prepareCall(proc);
cs.setString(1, "LINRZ");
cs.setString(2, "REMARK");
cs.execute();


Ïà¹ØÎĵµ£º

A simple mysql sample

#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <mysql.h>
#pragma comment(lib,"libmysql")
int _tmain(int argc, _TCHAR* argv[])
{
MYSQL* mysql;
MYSQL_RES* results;
MYSQL_ROW record;
mysql = mysql_init(NULL);
if(! ......

´´½¨mysqlʵÀý

1. ÔÚ/etc/my.cnfÖмÓÈëÒ»ÏÂÄÚÈÝ [mysqld_dev]
socket=/tmp/mysql.sock
port=3307
pid-file=/var/run/mysqld/mysqld_dev.pid
datadir=/var/lib/mysql_dev
log=/var/log/mysqld_dev.log
log-error=/var/log/mysqld_dev.err.log
user=mysql 2. ¸ù¾ÝÒÔÉÏÄÚÈÝ´´½¨Ä¿Â¼ºÍÎļþ mkdir /var/lib/mysqld_dev chown mys ......

MySQL Proxy °²×°Óë¶Áд·ÖÀëÌåÑé


Ô­×÷£ºÑîÌÎ(ÉϵÛËû°Ö)
Ò»Ö±ÏëµÈµ½BETA°æ³öÀ´ÔÙÊÔÑéµÄ£¬¿É»¹ÊǾ­²»×¡ÓÕ»ó°¢,ÏÂÎçÖÕÓÚÓÐʱ¼ä²âÊÔÒ»ÏÂÁË¡£
£¨±¾ÎIJο¼µØÖ·£ºhttp://blog.chinaunix.net/u/8111/showart.php?id=451420£©
Ò»¡¢±Ø±¸Èí¼þ£º
1¡¢LUA
   ¿ÉÒÔÈ¥LUAµÄ¹Ù·½ÏÂÔØ£ºwww.lua.org
2¡¢MySQL Proxy
   ÕâÀïÓкöà¶þ½øÖÆ°æ±¾¡£
& ......

¼Ç¼µã¶«Î÷£¬MSSQL£¬MySQL£¬.NETµÄMD5¼ÓÃÜ

 MSSQL:select Right(sys.fn_VarBinToHexStr(hashbytes('MD5', '123456')),32)
 MSSQL16λ:select Right(sys.fn_VarBinToHexStr(hashbytes('MD5', '123456')),16)
 MySQL:select md5('123456')
 .NET:string ½á¹û×Ö·û´®=System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFil ......

linuxÏÂmysqlµÄʹÓÃ


Æô¶¯mysql:  /etc/rc.d/init.d/mysql start
ÐÞ¸ÄÃÜÂë: ¸ñʽ£ºmysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë
ʹÓÃÃÜÂëµÇ¼:  mysql -u root -p
ÏÔʾÊý¾Ý¿â:  show databases;
Ñ¡ÔñÊý¾Ý¿â:  use Êý¾Ý¿âÃû;
ÏÔʾ±í:  show tables;
ÏÔʾ±í½á¹¹:  descibe ±íÃû;
Ô¶³ÌµÇ¼mysqlÐèÒª¿ªÆôÈ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ