blega
12-27-2006, 01:54 PM
Hello Spring/Nhibernate/Sqlite3 users !
Here are the information to use Sqlite3 with Spring.Data.NHibernate
the specs are
. spring + spring.data (20061225)
. Nhibernate 1.0.3
. Sqlite3 with sqlite-dotnet2
* First, you need the nhibernate drivers (provided in the zip)
The zip is available as an attachment to this issue (http://jira.nhibernate.org/browse/NH-846) or directly downloadable here (http://jira.nhibernate.org/secure/attachment/11640/NHibernate.SQLite20.zip)
In the zip, you will find :
- the visual studio 2005/2003 project
- the code (yeah)
- debug and release dlls for .net 2.0 and .net 1.1
* Second : add the dbprovider settings
(note quite sure about the error codes)
<!-- Sqlite + ADO Net provider for sqlite -->
<!-- Driver can be found at : http://sourceforge.net/projects/sqlite-dotnet2 -->
<!-- Reference for error codes : http://www.sqlite.org/capi3.html -->
<object id="DbProvider" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
<constructor-arg name="dbMetaData">
<object type="Spring.Data.Common.DbMetadata">
<constructor-arg name="productName" value="MySQL" />
<constructor-arg name="assemblyName" value="System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="connectionType" value="System.Data.SQLite.SQLiteConnection, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="commandType" value="System.Data.SQLite.SQLiteCommand, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="parameterType" value="System.Data.SQLite.SQLiteParameter, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="dataAdapterType" value="System.Data.SQLite.SQLiteDataAdapter , System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="commandBuilderType" value="System.Data.SQLite.SQLiteCommandBuilder, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/>
<constructor-arg name="parameterDbType" value="System.Data.SQLite.TypeAffinity, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="parameterDbTypeProperty" value="DbType"/>
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
<constructor-arg name="parameterNamePrefix" value="?"/>
<constructor-arg name="exceptionType" value="System.Data.SQLite.SQLiteException, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
<constructor-arg name="bindByName" value="true"/>
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
obtaining error codes-->
<constructor-arg name="errorCodeExceptionExpression" value="Number.ToString()"/>
<property name="ErrorCodes.badSqlGrammarCodes">
<value></value>
</property>
<property name="ErrorCodes.DataAccessResourceFailureCodes">
<value>1</value>
</property>
<property name="ErrorCodes.DataIntegrityViolationCodes">
<value></value>
</property>
<property name="ErrorCodes.CannotAcquireLockCodes">
<value>15</value>
</property>
<property name="ErrorCodes.DeadlockLoserCodes">
<value>5, 6</value>
</property>
</object>
</constructor-arg>
<property name="connectionString" value="Data Source=${db.datasource};UTF8Encoding=True;Version= 3"/>
</object>
* Finally set the Nhibernate parameters
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="hibernate.dialect"
value="NHibernate.Dialect.SQLite20Dialect, NHibernate.SQLite20"/>
<entry key="hibernate.connection.driver_class"
value="NHibernate.Driver.SQLite20Driver, NHibernate.SQLite20"/>
</dictionary>
</property>
Bye,
Bertrand.
Here are the information to use Sqlite3 with Spring.Data.NHibernate
the specs are
. spring + spring.data (20061225)
. Nhibernate 1.0.3
. Sqlite3 with sqlite-dotnet2
* First, you need the nhibernate drivers (provided in the zip)
The zip is available as an attachment to this issue (http://jira.nhibernate.org/browse/NH-846) or directly downloadable here (http://jira.nhibernate.org/secure/attachment/11640/NHibernate.SQLite20.zip)
In the zip, you will find :
- the visual studio 2005/2003 project
- the code (yeah)
- debug and release dlls for .net 2.0 and .net 1.1
* Second : add the dbprovider settings
(note quite sure about the error codes)
<!-- Sqlite + ADO Net provider for sqlite -->
<!-- Driver can be found at : http://sourceforge.net/projects/sqlite-dotnet2 -->
<!-- Reference for error codes : http://www.sqlite.org/capi3.html -->
<object id="DbProvider" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
<constructor-arg name="dbMetaData">
<object type="Spring.Data.Common.DbMetadata">
<constructor-arg name="productName" value="MySQL" />
<constructor-arg name="assemblyName" value="System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="connectionType" value="System.Data.SQLite.SQLiteConnection, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="commandType" value="System.Data.SQLite.SQLiteCommand, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="parameterType" value="System.Data.SQLite.SQLiteParameter, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="dataAdapterType" value="System.Data.SQLite.SQLiteDataAdapter , System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="commandBuilderType" value="System.Data.SQLite.SQLiteCommandBuilder, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/>
<constructor-arg name="parameterDbType" value="System.Data.SQLite.TypeAffinity, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="parameterDbTypeProperty" value="DbType"/>
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
<constructor-arg name="parameterNamePrefix" value="?"/>
<constructor-arg name="exceptionType" value="System.Data.SQLite.SQLiteException, System.Data.SQLite, Version=1.0.38, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
<constructor-arg name="bindByName" value="true"/>
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
obtaining error codes-->
<constructor-arg name="errorCodeExceptionExpression" value="Number.ToString()"/>
<property name="ErrorCodes.badSqlGrammarCodes">
<value></value>
</property>
<property name="ErrorCodes.DataAccessResourceFailureCodes">
<value>1</value>
</property>
<property name="ErrorCodes.DataIntegrityViolationCodes">
<value></value>
</property>
<property name="ErrorCodes.CannotAcquireLockCodes">
<value>15</value>
</property>
<property name="ErrorCodes.DeadlockLoserCodes">
<value>5, 6</value>
</property>
</object>
</constructor-arg>
<property name="connectionString" value="Data Source=${db.datasource};UTF8Encoding=True;Version= 3"/>
</object>
* Finally set the Nhibernate parameters
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="hibernate.dialect"
value="NHibernate.Dialect.SQLite20Dialect, NHibernate.SQLite20"/>
<entry key="hibernate.connection.driver_class"
value="NHibernate.Driver.SQLite20Driver, NHibernate.SQLite20"/>
</dictionary>
</property>
Bye,
Bertrand.