There are different versions of "userId":

 userId=sysdba;
 user id=SYSDBA;

Which one is correct?

I noticed that the normal ADO version (FbConnection) is accessing the
file at this location:

 C:\Program Files\Firebird\Firebird_1_5\examples\EMPLOYEE.FDB;

While the IBatis one is trying to connect to this file:

 C:\WebSites\WebSite1\DB\EMPLOYEE.FDB;

In your iMapper.vb file, you may be able to reduce most of the code in
that class to just:

 IBatisNet.DataMapper.Mapper.Instance();

That will automatically call Configure against the SqlMap.config if it
hasn't already been called. 

To reply to the list, just send an email to:

 ibatis-user-cs@incubator.apache.org

I check the list often.

- Ron

--- Sunil Sreedharan <[EMAIL PROTECTED]> wrote:

> Hi Ron Grabowski, Roberto,
> Thanks for your replies.
> 
> I am sorry I am making this post direct to your mail
> Id's. I could not figure out, how to continue the
> thread from the mailing list.
> 
> Firstly I am using FireBird Super Server.
> 
> Regarding the Exception that you are getting, I think
> the source code that I have posted below should help
> you out. I did get various Exceptions. Commenting out
> lines in SqlMap.config reduced them to the login
> failed error.
> 
> I have not yet tested the code after making the
> changes to iBatis source. Will keep you posted once I
> do that.
> 
> Hope the source code below helps you in understanding
> the problem. Thanks for your help once again.
> 
> Regards
> Sunil
> 
> Source Code Below
> ******************
> ********************************
> FBTest_aspx.vb
> ********************************
> Imports FirebirdSql.Data.Firebird
> Imports IBatisNet.DataMapper
> 'The imports were referenced initial at the project
> level
> 'Later I moved the Firebird DLL to the GAC.
> Partial Class FBTest_aspx
>     'Private con As FbConnection
> 
>       Private Sub Page_Load(ByVal sender As Object, ByVal e
> As System.EventArgs) Handles Me.Load
>       Dim newItem As ListItem        
>       'The code in comments works perfectly well
>       'con = New FbConnection
>         'con.ConnectionString = "DataSource=localhost;
> database=C:\Program
> Files\Firebird\Firebird_1_5\examples\EMPLOYEE.FDB;
> userId=sysdba; password=masterkey"
>         'con.Open()
>         'Label1.Text = con.State.ToString
>         'Dim comm As New FbCommand
> 
>         'comm.CommandText = "Select * from Customer"
>         'comm.Connection = con
>         'Dim myReader As FbDataReader
>         'myReader = comm.ExecuteReader
>         
> 
>         'While myReader.Read()
>         '    newItem = New ListItem
>         '    newItem.Text =
> myReader("CONTACT_FIRST").ToString & " " &
> myReader("CONTACT_LAST").ToString
>         '    newItem.Value =
> myReader("CUST_NO").ToString
>         '    ListBox1.Items.Add(newItem)
>         '    DropDownList1.Items.Add(newItem)
>         '    newItem = Nothing
>         'End While
>         'myReader.Close()
> 
>         
>       'This is the part that uses iBatis
>       Dim list As IList =
> iMapper.Instance.QueryForList("GetCustomer", Nothing)
>         Dim i As Integer
>         For i = 0 To list.Count - 1
>             newItem = New ListItem
>             newItem.Text = CType(list.Item(i), String)
>             DropDownList1.Items.Add(newItem)
>         Next
>     End Sub
> End Class
> 
> 
> ***************************
> iMapper.vb
> ***************************
> Imports IBatisNet.Common.Utilities
> Imports IBatisNet.DataMapper
> Public Class iMapper
>     Private Shared _mapper As SqlMapper
> 
>     Protected Shared Sub Configure(ByVal obj As
> Object)
>         _mapper = CType(obj, SqlMapper)
>     End Sub
> 
>     Protected Shared Sub InitMapper()
>         Dim handler As ConfigureHandler = New
> ConfigureHandler(AddressOf Configure)
>         _mapper = SqlMapper.ConfigureAndWatch(handler)
>     End Sub
> 
> 
>     Public Shared Function Instance() As SqlMapper
>         If _mapper Is Nothing Then
>             InitMapper()
>         End If
>         Return _mapper
>     End Function
> End Class
> 
> 
> ****************************
> Employee.xml
> *****************************
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> 
> <sqlMap namespace="Item"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
>       xsi:noNamespaceSchemaLocation="SqlMap.xsd">
>       <statements>    
>               <select id="GetCustomer" resultClass="String"> <!--
> use this for FB testing -->
>                       select cust_no from CUSTOMER            
>               </select>
>               <select id="GetCustomer1" resultClass="String"> <!--
> use this for SQL Server testing -->
>                       select emp_id from employee             
>               </select>
>       </statements>
> </sqlMap>
> 
> 
> *******************************************
> sqlMap.config
> ********************************************
> <?xml version="1.0" encoding="utf-8"?> 
> <sqlMapConfig 
>  
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
> 
>       <!-- <properties
> resource="Maps/sqlMapConfig.properties" /> 
> This line if uncommened throws an error that there is
> an error in line 1 column 1. It did not work for SQL
> Server also
> -->
>       <settings>
>               <setting useFullyQualifiedStatementNames="false"/>
>               <setting cacheModelsEnabled="true"/>
>       </settings>
> <!--  <providers file="providers.config"/> 
>       Commenting on uncommenting this line seemed to have
> no effect at all. I guess the provider is picked up
> differently.
> -->
>       
>       <database>
> <!-- Connection for SQL Server -->
>               <!-- <dataSource name="abc" default="true"
>               connectionString="
>               user id=sa;
>               password=;
>               data source=localhost\HOME;
>               database=PUBS;
>               connection reset=false;
>               connection lifetime=5;
>               min pool size=1;
>               max pool size=50"/> -->
>               
>               <dataSource name="abc" default="true"
> <!-- Connection for FireBird -->
> <dataSource name="firebird1.7"default="true"
>               connectionString="
>               user id=SYSDBA;
>               password=masterkey;
>               data source=localhost;
>               database=C:\WebSites\WebSite1\DB\EMPLOYEE.FDB;
>               connection reset=false;
>               connection lifetime=5;
>               min pool size=1;
>               max pool size=50"/>
>               
>       </database>
>       <sqlMaps>
>               <sqlMap resource="Maps/Employee.xml"/>
>       </sqlMaps>
> </sqlMapConfig>
> 
> 
> **********************************
> sqlMapConfig.properties
> **********************************
> datasource=localhost\HOME
> database=PUBS
> username=sa
> password=
> 
> 
> 
=== message truncated ===

Reply via email to