??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美不卡视频一区,91精品1区,a√中文在线观看http://www.aygfsteel.com/yoursmile/archive/2008/07/14/214721.html姚?/dc:creator>姚?/author>Mon, 14 Jul 2008 06:19:00 GMThttp://www.aygfsteel.com/yoursmile/archive/2008/07/14/214721.htmlhttp://www.aygfsteel.com/yoursmile/comments/214721.htmlhttp://www.aygfsteel.com/yoursmile/archive/2008/07/14/214721.html#Feedback0http://www.aygfsteel.com/yoursmile/comments/commentRss/214721.htmlhttp://www.aygfsteel.com/yoursmile/services/trackbacks/214721.html//转蝲自:(x)飞扬部落~程仓库 : http://www.busfly.cn/csdn/

show databases;
show tables from db_name;

show columns from table_name from db_name;
show index from talbe_name [from db_name];

show status;
show variables;

show [full] processlist;
show table status [from db_name];

show grants for user;

除了(jin)status,processlist和grants外,其它的都可以带有like wild选项Q它可以使用SQL?%'?_'字符Q?br />
show databases like '%t';

会(x)列出所有数据库名字末尾?t'字符的数据库


当然?jin),在这些sql中,你也可以用db_name.table_name来代?table_name from db_nameq样写会(x)更简便些!

如果一个用h有一个表的Q何权限,表将不在SHOW TABLES?code>mysqlshow db_name中的输出中显C?br />

大家可能q记得describe table_name Q它实现的是与show columns from db_name.table_name一L(fng)效果

show status可以用mysqlshow --status 来得到同L(fng)效果

show status可以用mysqlshow --status 来得到同L(fng)效果

?/strong> 含义
Name 表名
Type 表的cd (ISAMQMyISAM或HEAP)
Row_format 行存储格?(固定, 动? 或压~)(j)
Rows 行数?/td>
Avg_row_length q_行长?/td>
Data_length 数据文g的长?/td>
Max_data_length 数据文g的最大长?/td>
Index_length 索引文g的长?/td>
Data_free 已分配但未用了(jin)字节?/td>
Auto_increment 下一?autoincrement(自动?Q?/td>
Create_time 表被创造的旉
Update_time 数据文g最后更新的旉
Check_time 最后对表运行一个检查的旉
Create_options ?code>CREATE TABLE一起用的额外选项
Comment 当创造表Ӟ使用的注?(或ؓ(f)什么MySQL不能存取表信息的一些信??

SHOW FIELDS?code>SHOW COLUMNS一个同义词Q?code>SHOW KEYS?code>SHOW INDEX一个同义词。你也可以用mysqlshow db_name tbl_name?code>mysqlshow -k db_name tbl_name 列出一张表的列或烦(ch)引?/p>

SHOW INDEX以非常相gODBC?code>SQLStatistics调用的格式返回烦(ch)引信息。下面的列被q回Q?

?/strong> 含义
Table 表名
Non_unique 0Q如果烦(ch)引不能包含重复?
Key_name 索引?/td>
Seq_in_index 索引中的列顺序号, ?1 开始?
Column_name 列名?
Collation 列怎样在烦(ch)引中被排序。在MySQL中,q可以有?code>AQ升? ?code>NULLQ不排序)?
Cardinality 索引中唯一值的数量。这可通过q行isamchk -a更改.
Sub_part 如果列只是部分被索引Q烦(ch)引字W的数量?code>NULLQ如果整个键被烦(ch)引?

SHOW STATUS提供服务器的状态信??code>mysqladmin extended-status一?。输出类g下面的显C,管格式和数字可以有点不同:(x)

+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| Aborted_clients | 0 |
| Aborted_connects | 0 |
| Connections | 17 |
| Created_tmp_tables | 0 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delayed_errors | 0 |
| Flush_commands | 2 |
| Handler_delete | 2 |
| Handler_read_first | 0 |
| Handler_read_key | 1 |
| Handler_read_next | 0 |
| Handler_read_rnd | 35 |
| Handler_update | 0 |
| Handler_write | 2 |
| Key_blocks_used | 0 |
| Key_read_requests | 0 |
| Key_reads | 0 |
| Key_write_requests | 0 |
| Key_writes | 0 |
| Max_used_connections | 1 |
| Not_flushed_key_blocks | 0 |
| Not_flushed_delayed_rows | 0 |
| Open_tables | 1 |
| Open_files | 2 |
| Open_streams | 0 |
| Opened_tables | 11 |
| Questions | 14 |
| Slow_queries | 0 |
| Threads_connected | 1 |
| Threads_running | 1 |
| Uptime | 149111 |
+--------------------------+--------+

上面列出的状态变量有下列含义Q?

Aborted_clients ׃客户没有正确关闭q接已经LQ已l放弃的q接数量?
Aborted_connects 试已经p|的MySQL服务器的q接的次数?
Connections 试图q接MySQL服务器的ơ数?
Created_tmp_tables 当执行语句时Q已l被创造了(jin)的隐含(f)时表的数量?
Delayed_insert_threads 正在使用的gq插入处理器U程的数量?
Delayed_writes ?code>INSERT DELAYED写入的行数?
Delayed_errors ?code>INSERT DELAYED写入的发生某些错?可能重复键?/code>)的行数?
Flush_commands 执行FLUSH命o(h)的次数?
Handler_delete h从一张表中删除行的次数?
Handler_read_first hd表中W一行的ơ数?
Handler_read_key h数字Z键读行?
Handler_read_next hdZ一个键的一行的ơ数?
Handler_read_rnd hdZ一个固定位|的一行的ơ数?
Handler_update h更新表中一行的ơ数?
Handler_write h向表中插入一行的ơ数?
Key_blocks_used 用于关键字缓存的块的数量?
Key_read_requests h从缓存读入一个键值的ơ数?
Key_reads 从磁盘物理读入一个键值的ơ数?
Key_write_requests h一个关键字块写入缓存次数?
Key_writes 一个键值块物理写入盘的次数?
Max_used_connections 同时使用的连接的最大数目?
Not_flushed_key_blocks 在键~存中已l改变但是还没被清空到磁盘上的键块?
Not_flushed_delayed_rows ?code>INSERT DELAY队列中等待写入的行的数量?
Open_tables 打开表的数量?
Open_files 打开文g的数量?
Open_streams 打开的数量(主要用于日志记蝲Q?/td>
Opened_tables 已经打开的表的数量?
Questions 发往服务器的查询的数量?
Slow_queries 要花过long_query_time旉的查询数量?
Threads_connected 当前打开的连接的数量?
Threads_running 不在睡眠的线E数量?
Uptime 服务器工作了(jin)多少U?

关于上面的一些注释:(x)

  • 如果Opened_tables太大Q那么你?code>table_cache变量可能太小?
  • 如果key_reads太大Q那么你?code>key_cache可能太小。缓存命中率可以?code>key_reads/key_read_requests计算?
  • 如果Handler_read_rnd太大Q那么你很可能有大量的查询需要MySQL扫描整个表或你有没正用键值的联结(join)?

SHOW VARIABLES昄Z?strong>MySQLpȝ变量的|你也能?code>mysqladmin variables命o(h)得到q个信息。如果缺省g合适,你能?code>mysqld启动时用命令行选项来设|这些变量的大多数。输出类g下面的显C,管格式和数字可以有点不同:(x)

+------------------------+--------------------------+
| Variable_name | Value |
+------------------------+--------------------------+
| back_log | 5 |
| connect_timeout | 5 |
| basedir | /my/monty/ |
| datadir | /my/monty/data/ |
| delayed_insert_limit | 100 |
| delayed_insert_timeout | 300 |
| delayed_queue_size | 1000 |
| join_buffer_size | 131072 |
| flush_time | 0 |
| interactive_timeout | 28800 |
| key_buffer_size | 1048540 |
| language | /my/monty/share/english/ |
| log | OFF |
| log_update | OFF |
| long_query_time | 10 |
| low_priority_updates | OFF |
| max_allowed_packet | 1048576 |
| max_connections | 100 |
| max_connect_errors | 10 |
| max_delayed_threads | 20 |
| max_heap_table_size | 16777216 |
| max_join_size | 4294967295 |
| max_sort_length | 1024 |
| max_tmp_tables | 32 |
| net_buffer_length | 16384 |
| port | 3306 |
| protocol-version | 10 |
| record_buffer | 131072 |
| skip_locking | ON |
| socket | /tmp/mysql.sock |
| sort_buffer | 2097116 |
| table_cache | 64 |
| thread_stack | 131072 |
| tmp_table_size | 1048576 |
| tmpdir | /machine/tmp/ |
| version | 3.23.0-alpha-debug |
| wait_timeout | 28800 |
+------------------------+--------------------------+

SHOW PROCESSLIST昄哪个U程正在q行Q你也能使用mysqladmin processlist命o(h)得到q个信息?br /> 如果你有process权限Q?你能看见所有的U程Q否则,你仅能看见你自己的线E?br /> ?.20 KILL句法。如果你不?code>FULL选项Q那么每个查询只有头100字符被显C出来?

SHOW GRANTS FOR user列出对一个用户必dZ重复授权的授权命令?

mysql> SHOW GRANTS FOR root@localhost;
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root''localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+



]]>
Eclipse3.4+wtp+tomcat5.5环境下配|对oracle数据库的jndi数据?/title><link>http://www.aygfsteel.com/yoursmile/archive/2008/07/09/213495.html</link><dc:creator>姚?/dc:creator><author>姚?/author><pubDate>Wed, 09 Jul 2008 00:55:00 GMT</pubDate><guid>http://www.aygfsteel.com/yoursmile/archive/2008/07/09/213495.html</guid><wfw:comment>http://www.aygfsteel.com/yoursmile/comments/213495.html</wfw:comment><comments>http://www.aygfsteel.com/yoursmile/archive/2008/07/09/213495.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/yoursmile/comments/commentRss/213495.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/yoursmile/services/trackbacks/213495.html</trackback:ping><description><![CDATA[首先在eclipse下新Z个名为jndi的动态web目;<br /> 打开其目录下的web.xml,q行配置:<br /> <br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 255);"><?</span><span style="color: rgb(255, 0, 255);">xml version="1.0" encoding="UTF-8"</span><span style="color: rgb(0, 0, 255);">?></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">web-app </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="WebApp_ID"</span><span style="color: rgb(255, 0, 0);"> version</span><span style="color: rgb(0, 0, 255);">="2.4"</span><span style="color: rgb(255, 0, 0);"> xmlns</span><span style="color: rgb(0, 0, 255);">="http://java.sun.com/xml/ns/j2ee"</span><span style="color: rgb(255, 0, 0);"> xmlns:xsi</span><span style="color: rgb(0, 0, 255);">="http://www.w3.org/2001/XMLSchema-instance"</span><span style="color: rgb(255, 0, 0);"> xsi:schemaLocation</span><span style="color: rgb(0, 0, 255);">="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">display-name</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     jndi</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">display-name</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     <br />     </span><strong><span style="color: rgb(0, 0, 255);"><span style="color: red;"><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">resource-ref</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />       </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">res-ref-name</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">jdbc/oracle</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">res-ref-name</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />       </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">res-type</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">javax.sql.DataSource</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">res-type</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />       </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">res-auth</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">Container</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">res-auth</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">resource-ref</span><span style="color: rgb(0, 0, 255);">></span></span></span></strong><span style="color: rgb(0, 0, 0);"><br />     <br />     </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">welcome-file-list</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />         </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">index.html</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />         </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">index.htm</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />         </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">index.jsp</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />         </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">default.html</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />         </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">default.htm</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />         </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">default.jsp</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">welcome-file-list</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">web-app</span><span style="color: rgb(0, 0, 255);">><br /> <br /> </span></div> <br /> 然后对server.xmlq行配置:<br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 255);"><?</span><span style="color: rgb(255, 0, 255);">xml version="1.0" encoding="UTF-8"</span><span style="color: rgb(0, 0, 255);">?></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Server</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Listener </span><span style="color: rgb(255, 0, 0);">className</span><span style="color: rgb(0, 0, 255);">="org.apache.catalina.core.AprLifecycleListener"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Listener </span><span style="color: rgb(255, 0, 0);">className</span><span style="color: rgb(0, 0, 255);">="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Listener </span><span style="color: rgb(255, 0, 0);">className</span><span style="color: rgb(0, 0, 255);">="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Listener </span><span style="color: rgb(255, 0, 0);">className</span><span style="color: rgb(0, 0, 255);">="org.apache.catalina.mbeans.ServerLifecycleListener"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">GlobalNamingResources</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Environment </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="simpleValue"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="java.lang.Integer"</span><span style="color: rgb(255, 0, 0);"> value</span><span style="color: rgb(0, 0, 255);">="30"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Resource </span><span style="color: rgb(255, 0, 0);">auth</span><span style="color: rgb(0, 0, 255);">="Container"</span><span style="color: rgb(255, 0, 0);"> description</span><span style="color: rgb(0, 0, 255);">="User database that can be updated and saved"</span><span style="color: rgb(255, 0, 0);"> factory</span><span style="color: rgb(0, 0, 255);">="org.apache.catalina.users.MemoryUserDatabaseFactory"</span><span style="color: rgb(255, 0, 0);"> name</span><span style="color: rgb(0, 0, 255);">="UserDatabase"</span><span style="color: rgb(255, 0, 0);"> pathname</span><span style="color: rgb(0, 0, 255);">="conf/tomcat-users.xml"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="org.apache.catalina.UserDatabase"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">GlobalNamingResources</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Service </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Catalina"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Connector </span><span style="color: rgb(255, 0, 0);">connectionTimeout</span><span style="color: rgb(0, 0, 255);">="20000"</span><span style="color: rgb(255, 0, 0);"> maxSpareThreads</span><span style="color: rgb(0, 0, 255);">="75"</span><span style="color: rgb(255, 0, 0);"> maxThreads</span><span style="color: rgb(0, 0, 255);">="150"</span><span style="color: rgb(255, 0, 0);"> minSpareThreads</span><span style="color: rgb(0, 0, 255);">="25"</span><span style="color: rgb(255, 0, 0);"> port</span><span style="color: rgb(0, 0, 255);">="80"</span><span style="color: rgb(255, 0, 0);"> redirectPort</span><span style="color: rgb(0, 0, 255);">="8443"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">Connector</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Connector </span><span style="color: rgb(255, 0, 0);">connectionTimeout</span><span style="color: rgb(0, 0, 255);">="-1"</span><span style="color: rgb(255, 0, 0);"> port</span><span style="color: rgb(0, 0, 255);">="8009"</span><span style="color: rgb(255, 0, 0);"> protocol</span><span style="color: rgb(0, 0, 255);">="AJP/1.3"</span><span style="color: rgb(255, 0, 0);"> redirectPort</span><span style="color: rgb(0, 0, 255);">="8443"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">Connector</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Engine </span><span style="color: rgb(255, 0, 0);">defaultHost</span><span style="color: rgb(0, 0, 255);">="localhost"</span><span style="color: rgb(255, 0, 0);"> name</span><span style="color: rgb(0, 0, 255);">="Catalina"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />       </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Realm </span><span style="color: rgb(255, 0, 0);">className</span><span style="color: rgb(0, 0, 255);">="org.apache.catalina.realm.UserDatabaseRealm"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br />       </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Host </span><span style="color: rgb(255, 0, 0);">appBase</span><span style="color: rgb(0, 0, 255);">="webapps"</span><span style="color: rgb(255, 0, 0);"> name</span><span style="color: rgb(0, 0, 255);">="localhost"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />           </span><strong><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Context </span><span style="color: rgb(255, 0, 0);">docBase</span><span style="color: rgb(0, 0, 255);">="jndi"</span><span style="color: rgb(255, 0, 0);"> path</span><span style="color: rgb(0, 0, 255);">="/jndi"</span><span style="color: rgb(255, 0, 0);"> reloadable</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);"> source</span><span style="color: rgb(0, 0, 255);">="org.eclipse.jst.j2ee.server:jndi"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />               </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">Resource<br />               </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="jdbc/oracle"</span><span style="color: rgb(255, 0, 0);"><br />               type</span><span style="color: rgb(0, 0, 255);">="javax.sql.DataSource"</span><span style="color: rgb(255, 0, 0);"><br />               driverClassName</span><span style="color: rgb(0, 0, 255);">="oracle.jdbc.driver.OracleDriver"</span><span style="color: rgb(255, 0, 0);"><br />               password</span><span style="color: rgb(0, 0, 255);">="tiger"</span><span style="color: rgb(255, 0, 0);"><br />               maxIdle</span><span style="color: rgb(0, 0, 255);">="2"</span><span style="color: rgb(255, 0, 0);"><br />               maxWait</span><span style="color: rgb(0, 0, 255);">="5000"</span><span style="color: rgb(255, 0, 0);"><br />               username</span><span style="color: rgb(0, 0, 255);">="scott"</span><span style="color: rgb(255, 0, 0);"><br />               url</span><span style="color: rgb(0, 0, 255);">="jdbc:oracle:thin:@localhost:1521:guitar"</span><span style="color: rgb(255, 0, 0);"><br />               maxActive</span><span style="color: rgb(0, 0, 255);">="4"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br />           </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">Context</span><span style="color: rgb(0, 0, 255);">></span></strong><span style="color: rgb(0, 0, 0);"><br />       </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">Host</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">Engine</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">Service</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">Server</span><span style="color: rgb(0, 0, 255);">></span></div> <br /> 最后写一个名为test.jsp的测试页?br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);"><%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">@ page language</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">java</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> import</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">java.util.*</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> pageEncoding</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">utf-8</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);"><%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">@ page import</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">java.sql.*</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);"><%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">@ page import</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">javax.sql.*</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);"><%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">@ page import</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">javax.naming.*</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%></span><span style="color: rgb(0, 0, 0);"><br /> </span><strong><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);"><%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">!final </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">String</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> JNDINAME </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">java:comp/env/jdbc/oracle</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%></span></strong><span style="color: rgb(0, 0, 0);"><br /> </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);"><%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />     Connection conn </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">null</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br />     try {<br />         </span><strong><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> 初始化查扑֑名空?br />         Context ctx </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> InitialContext();<br />         </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> 扑ֈDataSource<br />         DataSource ds </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span></strong><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><strong> (DataSource) ctx.lookup(JNDINAME);</strong><br />         conn </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> ds.getConnection();<br />         Statement st </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> conn.createStatement();<br />         ResultSet rs </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> st.executeQuery(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">select * from emp</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br />         </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">while</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> (rs.next()) {<br />             </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">int</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> size </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> rs.getMetaData().getColumnCount();<br />             </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">for</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> (</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">int</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> i </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">1</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">; i </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> size; i</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">++</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">) {<br />                 out.println(rs.getString(i) </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">+</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br/></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br />             }<br />         }<br /> <br />     } catch (Exception e) {<br />         System.out.println(e);<br />     }<br /> </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);"><%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">conn</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);"><%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />     </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> 连接重新放回到池中<br />     conn.close();<br /> </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%></span></div> <br /> x,配置对oracle的jndi数据源已l列出相x重要的配|代?需要注意的?必须在项目中导入相对应的数据库驱动jar?本例子中导入<strong>ojdbc14.jar</strong>.需要注意的是代码中加粗部分,可能需要根据你的实际情冉|所改变,<span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><strong>JNDINAME</strong></span>的名字是一一对应?server.xml的配|有许多Ҏ(gu),q里׃一一l述,|上例子很多.<br /> <br /> 本h水^有限,Ƣ迎高手和我交流批评^_^<br /> <br /> <img src ="http://www.aygfsteel.com/yoursmile/aggbug/213495.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/yoursmile/" target="_blank">姚?/a> 2008-07-09 08:55 <a href="http://www.aygfsteel.com/yoursmile/archive/2008/07/09/213495.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ѯ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ʤ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Խ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϸ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">٤ʦ</a>| <a href="http://" target="_blank">ؼ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ͻ</a>| <a href="http://" target="_blank">ͷ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ϴ</a>| <a href="http://" target="_blank">躣</a>| <a href="http://" target="_blank">ǿ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̫</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">½</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ˮ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>