From user-java-return-15478-apmail-ibatis-user-java-archive=ibatis.apache.org@ibatis.apache.org Thu Oct 23 19:43:25 2008 Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 99864 invoked from network); 23 Oct 2008 19:43:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Oct 2008 19:43:25 -0000 Received: (qmail 4286 invoked by uid 500); 23 Oct 2008 19:43:27 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 4271 invoked by uid 500); 23 Oct 2008 19:43:27 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 4260 invoked by uid 99); 23 Oct 2008 19:43:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2008 12:43:27 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ashish.kulkarni13@gmail.com designates 209.85.132.245 as permitted sender) Received: from [209.85.132.245] (HELO an-out-0708.google.com) (209.85.132.245) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2008 19:42:15 +0000 Received: by an-out-0708.google.com with SMTP id d26so52009and.110 for ; Thu, 23 Oct 2008 12:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=yU5qtcDXJcRK8TlwTh9O/tir/7rTUTTaIh1tF+UsXfc=; b=G5EP8XrjnzV+1QPyjMttn5ekqNHi9EJCWNbyeK6A/jRs+qjMCnlF42sBmc/CDy50Fd X5xb2AxzE+AhPPpr3rPYgHyecLZ8dle4yUUdZjDjgFEY0Fp8XGTwQdrGvnG+8eZ2Emxk 5tk3EqZahPAish62RtCE44+A1B9XbDaf01HUE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=D7aDwqT5ZhoYMoRCQByHg224D2sfjsGB8SWTHykCvzx30lnXooYtRUsLyd0kZ5IdEK lGUKORbd+5NoH7esUsuqezP1qPjOHawugv4Bbzntnaw0CHeZnYpxlngXAM4AuPxgvdtJ Pc4oWGK+rDYTh4aqjQTy4fAF2jUs6cCA8wgW0= Received: by 10.143.35.4 with SMTP id n4mr552763wfj.64.1224790972843; Thu, 23 Oct 2008 12:42:52 -0700 (PDT) Received: by 10.142.192.2 with HTTP; Thu, 23 Oct 2008 12:42:52 -0700 (PDT) Message-ID: <878c6f8e0810231242i4adba114gcc4d31820ca133a3@mail.gmail.com> Date: Thu, 23 Oct 2008 15:42:52 -0400 From: "Ashish Kulkarni" To: user-java@ibatis.apache.org Subject: Issue with creating SqlMapClient using Properties object MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_32598_22053799.1224790972839" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_32598_22053799.1224790972839 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline HiI am trying to create SqlMapClient using Properties object I am getting following error, please see my code below Exception in thread "main" java.lang.NullPointerException at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:782) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:154) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:883) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:622) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95) Properties prop = new Properties(); prop.setProperty("url", "jdbc:as400:myas400/EXTDB6301;naming=system;date format=iso;time format=hms;prompt=false"); prop.setProperty("driver", "com.ibm.as400.access.AS400JDBCDriver"); prop.setProperty("username", "userid"); prop.setProperty("password", "password"); String resource = "com/ashishk/test/sql/SQLMapConfigWeb.xml"; Reader reader = Resources.getResourceAsReader(resource); SqlMapClient sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader, prop); Map map = new Hashtable(); map.put("SYSTEM", "system"); map.put("AS400USER", "user"); map.put("ENVNAME", "MAPS6305F3"); map.put("P204PORD", 10000122); List poDataList = sqlMapClient.queryForList("getPOData",map); My SQLMapConfigWeb.xml is as below What may be issue, when i create SqlMapClient using Properties file, it works, but for some reason when i use Properties object i dont get connection Ash ------=_Part_32598_22053799.1224790972839 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi
I am trying to create SqlMapClient using Properties object
I am getting following error, please see my code below

Exception in thread "main" java.lang.NullPointerException
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:782)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:154)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:883)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:622)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95)

        Properties prop = new Properties();
        prop.setProperty("url", "jdbc:as400:myas400/EXTDB6301;naming=system;date format=iso;time format=hms;prompt=false");
        prop.setProperty("driver", "com.ibm.as400.access.AS400JDBCDriver");
        prop.setProperty("username", "userid");
        prop.setProperty("password", "password");
        
        String resource = "com/ashishk/test/sql/SQLMapConfigWeb.xml";
        Reader reader = Resources.getResourceAsReader(resource);
        
        SqlMapClient sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader, prop);
        
        Map map = new Hashtable();
map.put("SYSTEM", "system");
map.put("AS400USER", "user");
map.put("ENVNAME", "MAPS6305F3");
map.put("P204PORD", 10000122);
        List poDataList =  sqlMapClient.queryForList("getPOData",map);

My SQLMapConfigWeb.xml is as below

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
<sqlMapConfig>
    <sqlMap resource="com/ashishk/test/sql/PODataExternalTable.xml" />
 </sqlMapConfig>

What may be issue, when i create SqlMapClient using Properties file, it works, but for some reason when i use Properties object i dont get connection

Ash

------=_Part_32598_22053799.1224790972839--