2009年7月24日 星期五

LINUX下mysql区分大小写的问题

1、linuxmysql安装完后是默认:区分表名的大小写,不区分列名的大小写;

2、用root帐号登录后,在/etc/my.cnf 中的[mysqld]后添加添加lower_case_table_names=1,重启MYSQL服务,这时已设置成功:不区分表名的大小写;

lower_case_table_names参数详解:

lower_case_table_names = 0

其中 0:区分大小写,1:不区分大小写

MySQL在Linux下数据库名、表名、列名、别名大小写规则是这样的:

   1、数据库名与表名是严格区分大小写的;

   2、表的别名是严格区分大小写的;

   3、列名与列的别名在所有的情况下均是忽略大小写的;

   4、变量名也是严格区分大小写的;

MySQL在Windows下都不区分大小写。

3、如果想在查询时区分字段值的大小写,则:字段值需要设置BINARY属性,设置的方法有多种:

A、创建时设置:

CREATE TABLE T(

A VARCHAR(10) BINARY

);

B、使用alter修改:

ALTER TABLE `tablename` MODIFY COLUMN `cloname` VARCHAR(45) BINARY;

C、mysql table editor中直接勾选BINARY项。

以上內容來自 <http://database.jzxue.com/mysql/200904/30-2003.html>


PS.當啟用不區分大小寫選項時,所建立之Table Name 一律是小寫的.

2009年7月23日 星期四

MYSQL- import/export data .dmp file

#import

mysql --host=... --user=... --password=... --databases MySQL_database_name < dump_file_name

eg: in cmd c:\documents and settings mysql -uroot -ppassword -vvf DB01


#export
mysqldump --host=... --user=... --password=... --databases MySQL_database_name > dump_file_name
eg: in cmd c:\documents and settings mysqldump -uroot -ppassword -vvf DB01>db01.dmp

How to change the mysql database location


Identify the database files you wish to migrate into the new data directory
You can use the following command to list the current databases in mysql
mysqlshow -u root -p
Keep this list available as you will reference it in a later step
Shutdown the MySQL database, if it is running mysqladmin -u root -p shutdown

Locate the MySQL configuration file. This is usually located in the directory $OSS_HOME/var/mysql

Note: You should make a backup copy of each file you're editing before modifying the contents



The property you need to change is named datadir. The default value is $OSS_HOME/var/mysql, which places the database files in the same directory as the log files and other runtime generated files. This property is usually located in the [mysqld_safe] section in the configuration file

You need to change:


[mysqld_safe]
datadir = /opt/oss/var/mysql
to


[mysqld_safe]
datadir = /opt/oss/var/mysql/data



Save these changes
Create the directory you specified in the datadir property mkdir -p /optoss/var/mysql/data

Check to make sure the user assigned to execute mysql has read/write privileges on this directory
You may need to modify the directory settings using chown and chmod

Move the databases listed in the first step to the new data directory mv test /opt/oss/var/mysql/data

Note: You can use the copy (cp) command instead if you prefer. Remember to remove the copied files once the migration is complete
You will need to move/copy each database into the new data directory



After all the databases have been migrated to the new data directory, you should start MySQL openpkg rc mysql start

The database files will now be managed under the new data directory. If you encounter any problems during startup, you check the hostname.err file located in the data directory.
以上文章載自http://developer.spikesource.com/wiki/index.php/How_to_change_the_mysql_database_location

2009年7月9日 星期四

WebLogic設定session timeout時間

1. web.xml

設定Web AP serverweb.xml裏的標籤。此值以分鐘為單位,並取代weblogic.xml中的timeoutsecs屬性


24

此例子表示session將在24分鐘後timeout

設定為2,表示將使用在weblogic.xml中設定的
timeoutsecs
這個屬性值。

設定為1,表示session將永不timeout,而忽略在

weblogic.xml
中設定的timeoutsecs屬性值。

2.weblogic.xml

設定weblogic部署描述檔weblogic.xml元素的
timeoutsecs
屬性。此值以秒為單位


timeoutsecs
2600


預設值是2600

3.於jsp
中控制
session.setmaxinactiveinterval(7200);
單位秒s

4.於servlet
中控制

httpsession session = request.getsession();
session.setmaxinactiveinterval(7200);
單位秒s