Vic,
 
Just like you said.. tried jdbc., it worked
Verified the libraries.
 
Tried IBatis again... it works...
Only i do not know what made it work.
Guess .. i tried with more confidence.
 
IBatis looks really good for a O/R mapping.
 
Thank you again 
Santhi
 

-----Original Message-----
From: Vic Cekvenich [mailto:[EMAIL PROTECTED]
Sent: Friday, October 17, 2003 10:19 AM
To: [EMAIL PROTECTED]
Subject: Re: [MVC-Programmers] IBatis returns null


Just for test... try JDBC w/o DAO.
.V

Peyathevar, Santhi {PBG} wrote:


Vic,



i tried connecting to PostGres DB. It is fine.

It is only with the Oracle that i am getting nulls.

May be i should change the Oracle Driver and try tonight.



Every reply encourages to try one step further...



Thank you very much

Santhi





-----Original Message-----

From: Vic Cekvenich [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ]

Sent: Thursday, October 16, 2003 4:57 PM

To:  [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

Subject: Re: [MVC-Programmers] IBatis returns null





I use ibatis from java console applications a lot (for batch, etc.).

Here is my snipet that works:

    static {  try {

            Reader reader = 

Resources.getResourceAsReader("properties/sql-map-config.xml");

             _sqlMap = XmlSqlMapBuilder.buildSqlMap(reader);

            _sqlMap.setCurrentDataSourceName("ids");

            log.debug("we have a connection pool!");

       }

I am not sure where you might be stuck, can you put a few debugs in?

.V



Peyathevar, Santhi {PBG} wrote:



  

Vic,



1.i do not need a web app. Only, simple java app.

2.I tried both Dbcp and SimpleDataSourceFactory.

both give null. Connecting to oracle database.

I know it is connecting to the database, 

because it complains if i leave syntax errors.



************************************

This is the sample that i am trying to run - from IBatis Web site:

************************************

SqlMapConfigExample.xml



 <datasource name="basic" default = "true"



factory-class="com.ibatis.db.sqlmap.datasource.SimpleDataSourceFactory">

   <property name="JDBC.Driver" value="${driver}"/>

   <property name="JDBC.ConnectionURL" value="${url}"/>

   <property name="JDBC.Username" value="${username}"/>

   <property name="JDBC.Password" value="${password}"/>

 </datasource>



 <sql-map resource="examples/sqlmap/maps/Account.xml" />



************************************



Account.xml



 <result-map name="indexed-account-result2"

class="examples.domain.Account">

   <property name="id"           column="ACC_ID"         columnIndex="1"/>

   <property name="firstName"    column="ACC_FIRST_NAME" columnIndex="2"/>

   <property name="lastName"     column="ACC_LAST_NAME"  columnIndex="3"/>

  </result-map>



<mapped-statement name="getAccount" cache-model="account-cache"

result-map="indexed-account-result2">

   select

     ACC_ID,

     ACC_FIRST_NAME,

     ACC_LAST_NAME

   from ACCOUNT

   where ACC_ID = #value#

 </mapped-statement>



*************************************

SqlMapConfigExample.java (Don't i have to use the datasource name "basic"

anywhere ?



static

{



   Reader reader =

Resources.getResourceAsReader("examples/sqlmap/maps/SqlMapConfigExample.xml

    

"

  

);

   sqlMap = XmlSqlMapBuilder.buildSqlMap(reader);

}



***********************************

QueryForListExample.java



  SqlMap sqlMap = SqlMapConfigExample.getSqlMap();



   try 

   {

      sqlMap.startTransaction();

      Account account = (Account)

sqlMap.executeQueryForObject("getAccount", new Integer(1));

      sqlMap.commitTransaction();

   }

************************************

Sorry about the long email

Santhi

************************************



-----Original Message-----

From: Vic Cekvenich [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ]

Sent: Thursday, October 16, 2003 3:49 PM

To:  [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

Subject: Re: [MVC-Programmers] IBatis returns null





It's best to use JNDI container DataSource pools, howerver:

<datasource name="ids"

   

factory-class="com.ibatis.db.sqlmap.datasource.SimpleDataSourceFactory" 

default="true">

<property name="JDBC.Driver" value="org.postgresql.Driver"/>

<property name="JDBC.ConnectionURL" 

value="jdbc:postgresql://localhost:5432/bp?autoReconnect=true"/>

<property name="JDBC.Username" value="bpuser"/>

<property name="JDBC.Password" value="changeme"/>

</datasource>



aboove is a sample iBatis pool.

I think that was your question. From there, it is just standard iBatis.



.V



Peyathevar, Santhi {PBG} wrote:



 



    

All:



1.I am trying to use IBatis for running some SQL



   



      

>from simple java code.

 



    

2.using DbcpDataSourceFactory



3.It connects to the database but the result is null



Can anybody help?



Santhi



_______________________________________________

MVC-Programmers mailing list

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers
<http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers> 









   



      

_______________________________________________

MVC-Programmers mailing list

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers
<http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers> 

_______________________________________________

MVC-Programmers mailing list

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers
<http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers> 





 



    



_______________________________________________

MVC-Programmers mailing list

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers
<http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers> 

_______________________________________________

MVC-Programmers mailing list

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers
<http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers> 





  

_______________________________________________
MVC-Programmers mailing list
[EMAIL PROTECTED]
http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers

Reply via email to