Thanks you all! It works. more questions:

Q1: how do I configure the providers? How do we set the values in the providers.config file? Or should we only use whatever ibatis provides to us?

Q2: If I don't want to use default selmap.config file, how do i specifiy in my code? Which class/function should I use?
Ex: to use default settings:
           SqlMapper sqlMapper = IBatisNet.DataMapper.Mapper.Instance();
to use "my_sql_map.config" file, how do I specify it? Is it
SqlMapper sqlMapper = SqlMapper.Configure("c:/test/my_sql_map.config");?

-Henry

Roberto R wrote:

If logging in works through SQL Plus, your tnsnames is ok. Your connection string looks ok too.

Have you tried Ron's suggestion of creating a simple console app to try to connect?

Roberto


On 2/15/06, *Henry Lu* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Do you/someone have an example of code and tnsnames.ora and sqlnet.ora
    configures for connecting to oracle database?

    I have mine as followings but they didn't work.

    string connectStr = "User Id=scott;Password=tiger;Data Source=ORCL";

    ORCL =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = my_leptop)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = orcl)
        )
      )

    I tried sqlplus with ORCL, it works fine. Do I need to set
    sqlnet.ora? How?

    -Henry

    Ron Grabowski wrote:

    >Could you post more of the exception?
    >
    >Have you verified that the Oracle.DataAccess.dll assembly works
    >correctly? Try creating a simple console app using just ADO.Net
    and the
    >Oracle.DataAccessd.dll assembly and see if you can execute a simple
    >"SELECT COUNT(*) FROM tblUsers" statement.
    >
    >--- [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> wrote:
    >
    >
    >
    >>Could someone help to run this HelloWorld program? I go the
    following
    >>errors:
    >>
    >>An unhandled exception of type
    >>'IBatisNet.DataMapper.Exceptions.DataMapperException '
    >>occurred in ibatisnet.datamapper.dll
    >>
    >>Additional information: Unable to open connection to "Oracle, oracle
    >>provider V10.1.0.301".
    >>
    >>sqlmap.config file is following:
    >>
    >><?xml version="1.0" encoding="utf-8"?>
    >><sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper
    <http://ibatis.apache.org/dataMapper>"
    >>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >
    >>      <providers embedded="Resources.Providers.config,
    HelloWorld" />
    >>      <database>
    >>              <provider name="oracle10.1"/>
    >>              <dataSource
    name="HelloWorld"              connectionString="Data
    >>Source=lu10g;User Id=scott;Password=tiger"/>
    >>      </database>
    >>      <sqlMaps>
    >>              <sqlMap embedded="Resources.OleDb.Person.xml,
    HelloWorld" />
    >>      </sqlMaps>
    >></sqlMapConfig>
    >>
    >>
    >>I am using Oracle.DataAccess.dll for provider downloaded from
    oracle
    >>site this morning.
    >>
    >>
    >>Here is my provider file:
    >>
    >><?xml version="1.0" encoding="utf-8"?>
    >><providers xmlns=" http://ibatis.apache.org/providers";
    >>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
    >><clear/>
    >><provider name=" OleDb1.1"     description="OleDb, provider
    V1.0.5000.0
    >>in
    >>framework .NET V1.1"  enabled="true"
    >>      assemblyName="System.Data, Version=1.0.5000.0,
    Culture=neutral,
    >>PublicKeyToken=b77a5c561934e089"
    >>connectionClass="System.Data.OleDb.OleDbConnection"
    >>      commandClass="System.Data.OleDb.OleDbCommand"
    >>      parameterClass=" System.Data.OleDb.OleDbParameter"
    >>      parameterDbTypeClass="System.Data.OleDb.OleDbType"
    >>      parameterDbTypeProperty="OleDbType"
    >>      dataAdapterClass="System.Data.OleDb.OleDbDataAdapter "
    >>      commandBuilderClass="System.Data.OleDb.OleDbCommandBuilder"
    >>      usePositionalParameters="true"  useParameterPrefixInSql="false"
    >>      useParameterPrefixInParameter="false"   parameterPrefix=""/>
    >><provider     name="oracle10.1"       description="Oracle,
    oracle provider
    >>V10.1.0.301"
    >>      enabled="true"  assemblyName="Oracle.DataAccess,
    Version=10.1.0.301,
    >>
    >>Culture=neutral, PublicKeyToken=89b483f429c47342"
    >>connectionClass="Oracle.DataAccess.Client.OracleConnection"
    >>      commandClass="Oracle.DataAccess.Client.OracleCommand"
    >>      parameterClass="Oracle.DataAccess.Client.OracleParameter "
    >>      parameterDbTypeClass="Oracle.DataAccess.Client.OracleDbType"
    >>      parameterDbTypeProperty="OracleDbType"
    >>      dataAdapterClass="Oracle.DataAccess.Client.OracleDataAdapter "
    >>      commandBuilderClass="Oracle.DataAccess.Client.OracleCommandBuilder"
    >>      usePositionalParameters="true"  useParameterPrefixInSql="true"
    >>      useParameterPrefixInParameter="true"    parameterPrefix=":"
    >>      useDeriveParameters="false"/>
    >></providers>
    >>
    >>-Henry
    >>
    >>Quoting Ron Grabowski <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>:
    >>
    >>
    >>
    >>>Here's a console application that calls the QueryForList method on
    >>>
    >>>
    >>a
    >>
    >>
    >>>SqlMapper object and prints out Count property of the returned
    >>>PersonCollection object:
    >>>
    >>>http://www.ronosaurus.com/IBatisNet/HelloWorld.zip
    >>>
    >>>The path the the Person.mdb file is hard-coded to C:\Person.mdb in
    >>>
    >>>
    >>the
    >>
    >>
    >>>SqlMap.config file. The program uses the Log4Net logging adapter
    >>>
    >>>
    >>and
    >>
    >>
    >>>records the sql queries sent to the database to a file called
    >>>HelloWorld.log.
    >>>
    >>>If you have any questions, try doing this tutorial:
    >>>
    >>>http://tinyurl.com/78use
    >>>
    >>>
    >>>
    >
    
http://opensource2.atlassian.com/confluence/oss/display/IBATIS/Quick+Start+Guide
    >
    >
    >>>--- Henry Lu <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
    >>>
    >>>
    >>>
    >>>>Is there one who can send me a complete console example of c#
    >>>>
    >>>>
    >>ibatis
    >>
    >>
    >>>>net
    >>>>project? I got so many errors one after another. I am not sure I
    >>>>got/downloaded  the right version for everything.
    >>>>
    >>>>-Henry
    >>>>
    >>>>
    >>>>
    >>>
    >>>
    >>>
    >>>
    >>
    >>
    >>
    >
    >
    >
    >
    >


Reply via email to