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=



*********************************
providers.config
*********************************
<?xml version="1.0" encoding="utf-8" ?> 

<providers>
        <clear/>
        <provider
                name="sqlServer1.0"
                enabled="false"
                assemblyName="System.Data, Version=1.0.3300.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
        
connectionClass="System.Data.SqlClient.SqlConnection" 
                commandClass="System.Data.SqlClient.SqlCommand"
                parameterClass="System.Data.SqlClient.SqlParameter"
                parameterDbTypeClass="System.Data.SqlDbType"
                parameterDbTypeProperty="SqlDbType"
        
dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
        
commandBuilderClass="System.Data.SqlClient.SqlCommandBuilder"
                usePositionalParameters = "false"
                useParameterPrefixInSql = "true"
                useParameterPrefixInParameter = "true"  
                parameterPrefix="@"
                />
        <provider
                name="Firebird1.7"
                enabled="true"
                assemblyName="FirebirdSql.Data.Firebird,
Version=1.7.0.33200, Culture=neutral,
PublicKeyToken=fa843d180294369d"
        
connectionClass="FirebirdSql.Data.Firebird.FbConnection"
                commandClass="FirebirdSql.Data.Firebird.FbCommand"
        
parameterClass="FirebirdSql.Data.Firebird.FbParameter"
        
parameterDbTypeClass="FirebirdSql.Data.Firebird.FbDbType"
                parameterDbTypeProperty="FbDbType"
        
dataAdapterClass="FirebirdSql.Data.Firebird.FbDataAdapter"
        
commandBuilderClass="FirebirdSql.Data.Firebird.FbCommandBuilder"
                usePositionalParameters = "false"
                useParameterPrefixInSql = "false"
                useParameterPrefixInParameter = "false"                 
                parameterPrefix="@"
        />
        <provider
                name="sqlServer1.1"
                default="true"
                enabled="true"
                assemblyName="System.Data, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
        
connectionClass="System.Data.SqlClient.SqlConnection"
                commandClass="System.Data.SqlClient.SqlCommand"
                parameterClass="System.Data.SqlClient.SqlParameter"
                parameterDbTypeClass="System.Data.SqlDbType"
                parameterDbTypeProperty="SqlDbType"
        
dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"
        
commandBuilderClass="System.Data.SqlClient.SqlCommandBuilder"

                usePositionalParameters = "false"       
                useParameterPrefixInSql = "true"
                useParameterPrefixInParameter = "true"                          
                parameterPrefix="@"
        />
        <provider 
                name="OleDb1.1" 
                enabled="false" 
                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="Odbc1.1" 
                enabled="false" 
                assemblyName="System.Data, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" 
                connectionClass="System.Data.Odbc.OdbcConnection" 
                commandClass="System.Data.Odbc.OdbcCommand" 
                parameterClass="System.Data.Odbc.OdbcParameter" 
                parameterDbTypeClass="System.Data.Odbc.OdbcType" 
                parameterDbTypeProperty="OdbcType" 
                dataAdapterClass="System.Data.Odbc.OdbcDataAdapter" 
        
commandBuilderClass="System.Data.Odbc.OdbcCommandBuilder"

                usePositionalParameters = "true"
                useParameterPrefixInSql = "false"
                useParameterPrefixInParameter = "false"
                parameterPrefix = "@"
        />
        <provider
                name="oracle9.2"
                enabled="false"
                assemblyName="Oracle.DataAccess, Version=9.2.0.401,
Culture=neutral, PublicKeyToken=89b483f429c47342"
        
connectionClass="Oracle.DataAccess.Client.OracleConnection"

        
commandClass="Oracle.DataAccess.Client.OracleCommand"
        
parameterClass="Oracle.DataAccess.Client.OracleParameter"
        
parameterDbTypeClass="System.Data.Client.OracleDbType"
                parameterDbTypeProperty="OracleDbType"
        
dataAdapterClass="Oracle.DataAccess.Client.OracleDataAdapter"
        
commandBuilderClass="Oracle.DataAccess.Client.OracleCommandBuilder"
                usePositionalParameters = "false"
                useParameterPrefixInSql = "true"
                useParameterPrefixInParameter = "false"
                parameterPrefix=":" 
        />
</providers>

***********
End of Source Code
***********


                
__________________________________ 
Do you Yahoo!? 
Make Yahoo! your home page 
http://www.yahoo.com/r/hs

Reply via email to