KK

Kim-'s-Blog.Object-Everything.I'm POJO.

.紀-錄.爲了忘卻的記憶..真的勇士,要敢于直面遇到的問題,敢于正視繁雜的原碼......在實踐中積累!

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  74 Posts :: 1 Stories :: 70 Comments :: 0 Trackbacks

#

Spring JDBC 很好用。
-------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
 <bean id="dataSource"
  class="org.springframework.jdbc.datasource.DriverManagerDataSource"
  abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
 <property name="driverClassName"><value>oracle.jdbc.OracleDriver</value></property>
 <property name="url"><value>jdbc:oracle:thin:@10.240.144.11:1521:XYMES</value></property>
 <property name="username"><value>reel</value></property>
 <property name="password"><value>reel</value></property>
 </bean>
</beans>
------------------------------------
package com.kim.spring;
import java.util.List;

import javax.sql.DataSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

public class Test
{

 /**
  * @param args
  */
 public void aMethod()throws Exception
 { 
  ApplicationContext ac=new FileSystemXmlApplicationContext("F:\\kim\\kimjob\\springkim\\src\\applicationContext.xml");
  DataSource dataSource=(DataSource)ac.getBean("dataSource");
  JdbcTemplate jt=new JdbcTemplate(dataSource);
  List l= jt.queryForList("select * from abc");
  System.out.println(l.get(0).toString());
  System.out.println(l.get(0));
  int i= jt.update("update abc set bb='8'");
  System.out.println(i);
  
 }
 public static void main(String[] args)
 {
  // TODO Auto-generated method stub
  Test t=new Test();
  try
  {
   t.aMethod();
  } catch (Exception e)
  {
   // TODO: handle exception
   e.printStackTrace();
  }
 }
}
---------------------------------
结果:
log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
log4j:WARN Please initialize the log4j system properly.
{AA=2, BB=8, CC=2}
1

posted @ 2007-01-11 17:21 Kim' 阅读(2281) | 评论 (0)编辑 收藏

 Exp時遭遇 EXP-00008 ORA-00942 EXP-00024 EXP-00000

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user QCSYSTEM
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user QCSYSTEM
EXP-00008: ORACLE error 942 encountered
ORA-00942: table or view does not exist
EXP-00024: Export views not installed, please notify your DBA
EXP-00000: Export terminated unsuccessfully

是沒有乾淨升級至9204所至!
重新運行catexp.sql 解決。

The export views are not correctly installed. Try doing this:
run following script:
1).Login in as sys user.

2).run the $ORACLE_HOME/rdbms/admin/catexp.sql file. This will recreate all your exp related views.

3).run the exp again.

This will resolve issue.

posted @ 2007-01-10 09:36 Kim' 阅读(2469) | 评论 (0)编辑 收藏

.$ORACLE_HOME//network/log/下的listener.log写爆了你的listener就用不了
出错
'ORA-12516: TNS: 监听程序无法找到匹配协议栈的可用句柄'
解决:清理该文件。
posted @ 2007-01-05 16:46 Kim' 阅读(787) | 评论 (0)编辑 收藏

解决办法:
1.确认正确设置了tomcat_home 和ant_home环境变量
2.copy $tomcat_home\server\lib\catalina-ant.jar 到 $ant_home\lib目录下即可。
posted @ 2007-01-05 13:52 Kim' 阅读(4333) | 评论 (2)编辑 收藏

CJQ0进程失效,首先设置JOB_QUEUE_PROCESSES为0,Oracle会杀掉CJQ0及相应job进程
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 0;

等2~3分钟,重新设置

SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 5;

此时PMON会重起CJQ0进程
-----------------------------------
若为Oracle 9.2.0.3可能有Bug ,升到9.2.0.4,9.2.0.6就OK了。

posted @ 2007-01-03 10:28 Kim' 阅读(2901) | 评论 (0)编辑 收藏

当用startup mount启动数据库,报ORA-01991,密码文件错时,可用以下方法之一解决:
1、重新生成新的密码配置文件(推荐)
orapwd file=/oracle/app/product/9.2.0/dbs/orapwYOUSID password=YOUR_SYS_PASSWORD entries=YOUR_MAX_DBAS
2、用initYOUSID方式启动数据库
修改以下参数后,重启数据库
remote_login_passwordfile=noe
posted @ 2007-01-02 17:03 Kim' 阅读(382) | 评论 (0)编辑 收藏

     摘要: ※※※※Mysql 初级解读(所用版本: 4.1.10 ) ※※※※※※※ 安装注意事项 ...  阅读全文
posted @ 2007-01-02 16:51 Kim' 阅读(256) | 评论 (0)编辑 收藏

Hibernate 配置
<hibernate-configuration>

    <session-factory>
        <!-- properties -->
        <property name="connection.datasource">java:comp/env/jdbc/REEL1</property>
        <property name="show_sql">true</property>

        <property name="dialect"></property>


        <!-- mapping files -->
        <mapping resource="com/gecs/steel/SIntro.hbm.xml"/>
        <mapping resource="com/gecs/steel/SStore.hbm.xml"/>

    </session-factory>

</hibernate-configuration>

-------------------------------------------------------
Tomcat 的Server.xml
<Resource name="jdbc/REEL1" auth="Container" type="javax.sql.DataSource"/>
 <ResourceParams name="jdbc/REEL1">
   <parameter>
     <name>factory</name>
     <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
   </parameter>
   <parameter>
     <name>driverClassName</name>
     <value>oracle.jdbc.driver.OracleDriver</value>
   </parameter>
   <parameter>
     <name>url</name>
     <value>jdbc:oracle:thin:@10.240.144.16:1521:SMT</value>
   </parameter>
   <parameter>
     <name>username</name>
     <value>smtuser</value>
   </parameter>
   <parameter>
     <name>password</name>
     <value>smtmanager</value>
   </parameter>
   <parameter>
     <name>maxActive</name>
     <value>100</value>
   </parameter>
   <parameter>
     <name>maxIdle</name>
     <value>60</value>
   </parameter>
   <parameter>
     <name>maxWait</name>
     <value>10000</value>
     </parameter>
   <parameter>
     <name>removeAbandoned</name>
     <value>true</value>
   </parameter>
     <parameter>
       <name>logAbandoned</name>
       <value>false</value>
     </parameter>
            <parameter>
       <name>removeAbandonedTimeout</name>
       <value>1</value>
     </parameter>
   </ResourceParams>

posted @ 2006-12-22 09:57 Kim' 阅读(322) | 评论 (0)编辑 收藏

一、Axis安装

    1、环境 J2SE SDK 1.3 or 1.4:我使用 1.4.2
    Servlet Container:我使用的Tomcat 5.0

  2、到 http://ws.Apache.org/axis/ 网站下载Axis安装包

  3、解压缩安装包,
              将Axis UNZIP_PATH\Axis-version\webapps下的Axis包拷贝到 
              TOMCAT_HOME\webapps\下,以下约定Axis_HOME为该TOMCAT_HOME\webapps\axis目录

  4、启动tomcat, 访问http://localhost:8080/axis 检查安装是否成功,本機為http://localhost:7777/axis

  5、以上步骤执行成功,可以开发webservice例子了

二、编写DII(Dynamic Invocation Interface )方式web服务

  1.编写服务端程序SayHello.java

        public class SayHello {
            public String getName(String name) {
                return "hello "+name;
            }
        }
        2、将源码拷贝到Axis_HOME下,重命名为SayHello.jws

  3、访问连接http://localhost:7777/axis/SayHello.jws?wsdl,页面显示Axis自动生成的wsdl

  4、编写访问服务的客户端 SayHelloClient.java
        import org.apache.axis.client.Call;
        import org.apache.axis.client.Service;
        import javax.xml.namespace.QName;
        import javax.xml.rpc.ServiceException;
        import java.net.MalformedURLException;
        import java.rmi.RemoteException;

        public class SayHelloClient {
            public static void main(String[] args) {
                try {
                    String endpoint = "http://localhost:7777/axis/SayHello.jws";
                    Service service = new Service();
                    Call call = null;
                    call = (Call) service.createCall();
                    call.setOperationName(new QName("http://localhost:7777/axis/SayHello.jws",
                    "getName"));
                    call.setTargetEndpointAddress(new java.net.URL(endpoint));
                    String ret = (String) call.invoke(new Object[] {"Kim"});
                    System.out.println("return value is " + ret);
                }
                catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
5.運行該Java文件
顯示return value is hello Kim
OK!

另:
Axis支持三种web service的部署和开发,分别为:

  1、Dynamic Invocation Interface ( DII)

  2、Stubs方式

  3、Dynamic Proxy方式

posted @ 2006-12-18 14:52 Kim' 阅读(727) | 评论 (2)编辑 收藏

添加
F:\kim\kimjob\RMI>java -Djava.security.policy=policy.txt  -Djava.rmi.server.codebase=file:/f:\kim\kimjob\RMI/  XXXX
posted @ 2006-12-15 17:44 Kim' 阅读(319) | 评论 (0)编辑 收藏

仅列出标题
共8页: 上一页 1 2 3 4 5 6 7 8 下一页 
jj