<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C# Hacker - The Rambling Coder &#187; Database</title>
	<atom:link href="http://www.csharphacker.com/technicalblog/index.php/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.csharphacker.com/technicalblog</link>
	<description>Thoughts and ponderings on the technical world</description>
	<lastBuildDate>Thu, 22 Jul 2010 02:15:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SQLite 3.7.0 Released &#8211; WAL is now available</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2010/07/21/sqlite-3-7-0-released-wal-is-now-available/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2010/07/21/sqlite-3-7-0-released-wal-is-now-available/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 02:15:05 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=506</guid>
		<description><![CDATA[The official release information can be found [SQLite Release 3.7.0 On 2010 July 22 (3.7.0)]. The summary is that this is a pretty large change compared to previous releases. WAL (Write Ahead Logging) support &#8211; this means: Generally faster More concurrency Better disk performance when processing the WAL logs. Cant use network shares or different [...]]]></description>
			<content:encoded><![CDATA[<p>The official release information can be found [<a href="http://www.sqlite.org/releaselog/3_7_0.html">SQLite Release 3.7.0 On 2010 July 22 (3.7.0)</a>]. The summary is that this is a pretty large change compared to previous releases.</p>
<ul>
<li>WAL (Write Ahead Logging) support &#8211; this means:
<ul>
<li>Generally faster</li>
<li>More concurrency</li>
<li>Better disk performance when processing the WAL logs.</li>
<li>Cant use network shares or different computers for writing to the same logs.</li>
<li>[<a href="http://www.sqlite.org/wal.html">Complete WAL information can be found here</a>]</li>
</ul>
</li>
<li>Query planner enhancement</li>
<li>Logical database size is now stored in the database header so that      bytes can be appended to the end of the database file</li>
</ul>
<p>Well done to the SQLite team!</p>
<p>Gareth</p>
<p>PS And for those wondering, I will restart blogging again on a more regular basis very soon, just been unburying myself!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2010/07/21/sqlite-3-7-0-released-wal-is-now-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handy SQL Server knowledge nuggets</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2010/01/24/handy-sql-server-knowledge-nuggets/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2010/01/24/handy-sql-server-knowledge-nuggets/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 04:40:32 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[SQLServer]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=499</guid>
		<description><![CDATA[These are worth reading, kind of a read once &#8211; nothing too complicated. However they will be useful if you have the need for these [How to find out what procedure is doing a data modification] Very simple, yet effective approach to determine what RPC call is altering your data. This is a read it [...]]]></description>
			<content:encoded><![CDATA[<p>These are worth reading, kind of a read once &#8211; nothing too complicated. However they will be useful if you have the need for these</p>
<ul>
<li><a href="http://sqlblogcasts.com/blogs/antxxxx/archive/2009/10/13/how-to-find-out-what-procedure-is-doing-an-insert.aspx">[How to find out what procedure is doing a data modification</a>]
<ul>
<li>Very simple, yet effective approach to determine what RPC call is altering your data. This is a read it once, you get the ah-ha why didn&#8217;t I think of that moment and you wont need to reference it again!</li>
</ul>
</li>
<li>[<a href="http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/25/temporary-procedures-sql-server.aspx">Temporary procedures : T-SQL</a>]
<ul>
<li>We all know about temporary tables, but you can do that for stored procedures as well. Neat if you have a need for it</li>
</ul>
</li>
<li>[<a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/11/12/conor-vs-foreign-key-join-elimination.aspx">Conor vs. FOREIGN KEY join elimination</a>]
<ul>
<li>Explains a bit of the history why a single column foreign key performs better than a multi-column FK. Its the old 80:20 rule at work, or probably more accurately 99.9:0.1 rule <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
</li>
<li>[<a href="http://sqlblogcasts.com/blogs/repieter/archive/2009/11/17/ssrs-report-execution-failed-solution-sspi-ntlm.aspx">SSRS -Report execution failed. Solution: SSPI=NTLM</a>]
<ul>
<li>Seems downgrading to NTLM solves some integrated security issues if Kerberos is not playing nicely. Handy to know.</li>
</ul>
</li>
<li>[<a href="http://sqlblogcasts.com/blogs/tonyrogerson/archive/2009/11/24/taking-advantage-of-table-variables-not-being-transactional-application-logging-files-within-a-transaction-and-keeping-what-s-happened.aspx">Take advantage of Table Variables NOT being transactional</a>]
<ul>
<li>Ever needed to store state in a transaction that you didnt want to be rolled back? Think log tables! Read and learn <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
</li>
<li>[<a href="http://blog.sqlauthority.com/2010/01/12/sql-server-fragmentation-detect-fragmentation-and-eliminate-fragmentation/">SQL SERVER – Fragmentation, Detection and how to resolve it</a>]
<ul>
<li>Nice overview of fragmentation, and shows how to use DMV&#8217;s rather than the old school SQL 2000 DBCC approaches <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
</li>
<li>[<a href="http://sys2dmvs.codeplex.com/">CodePlex: SYS2 DMVs</a>]
<ul>
<li>Hopefully this will serve as a good collection point &#8211; its very &#8216;young&#8217; at the moment, but I would like it to live!</li>
</ul>
</li>
<li>[<a href="http://blogs.msdn.com/sqlserverstorageengine/archive/2010/01/18/improvement-in-minimizing-lockhash-key-collisions-in-sql-server-2008r2-and-its-impact-on-concurrency.aspx">Locking improvements in SQL 2008 R2</a>]
<ul>
<li>Handy to know about, unfortunately R2 has a price hike associated with it <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </li>
</ul>
</li>
<li>[<a href="http://weblogs.sqlteam.com/mladenp/archive/2010/01/21/SQL-Server-ndash-Find-the-most-expensive-operations-in-Execution.aspx">Find the most expensive operations in Execution plans</a>]
<ul>
<li>Handy way to take the XML plan and process it in a way to get a tabular list of the most expensive queries back. Very nice.</li>
</ul>
</li>
</ul>
<p>I suspect everyone who has dealt with scalar UDF functions in production environments are already VERY aware of the performance sucking capability they can have on your nice server. Here are some nice comments if you are not painfully aware:</p>
<ul>
<li>[<a href="http://www.simple-talk.com/community/blogs/tony_davis/archive/2009/11/13/76413.aspx">Do Scalar UDFs give SQL Server a Bad Name?</a>]</li>
<li>[<a href="http://sqlblogcasts.com/blogs/sqlandthelike/archive/2009/10/15/udf-overhead-a-simple-example.aspx">UDF Overhead – A simple example</a>]</li>
</ul>
<p>Gareth</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2010/01/24/handy-sql-server-knowledge-nuggets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite updated webpage&#8230; now has search! Happy New Year!</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2010/01/08/sqlite-updated-webpage-now-has-search-happy-new-year/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2010/01/08/sqlite-updated-webpage-now-has-search-happy-new-year/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 02:46:14 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=477</guid>
		<description><![CDATA[It seems the SQLite folks have added a significant, needed and often requested, feature to the SQLite site.  No the change we are talking about has nothing to do with the SQLite engine, but yes I&#8217;m talking about the web site. In the top right side of the website there is a new shiny unobtrusive [...]]]></description>
			<content:encoded><![CDATA[<p>It seems the SQLite folks have added a significant, needed and often requested, feature to the SQLite site.  No the change we are talking about has nothing to do with the SQLite engine, but yes I&#8217;m talking about the web site. In the top right side of the website there is a new shiny unobtrusive &#8220;Search SQLite Docs&#8230;&#8221; search box.</p>
<p>So for all us who have spent time searching, or had pages pointed out to us <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> , for options  this is an excellent new years present!</p>
<p>Many thanks to the SQLite guys for both their product, and their handy dandy search feature!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2010/01/08/sqlite-updated-webpage-now-has-search-happy-new-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL News &#8211; and the fact we have to go to 64 bit and more $</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/11/14/sql-news-and-the-fact-we-have-to-go-to-64-bit-and-more/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/11/14/sql-news-and-the-fact-we-have-to-go-to-64-bit-and-more/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 02:22:02 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[SQLServer]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=471</guid>
		<description><![CDATA[Everyone should know now that there has been a massive amount of Microsoft activity. This article will cover the recent SQL activity, including end of service dates, x64 requirements, and a fairly significant price hike. The tipping point is...]]></description>
			<content:encoded><![CDATA[<p>Everyone should know now that there has been a massive amount of Microsoft activity. This article will cover the recent SQL activity, however the big one really is that the tipping point for 64 bit is in progress. This is a shame for me as I&#8217;m running 32bit OS, and I&#8217;m going to have to pave my machine &#8211; but that is the price developers are going to have to pay to play!</p>
<ul>
<li>[<a href="http://www.microsoft.com/sqlserver/2008/en/us/R2-editions.aspx">What's New in SQL Server 2008 R2 Editions</a>]
<ul>
<li>Biggest first &#8211; Price increase! To say I&#8217;m disappointed is an understatement in this area. Specifically for developers  already have to support 2005 &amp; 2008. Now they have to deal with R2, and persuade their customers to move to R2 if they want certain features.</li>
<li>MDS &#8211; Master Data Services &#8211; more on this one later. Pretty cool</li>
<li>Parallel Data Warehouse release
<ul>
<li>The DATAllegro purchase is now seeing the light as a Microsoft product!</li>
<li>Support of very large datasets (100Tb-1Pb). This is definitely something I would like to play with, but at $57,496 per processor&#8230;</li>
</ul>
</li>
<li>Standard now has backup compression &#8211; but with the price tag&#8230;</li>
</ul>
</li>
<li>[<a href="http://blogs.msdn.com/sqlrsteamblog/archive/2009/11/09/sql-server-2008-r2-november-ctp-what-s-new-in-reporting-services.aspx">SQL Server 2008 R2 November CTP – What’s New In Reporting Services?</a>]
<ul>
<li>Report Builder 3.0 is available! Woohoo!</li>
<li>Enhanced sharepoint integration</li>
<li>Aggregates of aggregates</li>
<li>New Data Visualization Report Items</li>
</ul>
</li>
<li>[<a href="http://sqlcat.com/msdnmirror/archive/2009/10/20/using-filtered-statistics-with-partitioned-tables.aspx">Using Filtered Statistics with Partitioned Tables</a>]
<ul>
<li>Learn to appreciate filtered statistics!</li>
</ul>
</li>
<li>[<a href="http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/13/mds-is-x64-only.aspx">MDS (Master Data Services) is x64 Only</a>]
<ul>
<li>I totally get this, but this is the tipping point for me to repave my machines <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </li>
<li>With this requiring x64 and many new products requiring Windows 2008, Windows 7 or Vista it seems now is the time to move up.</li>
</ul>
</li>
<li>[<a href="http://blogs.msdn.com/sqlreleaseservices/archive/2009/10/08/end-of-service-pack-support-for-sql-server-2005-sp2-and-sql-server-2008-rtm.aspx">MSSQL End of service dates for Service packs</a>]
<ul>
<li>Support for SQL Server 2005 Service Pack 2 (SP2)  will end on <strong>January 12, 2010</strong></li>
<li>Support for SQL Server 2008 RTM will end on <strong>April 13, 2010</strong></li>
</ul>
</li>
</ul>
<p>More to come!</p>
<p>Gareth</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/11/14/sql-news-and-the-fact-we-have-to-go-to-64-bit-and-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What the heck is redacting a database?</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/10/21/what-the-heck-is-redacting-a-database/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/10/21/what-the-heck-is-redacting-a-database/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 02:04:26 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[SQLServer]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=469</guid>
		<description><![CDATA[A good friend of mine sent me the following link: [http://www.codersrevolution.com/index.cfm/2009/10/21/Sequoia-Voting-System-Witch-Hunt-err-Study-Project"] The learning we can take away from this is if you don&#8217;t adequately cleanse then you can expect the data to become available! While its an interesting concept they apparently tried (and not too successfully) to do. The best way to clean a database [...]]]></description>
			<content:encoded><![CDATA[<p>A good friend of mine sent me the following link:</p>
<p>[<a href="http://www.codersrevolution.com/index.cfm/2009/10/21/Sequoia-Voting-System-Witch-Hunt-err-Study-Project">http://www.codersrevolution.com/index.cfm/2009/10/21/Sequoia-Voting-System-Witch-Hunt-err-Study-Project"</a>]</p>
<p>The learning we can take away from this is if you don&#8217;t adequately cleanse then you can expect the data to become available! While its an interesting concept they apparently tried (and not too successfully) to do. The best way to clean a database is to create a new one and just copy in the data you want exposed. Don&#8217;t trust the handy dandy DROP/DELTE <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>If they wanted to expose/publish the 88 tables, then they should have created a new DB, copied in the tables and released it. Anything less than that you have to be VERY careful! And for the more security conscious it would be created on a recently wiped drive on a recently rebooted computer!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/10/21/what-the-heck-is-redacting-a-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Datawarehousing news and nice approach for partitioned data</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/09/30/datawarehousingandpartitioneddata/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/09/30/datawarehousingandpartitioneddata/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 00:01:39 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Data Warehousing]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=466</guid>
		<description><![CDATA[[Kickfire Offers Data Warehouse Appliance for the Masses] Kickfire supports a MySQL based data-warehouse appliance targeting 500Gb -5Tb range, starting at $32K. Will have to start monitoring this one. They appear to use similar concept to Netezza by utilizing SQL in hardware for speed, not exactly the same &#8211; but interesting to see the appliance [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>[<a href="http://intelligent-enterprise.informationweek.com/showArticle.jhtml?articleID=220300604">Kickfire Offers Data Warehouse Appliance for the Masses</a>]
<ul>
<li><a href="http://www.kickfire.com/">Kickfire</a> supports a MySQL based data-warehouse appliance targeting 500Gb -5Tb range, starting at $32K.</li>
<li>Will have to start monitoring this one. They appear to use similar concept to Netezza by utilizing SQL in hardware for speed, not exactly the same &#8211; but interesting to see the appliance trend.</li>
</ul>
</li>
<li>[<a href="http://sldn.softlayer.com/09/2009/building-the-data-warehouse/">Building the Data Warehouse for bandwidth tracking</a>]
<ul>
<li>This is a worthy read if you need to load and handle lots of naturally partitioned data</li>
<li>For those not willing to read, I&#8217;ll pose a question &#8211; how would you handle 683,460 tables <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/09/30/datawarehousingandpartitioneddata/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite for C# – Part 8 – Loading CSV/Pipe into SQLite via command line</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/09/19/sqliteforcsharppart8loadingcsvpipeintosqliteviacommandline/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/09/19/sqliteforcsharppart8loadingcsvpipeintosqliteviacommandline/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 03:24:46 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=447</guid>
		<description><![CDATA[Ever wondered how hard it would be to load a CSV file into a SQLite database. I know how I would do it in code, no rocket science needed there! However in this case I wanted to really know the speed of doing this natively and really didn&#8217;t want to code anything! So looking at [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wondered how hard it would be to load a CSV file into a SQLite database. I know how I would do it in code, no rocket science needed there! However in this case I wanted to really know the speed of doing this natively and really didn&#8217;t want to code anything!</p>
<p>So looking at what SQLite3.exe has too offer it pretty much supports it out of the box. Very nice <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><span style="text-decoration: underline;"><strong>Requirements:</strong></span></p>
<ul>
<li>Loading speed</li>
<li>Making the data to consuming applications available asap</li>
</ul>
<p>While I love C# and frankly its hard to go back to C or C++, sometimes performance trumps the creature comforts we have become accustomed to.</p>
<p><strong>Note:</strong> I did this without circling back to a C# implementation as I know the data and performance requirements  are tight and in this case I wanted max performance with no code! The biggest factor to a successful implementation is to ensure you use the tools best for the job, not just the ones you favor in that specific year.</p>
<p>So first things first &#8211; create a table to take the input</p>
<pre class="brush: sql;">
DROP TABLE IF EXISTS BookSales;
CREATE TABLE IF NOT EXISTS BookSales
(
   Store    int
  ,Date     varchar
  ,OrderReference varchar
  ,Line     int
  ,BookISBN varchar(14)
  ,Quantity int
  ,Price    int
, Primary Key (OrderReference,Line)
);
</pre>
<p>Next is the magic. We need to load the CSV into the table:</p>
<pre class="brush: sql;">
.separator &quot;|&quot;
.import BookSales.txt BookSales
</pre>
<p>Wow that was easy <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . You can see we set the separator to be a pipe rather than comma in this case, then the import.</p>
<p><strong>.IMPORT [FileName] [Table]</strong></p>
<p>Now the database is ready to be queried! But if we want to take it just one stage further:</p>
<pre class="brush: sql;">
.output SummaryBookSales.csv
SELECT Store, Date, BookISBN, SUM(Quantity), SUM(Price)
FROM BookSales
GROUP BY Store, Date, BookISBN;
</pre>
<p>Now we output the results of our simple aggregation into a pipe separated output file.</p>
<p>Tying this all together in a single configuration file, which we will call &#8220;BookAnalysisLoader.sql&#8221;, gives us:</p>
<pre class="brush: sql;">
DROP TABLE IF EXISTS BookSales;
CREATE TABLE IF NOT EXISTS BookSales
(
   Store    int
  ,Date     varchar
  ,OrderReference varchar
  ,Line     int
  ,BookISBN varchar(14)
  ,Quantity int
  ,Price    int
, Primary Key (OrderReference,Line)
);

.separator &quot;|&quot;
.import BookSales.txt BookSales

.output SummaryBookSales.csv
SELECT Store, Date, BookISBN, SUM(Quantity), SUM(Price)
FROM BookSales
GROUP BY Store, Date, BookISBN;
.exit
</pre>
<p>The last piece of the puzzle is the final execution:</p>
<p><strong>sqlite3.exe BookSalesAnalysis.db3 &lt; BookAnalysisLoader.sql</strong></p>
<p>Now we have a newly created database with our analysis data in it, and we have a summary CSV file generated from the output. So we can load the CSV into Excel or another DB, or directly interrogate the DB for more analytical information &#8211; and all without coding!</p>
<p><strong>Related Links:</strong></p>
<ul>
<li><a href="/technicalblog/index.php/2009/06/16/sqlite-for-c-part-1-am-i-allowed-to-use-it/">SQLite for C# &#8211; Part 1 &#8211; Am I allowed to use it?</a></li>
<li><a href="/technicalblog/index.php/2009/06/17/sqlite-for-c-part-2-how-do-i-setup-a-sqlite-db-without-coding/">SQLite for C# – Part 2 – How do I setup a SQLite DB (without coding)</a></li>
<li><a href="/technicalblog/index.php/2009/06/28/sqlite-for-c-%e2%80%93-part-3-%e2%80%93-my-first-c-app-using-sqlite-aka-hello-world/">SQLite for C# – Part 3 – My first C# app using SQLite aka Hello World</a></li>
<li><a href="/technicalblog/index.php/2009/06/30/sqlite-for-c-%e2%80%93-part-4-%e2%80%93-so-how-does-sqlite-stack-up-against-other-dbs/">SQLite for C# – Part 4 – So how does SQLite stack up against other DB’s?</a></li>
<li><a href="/technicalblog/index.php/2009/07/01/sqlite-for-c-%e2%80%93-part-5-%e2%80%93-sqlite-features-or-quirks/">SQLite for C# – Part 5 – SQLite ‘features’, or ‘quirks’</a></li>
<li><a href="/technicalblog/index.php/2009/07/02/sqlite-for-c-%e2%80%93-part-6-%e2%80%93-sqlite-connection-string-definitions/">SQLite for C# – Part 6 – SQLite Connection String Definitions</a></li>
<li><a href="/technicalblog/index.php/2009/07/05/sqlite-for-c-part-7%e2%80%93building-sqlite-net-from-source/">SQLite for C# – Part 7 – Building SQLite.Net from source</a></li>
<li>SQLite for C# – Part 8 – Loading CSV/Pipe into SQLite via command line</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/09/19/sqliteforcsharppart8loadingcsvpipeintosqliteviacommandline/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>SQLite 3.6.18 has been offically released!</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/09/11/sqlite-3-6-18-has-been-offically-released/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/09/11/sqlite-3-6-18-has-been-offically-released/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 16:07:35 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=431</guid>
		<description><![CDATA[There are a number of good changes here! Improved query planner: Through better use of statistics Compile time option enables Analyze to better handle the index histograms Additionally it was just plain improved as well! Recursive triggers Delete triggers fire during a REPLACE/MERGE More precise use of caching approaches with the Shared Cache &#8211; basically [...]]]></description>
			<content:encoded><![CDATA[<p>There are a number of good changes here!</p>
<ul>
<li>Improved query planner:
<ul>
<li>Through better use of statistics</li>
<li>Compile time option enables Analyze to better handle the index histograms</li>
<li>Additionally it was just plain improved as well!</li>
</ul>
</li>
<li>Recursive triggers</li>
<li>Delete triggers fire during a REPLACE/MERGE</li>
<li>More precise use of caching approaches with the
<ul>
<li>Shared Cache &#8211; basically cache the results within the application rather can on each thread. Now configurable on a per-thread basis rather than global.</li>
<li>Private &#8211; The old way</li>
</ul>
</li>
</ul>
<p>Well done to the SQLite team! Good stuff</p>
<p>More details can be found [<a href="http://www.sqlite.org/releaselog/3_6_18.html">SQLite Release 3.6.18 On 2009 Sep 11 (3.6.18)</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/09/11/sqlite-3-6-18-has-been-offically-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Azure Invitation has arrived!</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/08/24/sql-azure-is-available-to-me/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/08/24/sql-azure-is-available-to-me/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 01:13:11 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[High Availability]]></category>
		<category><![CDATA[SQLServer]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=423</guid>
		<description><![CDATA[Well I&#8217;m finally on the Azure CTP servers! If anyone has been hiding in a cave Azure is the Microsoft play at getting Microsoft SQL Server into the cloud. After creating an account you can create and drop databases in the &#8216;cloud&#8217;. Definitely pretty cool stuff. Now to see how well it performs and verify [...]]]></description>
			<content:encoded><![CDATA[<p>Well I&#8217;m finally on the Azure CTP servers! If anyone has been hiding in a cave Azure is the Microsoft play at getting Microsoft SQL Server into the cloud. After creating an account you can create and drop databases in the &#8216;cloud&#8217;.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-424" title="Azure Database Management Screen" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/08/AzureDatabase.jpg" alt="Azure Database Management Screen" width="468" height="349" /></p>
<p style="text-align: left;">Definitely pretty cool stuff. Now to see how well it performs and verify it supports all the nice SQ L stuff  (sparse columns, PIVOT, stored procedures etc).</p>
<p style="text-align: left;">This will certainly be hyped by Microsoft over the coming weeks, and we will be trying it out! Much more to come on this topic,</p>
<p style="text-align: left;">
<p style="text-align: left;">Gareth</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/08/24/sql-azure-is-available-to-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL 2008 Cumulative Updates Released</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/07/21/sql-2008-cumulative-updates-released/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/07/21/sql-2008-cumulative-updates-released/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 02:23:58 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[SQLServer]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=403</guid>
		<description><![CDATA[Two new CU updates have been released for SQL 2008 Cumulative Update #3 for SQL Server 2008 SP1 (Build 10.00.2723) Cumulative Update #6 for SQL Server 2008 RTM Things that stand out are: [970399]  FIX: The MAXDOP option for a running query or the max degree of parallelism option for the sp_configure stored procedure does [...]]]></description>
			<content:encoded><![CDATA[<p>Two new CU updates have been released for SQL 2008</p>
<ul>
<li><a href="http://blogs.msdn.com/sqlreleaseservices/archive/2009/07/20/cumulative-update-3-for-sql-server-2008-sp1.aspx">Cumulative Update #3 for SQL Server 2008 SP1</a> (Build 10.00.2723)</li>
<li><a href="http://blogs.msdn.com/sqlreleaseservices/archive/2009/07/20/cumulative-update-6-for-sql-server-2008-rtm.aspx">Cumulative Update #6 for SQL Server 2008 RTM</a></li>
</ul>
<p>Things that stand out are:</p>
<ul>
<li>[<a href="http://support.microsoft.com/kb/970399/">970399</a>]  FIX: The MAXDOP option for a running query or the max degree of parallelism option for the sp_configure stored procedure does not work in SQL Server 2008</li>
<li><a href="http://support.microsoft.com/kb/969844/">[969844]</a> FIX: You receive inconsistent results when you run index-related DMVs to return statistical information about missing indexes in SQL Server 2005 or in SQL Server 2008</li>
<li><a href="http://support.microsoft.com/kb/969997/">[969997</a>]  FIX: You receive an incorrect result when you query data from a linked server that is created by using an index OLE DB provider in SQL Server 2005 or in SQL Server 2008</li>
<li><a href="http://support.microsoft.com/kb/970507/">[970507</a>]  FIX: Error message in SQL Server 2008 when you run an INSERT SELECT statement on a table: &#8220;Violation of PRIMARY KEY constraint &#8216;&lt;PrimaryKey&gt;&#8217;. Cannot insert duplicate key in object &#8216;&lt;TableName&gt;&#8217;&#8221;</li>
<li><a href="http://support.microsoft.com/kb/971064/">[971064</a>]  FIX: Quotation marks are rendered incorrectly when you export a SQL Server 2008 Reporting Services report to a .csv file</li>
</ul>
<p>Obviously you need to really read to understand if you have seen any of the problems the fixes address to be fully aware &#8211; and definitely don&#8217;t apply unless you need a fix!</p>
<p>Gareth</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/07/21/sql-2008-cumulative-updates-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft SQL Services is now Microsoft SQL Azure</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/07/08/microsoft-sql-services-is-now-microsoft-sql-azure/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/07/08/microsoft-sql-services-is-now-microsoft-sql-azure/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 20:45:23 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[High Availability]]></category>
		<category><![CDATA[SQLServer]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=343</guid>
		<description><![CDATA[Microsoft SQL Services is now Microsoft SQL Azure &#8211; let the rebranding process begin After not initially supporting TDS the name is now changing to the Azure brand. Microsoft is updating the branding for SQL Services and SQL Data Services. Effective immediately, SQL Services will be called Microsoft SQL Azure, and SQL Data Services will [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.technet.com/dataplatforminsider/archive/2009/07/08/microsoft-sql-services-is-now-microsoft-sql-azure.aspx">Microsoft SQL Services is now Microsoft SQL Azure</a> &#8211; let the rebranding process begin <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  After not initially supporting TDS the name is now changing to the Azure brand.</p>
<blockquote><p>Microsoft is updating the branding for SQL Services and SQL Data Services. Effective immediately, SQL Services will be called Microsoft SQL Azure, and SQL Data Services will be Microsoft SQL Azure Database.</p>
<p>There will be more news and updates related to our Software + Services strategy next week at Microsoft’s Worldwide Partner Conference in New Orleans. For those of you not attending in person, all the news and information can be found at:  <a href="http://www.digitalwpc.com/">http://www.digitalwpc.com/</a> .  Check back often starting next Monday, July 13, for daily updates.</p></blockquote>
<p>More about TSQL Support in SQL Data Services can be found <a href="http://blogs.msdn.com/ssds/archive/2009/07/07/9823115.aspx">here</a>. Another announcement of this can be found at &#8220;<a href="http://blogs.msdn.com/ssds/archive/2009/07/09/9827971.aspx">SQL Azure &#8211; Same great platform, just a better aligned name</a>&#8221;</p>
<p>Apparently its a &#8216;Cloudy&#8217; week <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Gareth</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/07/08/microsoft-sql-services-is-now-microsoft-sql-azure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite for C# – Part 7 – Building SQLite.Net from source (and netmodules)</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/07/05/sqlite-for-c-part-7%e2%80%93building-sqlite-net-from-source/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/07/05/sqlite-for-c-part-7%e2%80%93building-sqlite-net-from-source/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 11:58:59 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=303</guid>
		<description><![CDATA[One of the key differentiators that SQLite for .Net has is that you have full access to the source code and can compile it. Its interesting in the fact most commercial developers like this option, but rarely use it. Kind of a &#8216;checkbox&#8217; &#8211; &#8220;if I need to can I?&#8221;. This article covers how to [...]]]></description>
			<content:encoded><![CDATA[<p>One of the key differentiators that SQLite for .Net has is that you have full access to the source code and can compile it. Its interesting in the fact most commercial developers like this option, but rarely use it. Kind of a &#8216;checkbox&#8217; &#8211; &#8220;if I need to can I?&#8221;. This article covers how to get the source code from the archive and compile it up. I find this predominately useful if you are isolating a crash, or trying to determine if there is an option you can &#8216;flip&#8217; to get an application to behave the way you want to.</p>
<p>The first thing to do is go and grab the latest source! The source code is currently hosted on SourceForge at: <a href="http://sourceforge.net/projects/sqlite-dotnet2/">http://sourceforge.net/projects/sqlite-dotnet2/</a>. If you go to this page you there are links (or there were at the time of writing!!) to &#8220;Download Now!&#8221; or &#8220;<a href="http://sourceforge.net/projects/sqlite-dotnet2/files/">View all files</a>&#8220;. If you are looking for the source you need to chose &#8220;View all Files&#8221;. From here you should choose the latest source package (currently &#8220;SQLite-1.0.63.0-source.zip&#8221;) and download and unzip to your drive. You should now have the latest and greatest &#8216;stable&#8217; source code, if you need to pick up an in flight fix or need to most up to date you may have to use CVS to download the package. Unfortunately (albeit fortunate for this article) &#8220;SQLite-1.0.63.0-source.zip&#8221; contains an issue where the build didnt completely work straight out of the box for Win32 builds. I contacted the team through the developer forum (<a href="http://sqlite.phxsoftware.com/forums/">http://sqlite.phxsoftware.com/forums/</a>) and the problem was resolved in the latest CVS code patch (Patchset 415). So given this we need to pull it from CVS rather than the prepackaged code. <strong>NOTE: Normally speaking you should only need (and I would recommend only) the packaged code rather than CVS. Only if you want to live on the bleeding edge, or have a real need to get the latest release should you really use the CVS version.</strong> If fact the team doesnt even recommend using the CVS version (<a href="http://sqlite.phxsoftware.com/forums/t/1814.aspx">http://sqlite.phxsoftware.com/forums/t/1814.aspx</a>).</p>
<p>However to complete the full circle and want to go down the CVS route and you are not familiar with CVS you can find out more information <a href="http://en.wikipedia.org/wiki/Concurrent_Versions_System">here</a>. Raw CVS executables for Windows can be found <a href="http://ftp.gnu.org/non-gnu/cvs/binary/stable/x86-woe/">here</a>, but I would recommend if you are going to make a habit out of it you get and use <a href="http://tortoisecvs.sourceforge.net/">TortoiseCVS</a> instead.</p>
<pre class="brush: plain;">
cvs -d:pserver:anonymous@sqlite-dotnet2.cvs.sourceforge.net:/cvsroot/sqlite-dotnet2 login
cvs -z3 -d:pserver:anonymous@sqlite-dotnet2.cvs.sourceforge.net:/cvsroot/sqlite-dotnet2 co -P SQLite.NET
</pre>
<p>[Note if the first line fails create an empty ".cvspass" file and retry it]</p>
<p>Now you should have the latest code straight from the CVS repository, or if you are more sensible <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  the packaged ZIP file covered at the beginning of the article.</p>
<p>Now on to the building! In the top level folder there are 2 interesting/key files:</p>
<ul>
<li>readme.htm &#8211; This details the latest release notes associated with the provider code, and covers the differences between the various historical releases.</li>
<li>SQLite.NET.sln &#8211; This is our well loved and trusted VS2008 solution file!</li>
</ul>
<p>Starting the solution file the solution loads up and with the latest version I&#8217;m using8 projects are loaded:</p>
<ul>
<li>SQLite.Interop</li>
<li>System.Data.SQLite &#8211; Compact</li>
<li>System.Data.SQLite &#8211; Managed Only</li>
<li>System.Data.SQLite &#8211; Netmodule</li>
<li>System.Data.SQLite.Linq</li>
<li>test</li>
<li>testce</li>
<li>testlinq</li>
</ul>
<p>Out of the box you should be able to build the release and debug files. You will also notice slightly different icons associated with the projects &#8220;System.Data.SQLite &#8211; Compact&#8221; &amp; &#8220;testce&#8221;. This is because these builds are targeting a mobile or Compact framework device.  They dont hurt to be there so feel free to ignore them as they wont be used unless you a compact/mobile build type.</p>
<p>Congratulations you should have successfully built the components and can verify your build by running the &#8220;test&#8221; application.</p>
<p><span style="text-decoration: underline;"><strong>Now on to the more technical deep dive of how it works</strong></span></p>
<p>Firstly lets be clear &#8211; this is certainly a non-trivial build process! This is merging C code &amp; .Net code into the same binary DLL using netmodules. More on netmodules can be found at &#8220;<a href="http://msdn.microsoft.com/en-us/library/226t7yxe.aspx">How to: Build a Multifile Assembly</a>&#8220;. Frankly I&#8217;m going to just dive into a little more detail here as this concept is key to the build.</p>
<p>Purely looking at the project in Visual Studio is a little misleading:</p>
<p><img class="aligncenter size-full wp-image-311" title="netmodule" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/07/netmodule.jpg" alt="netmodule" width="668" height="200" /></p>
<p>Hmmm &#8211; a &#8220;Windows Application&#8221; &#8211; really&#8230;. However looking at the &#8220;System.Data.SQLite &#8211; netmodule.csproj&#8221; in a text viewer you see something very different:</p>
<pre class="brush: plain;">

&amp;lt;OutputType&amp;gt;Module&amp;lt;/OutputType&amp;gt;
</pre>
<p>Obviously this is very different than &#8220;&lt;OutputType&gt;Library&lt;/OutputType&gt;&#8221;, &#8220;&lt;OutputType&gt;WinExe&lt;/OutputType&gt;&#8221;, &#8220;&lt;OutputType&gt;Exe&lt;/OutputType&gt;&#8221;. This is the netmodule magic we covered above &#8211; all this is largely hidden from the user if they just look at the VS interface. This magic is then referenced through the SQLite.Interop.vcproj though:</p>
<pre class="brush: plain;">

&amp;lt;Tool
Name=&amp;quot;VCLinkerTool&amp;quot;
AdditionalDependencies=&amp;quot;..\System.Data.SQLite\bin\System.Data.SQLite.netmodule&amp;quot;
OutputFile=&amp;quot;../bin/System.Data.SQLite.DLL&amp;quot;
ModuleDefinitionFile=&amp;quot;src\sqlite3.def&amp;quot;
EmbedManagedResourceFile=&amp;quot;&amp;quot;
DelayLoadDLLs=&amp;quot;advapi32.dll&amp;quot;
RandomizedBaseAddress=&amp;quot;1&amp;quot;
DataExecutionPrevention=&amp;quot;0&amp;quot;
ImportLibrary=&amp;quot;&amp;quot;
TargetMachine=&amp;quot;5&amp;quot;
KeyFile=&amp;quot;..\System.Data.SQLite\System.Data.SQLite.snk&amp;quot;
CLRUnmanagedCodeCheck=&amp;quot;true&amp;quot;
/&amp;gt;
</pre>
<p>The good news about this is that this is just a &#8216;dependency&#8217; and is fully supported in the C/C++ interface in VS2008. A little more can be read about here &#8220;<a href="http://msdn.microsoft.com/en-us/library/k669k83h%28VS.80%29.aspx">.netmodule Files as Linker Input</a>&#8221;</p>
<p>Alright so we now have the background knowledge to understand how this build is actually being used. So now lets look at the what the build sets up for us (the below is really the Win32/x64 build):</p>
<ul>
<li>Debug
<ul>
<li>SQLite.Interop</li>
<li>System.Data.SQLite &#8211; Managed Only</li>
<li>System.Data.SQLite.Linq</li>
<li>test</li>
<li>testlinq</li>
</ul>
</li>
<li>Debug &#8211; Stock
<ul>
<li>System.Data.SQLite &#8211; Managed Only</li>
<li>System.Data.SQLite.Linq</li>
<li>test</li>
</ul>
</li>
<li>Release
<ul>
<li>SQLite.Interop</li>
<li>System.Data.SQLite &#8211; Netmodule</li>
<li>System.Data.SQLite.Linq</li>
<li>test</li>
</ul>
</li>
<li>Release &#8211; Stock
<ul>
<li>System.Data.SQLite &#8211; Managed Only</li>
<li>System.Data.SQLite.Linq</li>
<li>test</li>
</ul>
</li>
</ul>
<p>The project dependencies are:</p>
<ul>
<li>SQLite.InterOp -&gt; System.Data.SQLite &#8211; netmodule</li>
<li>System.Data.SQLite.Linq -&gt; SQLite.InterOp</li>
<li>Test -&gt; SQLite.InterOp</li>
</ul>
<p>You can see that only the &#8220;Release&#8221; build doesn&#8217;t include the &#8220;System.Data.SQLite &#8211; Managed Only&#8221; version. Any build other than this one generates a build that requires both &#8220;System.Data.SQLite&#8221; and &#8220;SQLite.Interop.DLL&#8221;. The &#8220;Managed Only&#8221; isn&#8217;t a pure managed only version of SQLite, it still uses the native SQL C runtime code &#8211; but it makes the call out to the Interop dll. The &#8216;netmodule&#8217; version is used to embed in the ADO.NET C# classes into the &#8216;System.Data.SQLite&#8217; DLL, all other builds of &#8216;System.Data.SQLite&#8217; just reference the interop DLL.</p>
<p><strong>Release Build</strong></p>
<p>As mentioned before, in the release build SQLite.Interop is where all the magic happens in this build! This is the one that outputs bin\System.Data.SQLite.DLL (note in all other builds this generates &#8216;SQLite.Interop.dll&#8217; or in the stock case &#8216;sqlite3.dll&#8217;). However since this is really compiling the standard C SQLite code there is a little more magic going on here. This project has the linker dependency on &#8220;..\System.Data.SQLite\bin\System.Data.SQLite.netmodule&#8221;. This is how we get the C# ADO.NET provider injected into the System.Data.SQLite.DLL through the netmodules. However this process has the side effect of not being able to debug into the provider <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> . So for source code debugging use the debug build that references &#8220;Managed Only&#8221; rather than the netmodule.</p>
<p><strong>Debug Build</strong></p>
<p>From now on it is fairly standard, although I have seen an odd quirk is that if you attempt to debug into the regular &#8220;Debug Build&#8221; an error is through regarding the &#8220;&#8216;OutputType&#8217; failed&#8221;, if you use the &#8220;Debug &#8211; Stock&#8221; build this goes away as the &#8216;netmodule&#8217; is not included in the build.</p>
<p>Happy compiling and debugging!</p>
<p><strong>Related Links:</strong></p>
<ul>
<li><a href="/technicalblog/index.php/2009/06/16/sqlite-for-c-part-1-am-i-allowed-to-use-it/">SQLite for C# &#8211; Part 1 &#8211; Am I allowed to use it?</a></li>
<li><a href="/technicalblog/index.php/2009/06/17/sqlite-for-c-part-2-how-do-i-setup-a-sqlite-db-without-coding/">SQLite for C# – Part 2 – How do I setup a SQLite DB (without coding)</a></li>
<li><a href="/technicalblog/index.php/2009/06/28/sqlite-for-c-%e2%80%93-part-3-%e2%80%93-my-first-c-app-using-sqlite-aka-hello-world/">SQLite for C# – Part 3 – My first C# app using SQLite aka Hello World</a></li>
<li><a href="/technicalblog/index.php/2009/06/30/sqlite-for-c-%e2%80%93-part-4-%e2%80%93-so-how-does-sqlite-stack-up-against-other-dbs/">SQLite for C# – Part 4 – So how does SQLite stack up against other DB’s?</a></li>
<li><a href="/technicalblog/index.php/2009/07/01/sqlite-for-c-%e2%80%93-part-5-%e2%80%93-sqlite-features-or-quirks/">SQLite for C# – Part 5 – SQLite ‘features’, or ‘quirks’</a></li>
<li><a href="/technicalblog/index.php/2009/07/02/sqlite-for-c-%e2%80%93-part-6-%e2%80%93-sqlite-connection-string-definitions/">SQLite for C# – Part 6 – SQLite Connection String Definitions</a></li>
<li>SQLite for C# – Part 7 – Building SQLite.Net from source</li>
<li><a href="/technicalblog/index.php/2009/09/19/sqliteforcsharppart8loadingcsvpipeintosqliteviacommandline/">SQLite for C# – Part 8 – Loading CSV/Pipe into SQLite via command line</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/07/05/sqlite-for-c-part-7%e2%80%93building-sqlite-net-from-source/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQLite for C# – Part 6 – SQLite Connection String Definitions</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/07/02/sqlite-for-c-%e2%80%93-part-6-%e2%80%93-sqlite-connection-string-definitions/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/07/02/sqlite-for-c-%e2%80%93-part-6-%e2%80%93-sqlite-connection-string-definitions/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 06:40:06 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=293</guid>
		<description><![CDATA[Alright &#8211; so we are now ready to get started in earnest. The first thing we need to do when connecting to a database is setup the connection string. This article covers the various connection string parameters available for the .Net version for SQLite. Most Simple &#8211; Data Source Format: &#8220;Data Source=[DBFileName]&#8221; Example: @&#8221;Data Source=C:\CSharpHackerDemo.db3&#8243; [...]]]></description>
			<content:encoded><![CDATA[<p>Alright &#8211; so we are now ready to get started in earnest. The first thing we need to do when connecting to a database is setup the connection string. This article covers the various connection string parameters available for the .Net version for SQLite.</p>
<p><strong><span style="text-decoration: underline;">Most Simple &#8211; Data Source</span></strong><br />
Format: &#8220;Data Source=[DBFileName]&#8221;<br />
Example: @&#8221;Data Source=C:\CSharpHackerDemo.db3&#8243;</p>
<p>This connection string will create the database if it doesnt already exist without notifying you. For some utility functions this may be exactly what is desired, in some cases you want to know your DB doesnt exist!</p>
<p>If you want to programatically create the file intentionally, presumably if  &#8220;!File.Exists()&#8221; you can do:</p>
<pre class="brush: csharp;">
SQLiteConnection.CreateFile(@&amp;quot;C:\CSharpHackerDemo.db3&amp;quot;);
</pre>
<p><strong><span style="text-decoration: underline;">Only Open if it exists &#8211; FailIfMissing</span></strong><br />
Format: &#8220;Data Source=[DBFileName];FailIfMissing=True;&#8221;<br />
Example: @&#8221;Data Source=C:\CSharpHackerDemo.db3;FailIfMissing=True;&#8221;</p>
<p>With this connection string if the DB file is not present the open will fail.</p>
<p><strong><span style="text-decoration: underline;">Secure/Encrypt the DB &#8211; Password</span></strong><br />
Format: &#8220;Data Source=[DBFileName];Password=[123456789];&#8221;<br />
Example: @&#8221;Data Source=C:\CSharpHackerDemo.db3;Password=[123456789];&#8221;</p>
<p>With this connection string if the DB file will be created or opened using the password as the encryption key.</p>
<p>Other options:</p>
<ul>
<li><strong>ReadOnly</strong> &#8211; When enabled, the database will be opened for read-only access and writing will be disabled. Default False.</li>
<li><strong>CacheSize</strong> &#8211; Sets the cache size for the connection. Default value is 2000 bytes. Under the covers this calls &#8220;PRAGMA cache_size={0}&#8221;.</li>
<li><strong>PageSize</strong> &#8211; Sets the database page size. Under the covers this calls &#8220;PRAGMA page_size={0}&#8221;. Default is 1024 bytes.</li>
<li><strong>MaxPageCount</strong> &#8211; Sets the maximum number of pages the database may hold. Default is 0 which is unrestricted. Under the covers this calls &#8220;PRAGMA max_page_count={0}&#8221;.</li>
<li><strong>DateTimeFormat </strong>- Sets the datetime format for the connection. Default is ISO8601
<ul>
<li><strong>Ticks </strong>- Using ticks is not recommended and is not well supported with LINQ.</li>
<li><strong>ISO8601 </strong>- Default format for this provider.</li>
<li><strong>JulianDay </strong>- JulianDay format, which is what SQLite uses internally</li>
</ul>
</li>
<li><strong>JournalMode </strong>- Determines how SQLite handles the transaction journal file.  Under the covers this calls &#8220;PRAGMA journal_mode={0}&#8221;. Default &#8220;Delete&#8221;
<ul>
<li><strong>Delete </strong>- default mode, this causes SQLite to create and destroy the journal file as-needed.</li>
<li><strong>Persist </strong>- When this is set, SQLite will keep the journal file even after a transaction has completed.  It&#8217;s contents will be erased, and the journal re-used as often as needed.  If it is deleted, it will be recreated the next time it is needed.</li>
<li><strong>Off </strong>- This option disables the rollback journal entirely.  Interrupted transactions or a program crash can cause database corruption in this mode!</li>
</ul>
</li>
<li><strong>DefaultIsolationLevel </strong>- Sets the default isolation level for transactions on the connection. Default &#8220;Serializable&#8221;. Note this is a standard .Net &#8220;System.Data.IsolationLevel&#8221; type. Do not even try to change this <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . Only &#8220;Serializable&#8221; and &#8220;ReadCommitted&#8221; can be used, all others will throw a &#8220;NotSupportedException&#8221;. However for completeness the full list and meanings are outlined below:
<ul>
<li><strong>Serializable </strong>- A range lock is placed on the DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.</li>
<li><strong>ReadUncommitted &#8211; </strong>A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.</li>
<li><strong>ReadCommitted </strong>- Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.</li>
<li><strong>RepeatableRead </strong>- Locks are placed on all data that is used in a query, preventing other users from updating the data. Prevents non-repeatable reads but phantom rows are still possible.</li>
<li><strong>Snapshot </strong>- Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.</li>
<li><strong>Chaos </strong>- The pending changes from more highly isolated transactions cannot be overwritten.</li>
<li><strong>Unspecified </strong>- A different isolation level than the one specified is being used, but the level cannot be determined.</li>
</ul>
</li>
<li><strong>Version</strong> &#8211; Sets the default version of the SQLite engine to instantiate.  Currently the only valid value is 3, indicating version 3 of the SQLite library.</li>
<li><strong>Synchronous</strong> &#8211; Sets the synchronization mode (file flushing) of the connection string.  Default is &#8220;Normal&#8221;.  Under the covers this calls &#8220;PRAGMA synchronous={0}&#8221;. Supported values are:
<ul>
<li>Normal &#8211; Normal file flushing at critical sections of the code</li>
<li>Full &#8211; Full file flushing after every write operation</li>
<li>Off &#8211; Use the default operating system&#8217;s file flushing, SQLite does not explicitly flush the file buffers after writing</li>
</ul>
</li>
<li><strong>UseUTF16Encoding</strong> &#8211; Boolean indicator setting the encoding for the connection.  The default is &#8220;False&#8221; which indicates UTF-8 encoding.</li>
<li><strong>Pooling</strong> &#8211; Sets whether or not to use connection pooling.  The default is &#8220;False&#8221;</li>
<li><strong>BinaryGUID </strong>- Sets to or not to store GUID&#8217;s in binary format.  The default is True which saves space in the database.</li>
<li><span style="text-decoration: line-through;"><em>Deprecated</em></span> <strong>Uri</strong> &#8211; depreciated call to the data source property.</li>
<li><strong>DefaultTimeout</strong> &#8211; sets the default command timeout for newly-created commands.  This is especially useful for commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible. Time is in seconds, the default is 30 seconds.</li>
<li><strong>Enlist</strong> &#8211; Determines whether or not the connection will automatically participate in the current distributed transaction (if one exists). Default is True.</li>
<li><strong>LegacyFormat</strong> &#8211; If enabled, uses the legacy 3.xx format for maximum compatibility, but results in larger database sizes. Default is False. Under the covers this calls &#8220;PRAGMA legacy_file_format={0}&#8221;.</li>
</ul>
<p>So this is the connection string options available on the latest release. The interesting part is how I found this &#8211; in the source code (so at least now you dont need to do that part). However the next blog will be how to build the provider to help you diagnose and understand any issues you come across.</p>
<p><strong>Series Links:</strong></p>
<ul>
<li><a href="/technicalblog/index.php/2009/06/16/sqlite-for-c-part-1-am-i-allowed-to-use-it/">SQLite for C# &#8211; Part 1 &#8211; Am I allowed to use it?</a></li>
<li><a href="/technicalblog/index.php/2009/06/17/sqlite-for-c-part-2-how-do-i-setup-a-sqlite-db-without-coding/">SQLite for C# – Part 2 – How do I setup a SQLite DB (without coding)</a></li>
<li><a href="/technicalblog/index.php/2009/06/28/sqlite-for-c-%e2%80%93-part-3-%e2%80%93-my-first-c-app-using-sqlite-aka-hello-world/">SQLite for C# – Part 3 – My first C# app using SQLite aka Hello World</a></li>
<li><a href="/technicalblog/index.php/2009/06/30/sqlite-for-c-%e2%80%93-part-4-%e2%80%93-so-how-does-sqlite-stack-up-against-other-dbs/">SQLite for C# – Part 4 – So how does SQLite stack up against other DB’s?</a></li>
<li><a href="/technicalblog/index.php/2009/07/01/sqlite-for-c-%e2%80%93-part-5-%e2%80%93-sqlite-features-or-quirks/">SQLite for C# – Part 5 – SQLite ‘features’, or ‘quirks’</a></li>
<li>SQLite for C# – Part 6 – SQLite Connection String Definitions</li>
<li><a href="/technicalblog/index.php/2009/07/05/sqlite-for-c-part-7%e2%80%93building-sqlite-net-from-source/">SQLite for C# – Part 7 – Building SQLite.Net from source</a></li>
<li><a href="/technicalblog/index.php/2009/09/19/sqliteforcsharppart8loadingcsvpipeintosqliteviacommandline/">SQLite for C# – Part 8 – Loading CSV/Pipe into SQLite via command line</a></li>
</ul>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">
<pre><span><span style="font-size: x-small;"><span style="color: #008080;"> SQLiteConnection</span>.CreateFile(<span style="color: #800000;">"c:\\mydatabasefile.db3"</span>);</span></span><span><span style="font-size: x-small;"><span style="color: #008080;"> SQLiteConnection</span>.CreateFile(<span style="color: #800000;">"c:\\mydatabasefile.db3"</span>);</span></span></pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/07/02/sqlite-for-c-%e2%80%93-part-6-%e2%80%93-sqlite-connection-string-definitions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SQLite for C# – Part 5 – SQLite &#8216;features&#8217;, or &#8216;quirks&#8217;</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/07/01/sqlite-for-c-%e2%80%93-part-5-%e2%80%93-sqlite-features-or-quirks/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/07/01/sqlite-for-c-%e2%80%93-part-5-%e2%80%93-sqlite-features-or-quirks/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 05:21:09 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=281</guid>
		<description><![CDATA[So before I start I dont want to get into any religious debates on if this is a feature,  a quirk or something else. The goal here is to identify areas where SQLite behaves differently than either other DB systems or just in an unexpected/unanticipated way. So starting with the biggies: 1) Limited Database enforced [...]]]></description>
			<content:encoded><![CDATA[<p>So before I start I dont want to get into any religious debates on if this is a feature,  a quirk or something else. The goal here is to identify areas where SQLite behaves differently than either other DB systems or just in an unexpected/unanticipated way.</p>
<p>So starting with the biggies:</p>
<p><strong>1) Limited Database enforced Type Safety:</strong></p>
<pre class="brush: sql;">
CREATE TABLE  IF NOT EXISTS Book
(
BookISBN     varchar(14) primary key
,Name         varchar(200)
,PublisherId    int
);

INSERT INTO BOOK(BookISBN,Name)
VALUES(
     &amp;quot;ReallyLongValueThatShouldCauseAProblem&amp;quot;
    , &amp;quot;CSharpHacker SQLite Manual&amp;quot;);
</pre>
<p>Most DBs honor the restrictions of the character lengths. SQLite will record the information you submit to it &#8211; even it is technically breaks your DDL definitions. More about this can be read about it <a href="http://www.sqlite.org/datatype3.html">Datatypes In SQLite Version 3</a>. What should specifically be called out is:</p>
<blockquote><p>Any column in a version 3 database, except an INTEGER PRIMARY KEY column, may be used to store any type of value.</p></blockquote>
<p>So a more outlandish example would be:</p>
<pre class="brush: sql;">
DROP TABLE IF EXISTS Issue;
CREATE TABLE  IF NOT EXISTS Issue
(
 IssueId 	int
,Description	varchar(200)
);
INSERT INTO Issue(IssueId,Description)
VALUES(
     &amp;quot;ReallyLongTextValueThatShouldCauseAProblem&amp;quot;
     , &amp;quot;CSharpHacker SQLite Manual&amp;quot;);
SELECT * from Issue;
</pre>
<p>If you run the above you get &#8220;ReallyLongTextValueThatShouldCauseAProblem|CSharpHacker SQLite Manual&#8221;, with no errors!<br />
Is that the sound of DBA&#8217;s running away screaming in horror&#8230;? Believe it or not this was intentional, and &#8216;sometimes&#8217; sensible <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . I&#8217;ll cover a little more on that later, but lets go full circle on this.</p>
<p>Underneath the covers there is a 64 bit row identifier attached to every row, but if you want to use your own you can override that to use your own values. If you do this then this column categorically has to be an INTEGER value. So looking at the SQL below you can see we have now changed the type from &#8216;int&#8217; to &#8216;INTEGER PRIMARY KEY&#8217;. This now enforces you have a value that is an integer for this one column, and the below fails with a &#8220;SQL error near line xx: datatype mismatch&#8221;.</p>
<pre class="brush: sql;">
DROP TABLE IF EXISTS Issue2;
CREATE TABLE  IF NOT EXISTS Issue2
(
 IssueId 	INTEGER Primary key
,Description	varchar(200)
);
INSERT INTO Issue2(IssueId,Description)
VALUES(
     &amp;quot;ReallyLongTextValueThatShouldCauseAProblem&amp;quot;
    , &amp;quot;CSharpHacker SQLite Manual&amp;quot;);
SELECT * from Issue2;
</pre>
<p>So one final warning &#8220;INTEGER PRIMARY KEY&#8221; is the same as &#8220;integer primary key&#8221;, but not &#8220;int primary key&#8221;. If you are wanting to override the internal 64 bit row identifier you have to use &#8220;integer&#8221; and not &#8220;int&#8221;, &#8220;bigint&#8221;, &#8220;short integer&#8221;. Thats an easy one to miss! Final quirk is that the &#8220;INTEGER PRIMARY KEY&#8221; needs to be exactly that or &#8220;INTEGER PRIMARY KEY ASC&#8221; (case insensitive), but &#8220;INTEGER PRIMARY KEY DESC&#8221; will not use the internal ID.</p>
<p><strong>2. Only one process can write to the DB at the same time</strong></p>
<p>The locking in SQLite is not fine grained! If anyone is writing to the DB it locks everyone and everything else out of the DB. All readers and writers are blocked until the pending write is done. So if you are expecting a lot of concurrent writes to the database that may need to be interleaved with some reads from other threads/processes you may experience some blocking. In reality it shouldnt matter too much as the writes are normally speedy. It should also be noted that in SQLite v2 there was a possibility of writer starvation where so many reads are going on the writer was never able to lock the file to perform the write &#8211; this has been addressed in SQLite V3.</p>
<p><strong>3. Limited support for ALTER TABLE</strong></p>
<p>Now I bet this has driven off the DBA&#8217;s now! Because of its heritage SQLite team hasn&#8217;t ever needed to support the more complex data migrations supported by other database products. You can use to add a column to the end of a table or to change the name of a table. However if you want to make more complex changes in the structure of a table, you have to recreate a new table and then copy the contents of your old table into the new one. </p>
<p><strong>4. Foreign Keys are &#8216;recorded&#8217; but not enforced</strong></p>
<p>Technically the same thing can be achieved using the &#8216;Triggers&#8217;, but you need to be aware that these are &#8216;soft RI&#8217; keys and are not enforced by the database engine.</p>
<p><strong>5. Support for UPSERT via &#8220;REPLACE&#8221; or &#8220;INSERT OR REPLACE&#8221;</strong></p>
<p>For MySQL users they are familiar with REPLACE, SQLite has aliased REPLACE to its native &#8220;INSERT OR REPLACE&#8217;. </p>
<p>So if you are still reading that is good! This is definitely the scary page that drives a few DBA&#8217;s into fits, but its sensible to know what you are using and its behaviors before it surprises you.</p>
<p><strong>Related Links:</strong></p>
<ul>
<li><a href="/technicalblog/index.php/2009/06/16/sqlite-for-c-part-1-am-i-allowed-to-use-it/">SQLite for C# &#8211; Part 1 &#8211; Am I allowed to use it?</a></li>
<li><a href="/technicalblog/index.php/2009/06/17/sqlite-for-c-part-2-how-do-i-setup-a-sqlite-db-without-coding/">SQLite for C# – Part 2 – How do I setup a SQLite DB (without coding)</a></li>
<li><a href="/technicalblog/index.php/2009/06/28/sqlite-for-c-%e2%80%93-part-3-%e2%80%93-my-first-c-app-using-sqlite-aka-hello-world/">SQLite for C# – Part 3 – My first C# app using SQLite aka Hello World</a></li>
<li><a href="/technicalblog/index.php/2009/06/30/sqlite-for-c-%e2%80%93-part-4-%e2%80%93-so-how-does-sqlite-stack-up-against-other-dbs/">SQLite for C# – Part 4 – So how does SQLite stack up against other DB’s?</a></li>
<li>SQLite for C# – Part 5 – SQLite ‘features’, or ‘quirks’</li>
<li><a href="/technicalblog/index.php/2009/07/02/sqlite-for-c-%e2%80%93-part-6-%e2%80%93-sqlite-connection-string-definitions/">SQLite for C# – Part 6 – SQLite Connection String Definitions</a></li>
<li><a href="/technicalblog/index.php/2009/07/05/sqlite-for-c-part-7%e2%80%93building-sqlite-net-from-source/">SQLite for C# – Part 7 – Building SQLite.Net from source</a></li>
<li><a href="/technicalblog/index.php/2009/09/19/sqliteforcsharppart8loadingcsvpipeintosqliteviacommandline/">SQLite for C# – Part 8 – Loading CSV/Pipe into SQLite via command line</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/07/01/sqlite-for-c-%e2%80%93-part-5-%e2%80%93-sqlite-features-or-quirks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite for C# – Part 4 – So how does SQLite stack up against other DB&#8217;s?</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/06/30/sqlite-for-c-%e2%80%93-part-4-%e2%80%93-so-how-does-sqlite-stack-up-against-other-dbs/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/06/30/sqlite-for-c-%e2%80%93-part-4-%e2%80%93-so-how-does-sqlite-stack-up-against-other-dbs/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 06:01:59 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=274</guid>
		<description><![CDATA[Well I would actually advocate the question/title of this topic is misplaced. This is really the question I would have asked probably 4 months ago, and in all likelihood dismissed SQLite after hearing the answers! So bear with me, its worth the read! The key question that really should be asked is not how it [...]]]></description>
			<content:encoded><![CDATA[<p>Well I would actually advocate the question/title of this topic is misplaced. This is really the question I would have asked probably 4 months ago, and in all likelihood dismissed SQLite after hearing the answers! So bear with me, its worth the read! The key question that really should be asked is <span style="text-decoration: underline;"><strong>not</strong></span> how it stacks up, but what are its strengths and in what circumstances should I use it. In essence what problems is SQLite designed to solve rather than academic bullet point comparisons.</p>
<p>However back to the question &#8211; How does it stack up?</p>
<table style="height: 248px;" border="1" width="415">
<tbody>
<tr>
<th>Question</th>
<th>SQLite</th>
<th>SQL Server</th>
<th>SQL CE</th>
</tr>
<tr>
<td>Support multiple clients</td>
<td>Y (not in client server mode, but shared file access)</td>
<td>Y</td>
<td>N</td>
</tr>
<tr>
<td>Requires Server process</td>
<td>N</td>
<td>Y</td>
<td>N</td>
</tr>
<tr>
<td>Support views</td>
<td>Y</td>
<td>Y</td>
<td>N</td>
</tr>
<tr>
<td>Support Stored Procedures</td>
<td>N</td>
<td>Y</td>
<td>N</td>
</tr>
<tr>
<td>Trigger Support</td>
<td>Y</td>
<td>Y</td>
<td>N</td>
</tr>
<tr>
<td>Foreign Key Constraints</td>
<td>N &#8211; Can be achieved via triggers</td>
<td>Y</td>
<td>Y</td>
</tr>
<tr>
<td>Multiple processes read/write to DB</td>
<td>Y</td>
<td>Y</td>
<td>N</td>
</tr>
<tr>
<td>Natively Support Microsoft Replication</td>
<td>N</td>
<td>Y</td>
<td>Y</td>
</tr>
<tr>
<td>Max DB size</td>
<td>Big (max pages=1073741823 * max page size=32768)</td>
<td>Too big to matter!</td>
<td>4 Gb</td>
</tr>
<tr>
<td>Max CPUs</td>
<td>All</td>
<td>All</td>
<td>1</td>
</tr>
<tr>
<td>Max CPUs</td>
<td>All</td>
<td>All</td>
<td>1</td>
</tr>
<tr>
<td>#Files to distribute</td>
<td>1</td>
<td>100&#8242;s</td>
<td>2-7</td>
</tr>
<tr>
<td>Run Windows Mobile Devices</td>
<td>Y</td>
<td>N</td>
<td>Y</td>
</tr>
<tr>
<td>Run Non Windows Mobile Devices</td>
<td>Y</td>
<td>N</td>
<td>N</td>
</tr>
<tr>
<td>Support in MONO</td>
<td>Y</td>
<td>N</td>
<td>N</td>
</tr>
</tbody>
</table>
<p>As you can see SQL Server definitely has the most features, in fact as far as features go its a slam dunk. However often feature count just isn&#8217;t everything. The major drawback for SQL Server is that it requires a Server process to run, and that then means maintenance, probably a DBA and all of a sudden things have got complicated (and expensive)! So we come back to the question &#8220;What are we looking to do with the database?&#8221;. If the answer is heavy duty processing that requires stored procedures, cubes and large amount of concurrent remote access by users &#8211; SQL Server is definitely your answer. However I have to think that you are reading this because SQL Server is too heavy weight for your needs. So on to the other candidates.</p>
<p>SQL CE is a Microsoft database that started in the mobile space and moved up to the PC platform. Overall is has reasonable features but is known to be slower and heavier than SQLite. It definitely has some strengths in the SQL Server ==&gt; SQL CE replication, but outside of that its largely even or less featured that SQLite. If you are looking for replication definitely checkout SQL CE, but I would also say the <a href="http://msdn.microsoft.com/en-us/sync/bb821992.aspx">Microsoft Synch</a> framework is evolving and we may see a native SQLite provider (or determine that the ADO.NET is sufficient) in this area.</p>
<p>SQLite is a lightweight add-on to C# (System.Data.SQLite.DLL ~ 850Kb). You may note this is heavier than the often referenced SQLite runtimes take &#8220;200Kb&#8221;, but in this 850Kb (457Kb Zipped) is the SQL DLL, ADO.NET SQLite provider and the magic glue to bring these two worlds together. If you are using .Net you can assume you have to assume your package size will go up by 457Kb, and the runtime size on disk will be ~850Kb. Performance of SQLite ranks it above SQL CE for insert tests, and it has a lower file size &#8211; and the database can be assessed on a massive number of operating systems!</p>
<p>Before you jump whole heartedly on the SQLite bandwagon, it is only fair to also point out SQLite has some quirks (SQLite folks call these &#8216;features&#8217; &#8211; I&#8217;m not going to argue, but its approach is different in a couple of cases). I&#8217;m going to cover these in the next blog entry &#8220;Part 5&#8243;. These are things that you definitely need to be aware of rather than discover!</p>
<p>The key question that the article should be asking is &#8220;What type of application features benefits from SQLite?&#8221;. The best way I can describe SQLite is that is is an &#8220;Application Data Store&#8221; that you then have ANSI-92 SQL access to. This removes the needs of rolling your own indexing into files, creating convoluted file system &#8216;databases&#8217; etc. If you can wrap your head around how you can use SQLite to your advantage I think you will be pleasantly surprised.</p>
<p><strong>Related Links:</strong></p>
<ul>
<li><a href="/technicalblog/index.php/2009/06/16/sqlite-for-c-part-1-am-i-allowed-to-use-it/">SQLite for C# &#8211; Part 1 &#8211; Am I allowed to use it?</a></li>
<li><a href="/technicalblog/index.php/2009/06/17/sqlite-for-c-part-2-how-do-i-setup-a-sqlite-db-without-coding/">SQLite for C# – Part 2 – How do I setup a SQLite DB (without coding)</a></li>
<li><a href="/technicalblog/index.php/2009/06/28/sqlite-for-c-%e2%80%93-part-3-%e2%80%93-my-first-c-app-using-sqlite-aka-hello-world/">SQLite for C# – Part 3 – My first C# app using SQLite aka Hello World</a></li>
<li>SQLite for C# – Part 4 – So how does SQLite stack up against other DB’s?</li>
<li><a href="/technicalblog/index.php/2009/07/01/sqlite-for-c-%e2%80%93-part-5-%e2%80%93-sqlite-features-or-quirks/">SQLite for C# – Part 5 – SQLite ‘features’, or ‘quirks’</a></li>
<li><a href="/technicalblog/index.php/2009/07/02/sqlite-for-c-%e2%80%93-part-6-%e2%80%93-sqlite-connection-string-definitions/">SQLite for C# – Part 6 – SQLite Connection String Definitions</a></li>
<li><a href="/technicalblog/index.php/2009/07/05/sqlite-for-c-part-7%e2%80%93building-sqlite-net-from-source/">SQLite for C# – Part 7 – Building SQLite.Net from source</a></li>
<li><a href="/technicalblog/index.php/2009/09/19/sqliteforcsharppart8loadingcsvpipeintosqliteviacommandline/">SQLite for C# – Part 8 – Loading CSV/Pipe into SQLite via command line</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/06/30/sqlite-for-c-%e2%80%93-part-4-%e2%80%93-so-how-does-sqlite-stack-up-against-other-dbs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Morning C# news &#8211; and more</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/06/29/morning-c-news-and-more/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/06/29/morning-c-news-and-more/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 13:07:46 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=265</guid>
		<description><![CDATA[This one has just been reported, but if you havnt seen it - it is very exciting!

    * Mono on the iPhone.... To say this is exciting is an understatement. Unfortunately I'm a little afraid that Apple wont like it too much (read allow it in their TOS). Mono isnormally an interpreted l...

]]></description>
			<content:encoded><![CDATA[<p>This one has just been reported, but if you havnt seen it &#8211; it is very exciting!</p>
<ul>
<li><a href="http://tirania.org/blog/archive/2009/Jun-29.html">Mono on the iPhone</a>&#8230;. To say this is exciting is an understatement. Unfortunately I&#8217;m a little afraid that Apple wont like it too much (read allow it in their TOS).<br />
<blockquote><p>&#8220;3.3.2 An Application may not itself install or launch other executable code by any means, including without limitation through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise. No interpreted code may be downloaded and used in an Application except for code that is interpreted and run by Apple&#8217;s Published APIs and built-in interpreter(s)&#8221;</p></blockquote>
<p>.Mono is normally an interpreted language very similar to Java and the TOS explictly disallows running byte code on the machine.  So this could be VERY interesting, or it could be a nice concept and not never to hit the Apple store. Definitely watch this space!Otherwise we will end up with a compiler than generates Object C code <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </li>
<li><a href="http://www.theregister.co.uk/2009/06/29/firefox_3_5/">Firefox 3.5 should be out tomorrow</a>.</li>
<li>Another EDW appliance comes into the fold with <a href="http://www.dbms2.com/2009/06/29/aster-data-ncluster-mapreduce-appliance/">Aster Data</a>.</li>
<li>Simple problems highlighted with &#8220;<a href="http://sqlblogcasts.com/blogs/simons/archive/2009/06/29/Hyperlinks-in-custom-reports.aspx">SQL Server 2005 reporting in management studio</a>&#8220;.</li>
</ul>
<p>Gareth</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/06/29/morning-c-news-and-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite for C# – Part 3 – My first C# app using SQLite aka Hello World</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/06/28/sqlite-for-c-%e2%80%93-part-3-%e2%80%93-my-first-c-app-using-sqlite-aka-hello-world/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/06/28/sqlite-for-c-%e2%80%93-part-3-%e2%80%93-my-first-c-app-using-sqlite-aka-hello-world/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 02:06:46 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=236</guid>
		<description><![CDATA[Below we have an equivalent to &#8220;Hello World&#8221; in SQLite. OK its not really a &#8220;Hello World&#8221; application &#8211; but it does have all the core components to kick start a C# coder to get started with SQLite. Its definitely not elegant, nor the way you would choose to actually do this &#8211; but it [...]]]></description>
			<content:encoded><![CDATA[<p>Below we have an equivalent to &#8220;Hello World&#8221; in SQLite. OK its not really a &#8220;Hello World&#8221; application &#8211; but it does have all the core components to kick start a C# coder to get started with SQLite. Its definitely not elegant, nor the way you would choose to actually do this &#8211; but it does run and provides a fair bit of knowledge in a relatively small package.</p>
<p>In order for the code to run you will need to have installed &#8220;<a href="http://sourceforge.net/projects/sqlite-dotnet2">SQLite.Net</a>&#8221; and reference the &#8220;System.Data.SQLite&#8221; DLL (probably found at <code>"C:\Program Files\SQLite.NET\bin\System.Data.SQLite.dll"</code>). With this and the below code you should have something to get started with.</p>
<pre class="c#">
<pre class="brush: csharp;">
using System;
using System.Data;
using System.Data.Common;
using System.Data.SQLite;

namespace SampleSqliteConsoleDemo
{
   class Program
   {
      static void Main(string[] args)
      {
         // Create table and information using native types
         using (SQLiteConnection conn = new SQLiteConnection(@&amp;quot;Data Source=c:\testperf.db&amp;quot;))
         {
            conn.Open();
            using (SQLiteCommand comm = new SQLiteCommand())
            {
               int limit = 100;
               comm.Connection = conn;
               comm.CommandText = &amp;quot;DROP TABLE IF EXISTS test;&amp;quot; +
                                  &amp;quot;CREATE TABLE IF NOT EXISTS test (n integer);&amp;quot;;
               try
               {
                  comm.ExecuteNonQuery();
                  using (SQLiteTransaction tran = conn.BeginTransaction())
                  {
                     // You can use the below in the for loop if you 'need'
                     // to, and it does make it 'easier' to read as you dont
                     // need the additional param code but not only is this
                     // faster, but avoids the potential for SQL injection.
                     //comm.CommandText = &amp;quot;INSERT INTO test values (&amp;quot; + i.ToString() + &amp;quot;)&amp;quot;;

                     comm.CommandText = &amp;quot;INSERT INTO test values (@myTestIndex)&amp;quot;;
                     DbParameter param = comm.CreateParameter();
                     param.ParameterName = &amp;quot;myTestIndex&amp;quot;;
                     param.DbType = DbType.Int32;
                     comm.Parameters.Add(param);

                     for (int i = 0; i &amp;lt; limit; i++)
                     {
                        param.Value = i;
                        comm.ExecuteNonQuery();
                     }
                     tran.Commit();
                  }
               }
               catch (SQLiteException exception)
               {
                  Console.WriteLine(&amp;quot;Failed :&amp;quot; + exception.Message);
               }
            }
            conn.Close();
         }

         // Access data using the more traditional ADO.NET namespace
         DbProviderFactory fact = DbProviderFactories.GetFactory(&amp;quot;System.Data.SQLite&amp;quot;);
         using (DbConnection cnn = fact.CreateConnection())
         {
            cnn.ConnectionString = &amp;quot;Data Source=c:\\testperf.db&amp;quot;;
            cnn.Open();
            {
               IDbCommand dbcmd = cnn.CreateCommand();
               string sql =
                  &amp;quot;SELECT n &amp;quot; +
                  &amp;quot;FROM test&amp;quot;;
               dbcmd.CommandText = sql;
               IDataReader reader = dbcmd.ExecuteReader();
               while (reader.Read())
               {
                  Console.WriteLine(&amp;quot;n: &amp;quot; + reader.GetInt32(0));
               }
           }
         }
      }
   }
}
</pre>
</pre>
<p>So the things to note are:</p>
<ul>
<li>This this is obviously not a guide for great programming &#8211; but it should touch on the highlevels to access information from SQLite.</li>
<li>We are using a combination of direct instantiation of &#8220;SQLiteConnection&#8221; and the ADO.NET base classes. Normally you should try to just use the base classes where possible for portability (should you want to change the DB). We chose both just to highlight the two approaches.</li>
<li>The DDL creation uses the SQLite &#8220;<a href="http://www.sqlite.org/lang_droptable.html">IF EXISTS</a>&#8221; for DROP TABLE and &#8220;<a href="http://www.sqlite.org/lang_createtable.html">IF NOT EXISTS</a>&#8221; for the CREATE TABLE. These are handy features, but are not standard.</li>
<li>Instead of using the commonly found string concatenation approach to execute the SQL (most introduction web examples show this) we show the preferred approach using DbParameter. This is not only safer (avoids SQL Injection), but is faster as well! Hard to complain about faster and more secure!</li>
</ul>
<p><strong>Related Links:</strong></p>
<ul>
<li><a href="/technicalblog/index.php/2009/06/16/sqlite-for-c-part-1-am-i-allowed-to-use-it/">SQLite for C# &#8211; Part 1 &#8211; Am I allowed to use it?</a></li>
<li><a href="/technicalblog/index.php/2009/06/17/sqlite-for-c-part-2-how-do-i-setup-a-sqlite-db-without-coding/">SQLite for C# – Part 2 – How do I setup a SQLite DB (without coding)</a></li>
<li>SQLite for C# – Part 3 – My first C# app using SQLite aka Hello World</li>
<li><a href="/technicalblog/index.php/2009/06/30/sqlite-for-c-%e2%80%93-part-4-%e2%80%93-so-how-does-sqlite-stack-up-against-other-dbs/">SQLite for C# – Part 4 – So how does SQLite stack up against other DB’s?</a></li>
<li><a href="/technicalblog/index.php/2009/07/01/sqlite-for-c-%e2%80%93-part-5-%e2%80%93-sqlite-features-or-quirks/">SQLite for C# – Part 5 – SQLite ‘features’, or ‘quirks’</a></li>
<li><a href="/technicalblog/index.php/2009/07/02/sqlite-for-c-%e2%80%93-part-6-%e2%80%93-sqlite-connection-string-definitions/">SQLite for C# – Part 6 – SQLite Connection String Definitions</a></li>
<li><a href="/technicalblog/index.php/2009/07/05/sqlite-for-c-part-7%e2%80%93building-sqlite-net-from-source/">SQLite for C# – Part 7 – Building SQLite.Net from source</a></li>
<li><a href="/technicalblog/index.php/2009/09/19/sqliteforcsharppart8loadingcsvpipeintosqliteviacommandline/">SQLite for C# – Part 8 – Loading CSV/Pipe into SQLite via command line</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/06/28/sqlite-for-c-%e2%80%93-part-3-%e2%80%93-my-first-c-app-using-sqlite-aka-hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Want to install SQL2008 on Windows 2008 RC2 (or Windows 7)?</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/06/25/want-to-install-sql2008-on-windows-2008-rc2-or-windows-7/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/06/25/want-to-install-sql2008-on-windows-2008-rc2-or-windows-7/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 11:55:31 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[SQLServer]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=230</guid>
		<description><![CDATA[Unfortunately its not as simple as you would think, SQL Server 2008 install requires the .NET 3.5 framework to be installed or will install it as part of the pre-req checking.   Changes in Windows 7 can prevent SQL Server 2008 from installing the .NET 3.5 framework pre-requisite.   Instead you may need to install the framework [...]]]></description>
			<content:encoded><![CDATA[<p>Unfortunately its not as simple as you would think, SQL Server 2008 install requires the .NET 3.5 framework to be installed or will install it as part of the pre-req checking.   Changes in Windows 7 can prevent SQL Server 2008 from installing the .NET 3.5 framework pre-requisite.   Instead you may need to install the framework separately using the &#8220;Run this program in compatibility mode&#8221;.  Read <a href="http://blogs.msdn.com/psssql/archive/2009/06/24/installing-net-3-5-framework-for-sql-server-2008-on-a-windows-7-windows-2008-rc2-builds.aspx">here</a> for more information.</p>
<p><strong>UPDATE 2009-06-29:</strong> It seems there are similar issues with SQL2005 as well, have a look <a href="http://sqlserver-qa.net/blogs/tools/archive/2009/06/29/sql-server-version-has-a-known-compatibility-issues-with-windows-7-rc-this-warning-is-genuine-and-applies-to-all-sql-server-editions-including-all-express-editions.aspx">SQL Server version has a known compatibility issues with Windows 7 RC. This warning is genuine and applies to all SQL Server editions, including all Express editions</a>.</p>
<p>Gareth</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/06/25/want-to-install-sql2008-on-windows-2008-rc2-or-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite for C# &#8211; Part 2 &#8211; How do I setup a SQLite DB (without coding)</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/06/17/sqlite-for-c-part-2-how-do-i-setup-a-sqlite-db-without-coding/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/06/17/sqlite-for-c-part-2-how-do-i-setup-a-sqlite-db-without-coding/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 12:51:13 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=182</guid>
		<description><![CDATA[Before jumping into C# code we really need to understand how to setup a template database to query and setup. This article will show non-coding ways to setup and define your database schema. Next one we will dive fully into the code aspect of the SQLite interface. Using the native tool &#8211; SQLite3.exe Unfortunately while [...]]]></description>
			<content:encoded><![CDATA[<p>Before jumping into C# code we really need to understand how to setup a template database to query and setup. This article will show non-coding ways to setup and define your database schema. Next one we will dive fully into the code aspect of the SQLite interface.</p>
<p><span style="text-decoration: underline;"><strong>Using the native tool &#8211; SQLite3.exe</strong></span></p>
<p>Unfortunately while the package &#8220;<a href="http://sourceforge.net/projects/sqlite-dotnet2">http://sourceforge.net/projects/sqlite-dotnet2</a>&#8221; does contain the SQLite runtime access DLL&#8217;s it doesn&#8217;t contain all the tools that are supplied as part of the base package. The most useful one is SQLite3, this can be found on the <a href="http://www.sqlite.org/download.html">SQLite download page</a>. Search for &#8220;Precompiled Binaries For Windows&#8221; and find the SQLite_x_y_z.zip download, at the time of writing this is the current version <a href="http://www.sqlite.org/sqlite-3_6_15.zip">sqlite-3_6_15.zip</a> (note if you are reading this at some point later than 24 June I suggest you ensure you get the latest version).</p>
<p>SQLite3.exe provides command line access to the SQLite engine, for full usage and capabilities check out <a href="http://www.sqlite.org/sqlite.html">http://www.sqlite.org/sqlite.html</a> for more information.</p>
<p>However to create a very (and I really do mean VERY simplistic) database we can write the SQL schema and then add it into a new database.  So lets quickly knock up a very simple example:</p>
<blockquote><p><code>CREATE TABLE Publisher<br />
(<br />
PublisherId     int primary key<br />
,Name         varchar(200)<br />
);<br />
CREATE TABLE Book<br />
(<br />
BookISBN     varchar(14) primary key<br />
,Name         varchar(200)<br />
,PublisherId    int<br />
);</code></p>
<p>INSERT INTO BOOK(BookISBN,Name) VALUES(&#8220;1-84356-028-3&#8243;, &#8220;CSharpHacker SQLite Manual&#8221;);<br />
INSERT INTO BOOK(BookISBN,Name) VALUES(&#8220;1-84356-029-3&#8243;, &#8220;SQLite vs VistaDB&#8221;);<br />
INSERT INTO BOOK(BookISBN,Name) VALUES(&#8220;1-84356-030-3&#8243;, &#8220;SQLite vs SQL Server CE&#8221;);<br />
INSERT INTO BOOK(BookISBN,Name) VALUES(&#8220;1-84356-031-3&#8243;, &#8220;SQLite vs Velocity Caching&#8221;);<br />
.quit</p></blockquote>
<p>This is our super simple schema that will evolve as this series moves on, but say for now we think this is the best schema since sliced bread was invented! You will notice the .quit at the end, this is used because we are just going to pipe this into the Sqlite3 application to create the database. So you need to save the above code into a file &#8220;CSharpRamblingCoder.sql&#8221; and then run the below:</p>
<p><code>sqlite3.exe ramblingCoder.db3 &lt; CSharpRamblingCoder.sql</code></p>
<p>You will notice this will auto create the database file and fill it up for you. <span style="text-decoration: underline;">In fact one of the quirkier aspects of this database is that the default behavior is that it will auto create the data file if it cant find the one you specified</span>. For example if you use SQLite3 or the .Net provider and supply a DB file that doesn&#8217;t exist then that DB container file gets created on the fly. We will go into a bit more detail on the SQL constructs SQLite uses in a later series, but for now I think this covers the initial &#8220;How do I create a new SQLite database?&#8221; and &#8220;How do I get my schema into a new SQLite database?&#8221;</p>
<p><span style="text-decoration: underline;"><strong>Users of Visual Studio 2008 Full Edition</strong></span></p>
<p>So assuming you followed the instructions in <a href="/technicalblog/index.php/2009/06/16/sqlite-for-c-part-1-am-i-allowed-to-use-it/">Part 1</a> and selected the full Visual Studio 2008 add-in you have a second way to create, setup and interrogate the database. This has to do with the &#8220;Server Explorer&#8221;, note at the time of writing this is an early cut of code so just be aware of that <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p>So if you now look at the &#8220;Server Explorer&#8221; you should see something like this (or have previous connections setup):</p>
<p><img class="alignnone size-full wp-image-191" title="sqliteexplorer1" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer1.jpg" alt="sqliteexplorer1" width="239" height="113" /></p>
<p>From here if you right mouse button on &#8220;Data Connections&#8221; you will be prompted to add a &#8220;New Connection&#8230;&#8221;:</p>
<p><img class="alignnone size-full wp-image-193" title="sqliteexplorer3" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer3.jpg" alt="sqliteexplorer3" width="328" height="174" /></p>
<p>This then will bring you to the &#8220;Add Connection&#8221; dialog, ensure that the &#8220;Data source:&#8221; is setup to be &#8220;SQLite Database File &#8230;&#8221; rather than anything else.</p>
<p><img class="alignnone size-full wp-image-194" title="sqliteexplorer4" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer4.jpg" alt="sqliteexplorer4" width="341" height="532" /></p>
<p>If this is not the case you need to &#8220;Change&#8230;&#8221; and select the SQLite driver:</p>
<p><img class="alignnone size-full wp-image-195" title="sqliteexplorer5" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer5.jpg" alt="sqliteexplorer5" width="438" height="256" /></p>
<p>Now make sure you have filled in the Database file name as a pathed location.</p>
<p><img class="alignnone size-full wp-image-196" title="sqliteexplorer6" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer6.jpg" alt="sqliteexplorer6" width="344" height="534" /></p>
<p>And congratulations you have just made an empty SQLite database!!!</p>
<p><img class="alignnone size-full wp-image-197" title="sqliteexplorer7" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer7.jpg" alt="sqliteexplorer7" width="238" height="122" /></p>
<p>To confirm this open up the CSharpCoderSample and see that you have holding places for Tables, System Tables and views.</p>
<p><img class="alignnone size-full wp-image-198" title="sqliteexplorer8" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer8.jpg" alt="sqliteexplorer8" width="234" height="141" /></p>
<p>Having a DB without any tables or functionality obviously isnt terribly useful, so lets add a table via the UI. Right mouse on the &#8220;tables&#8221; and select &#8220;Add New Table&#8221;.</p>
<p><img class="alignnone size-full wp-image-199" title="sqliteexplorer9" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer9.jpg" alt="sqliteexplorer9" width="233" height="195" /></p>
<p>This opens up a new tab in Visual Studio and you can start to fill in the information as you would normally:</p>
<p><img class="alignnone size-full wp-image-200" title="sqliteexplorer10" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer10.jpg" alt="sqliteexplorer10" width="383" height="114" /></p>
<p>Here is a new table I just imagined I may need at some point in the future <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-201" title="sqliteexplorer11" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer11.jpg" alt="sqliteexplorer11" width="346" height="144" /></p>
<p>From here you save the table, I prefer Control+S but any save option works and you are prompted for the table name.</p>
<p><img class="alignnone size-full wp-image-202" title="sqliteexplorer12" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer12.jpg" alt="sqliteexplorer12" width="433" height="274" /></p>
<p>Ok we now have our first graphically built table &#8211; woo hoo!</p>
<p><img class="alignnone size-full wp-image-203" title="sqliteexplorer13" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer13.jpg" alt="sqliteexplorer13" width="234" height="271" /></p>
<p>So to expedite things you can run:</p>
<p><code>sqlite3.exe c:\CSharpCoderSample.db3 &lt; CSharpRamblingCoder.sql</code></p>
<p>And after pressing refresh you can see the tables updated in the Server explorer.</p>
<p><img class="alignnone size-full wp-image-204" title="sqliteexplorer14" src="http://www.csharphacker.com/technicalblog/wp-content/uploads/2009/06/sqliteexplorer14.jpg" alt="sqliteexplorer14" width="233" height="306" /></p>
<p>Note since this add in is a early release it is not as fully featured as you would ideally like, but it is a nice way to peer into the database structure and actual data without needing to leave the IDE which is always a nice to have!</p>
<p>So now we know how to create a empty database &amp; add schema. The final part is how to delete the database! Thankfully this is equally as obvious <img src='http://www.csharphacker.com/technicalblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> , delete the file c:\CSharpCoderSample.db3.</p>
<p>Now we are ready to get coding! Part 3 covers our first C# application to utilize the SQLite database.</p>
<p><strong>Related Links:</strong></p>
<ul>
<li><a href="/technicalblog/index.php/2009/06/16/sqlite-for-c-part-1-am-i-allowed-to-use-it/">SQLite for C# &#8211; Part 1 &#8211; Am I allowed to use it?</a></li>
<li>SQLite for C# – Part 2 – How do I setup a SQLite DB (without coding)</li>
<li><a href="/technicalblog/index.php/2009/06/28/sqlite-for-c-%e2%80%93-part-3-%e2%80%93-my-first-c-app-using-sqlite-aka-hello-world/">SQLite for C# – Part 3 – My first C# app using SQLite aka Hello World</a></li>
<li><a href="/technicalblog/index.php/2009/06/30/sqlite-for-c-%e2%80%93-part-4-%e2%80%93-so-how-does-sqlite-stack-up-against-other-dbs/">SQLite for C# – Part 4 – So how does SQLite stack up against other DB’s?</a></li>
<li><a href="/technicalblog/index.php/2009/07/01/sqlite-for-c-%e2%80%93-part-5-%e2%80%93-sqlite-features-or-quirks/">SQLite for C# – Part 5 – SQLite ‘features’, or ‘quirks’</a></li>
<li><a href="/technicalblog/index.php/2009/07/02/sqlite-for-c-%e2%80%93-part-6-%e2%80%93-sqlite-connection-string-definitions/">SQLite for C# – Part 6 – SQLite Connection String Definitions</a></li>
<li><a href="/technicalblog/index.php/2009/07/05/sqlite-for-c-part-7%e2%80%93building-sqlite-net-from-source/">SQLite for C# – Part 7 – Building SQLite.Net from source</a></li>
<li><a href="/technicalblog/index.php/2009/09/19/sqliteforcsharppart8loadingcsvpipeintosqliteviacommandline/">SQLite for C# – Part 8 – Loading CSV/Pipe into SQLite via command line</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/06/17/sqlite-for-c-part-2-how-do-i-setup-a-sqlite-db-without-coding/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ADO.Net depreciating System.Data.OracleClient, but it didnt rank in Google&#8230;</title>
		<link>http://www.csharphacker.com/technicalblog/index.php/2009/06/17/adonet-depreciating-systemdataoracleclient-but-it-didnt-rank-in-google/</link>
		<comments>http://www.csharphacker.com/technicalblog/index.php/2009/06/17/adonet-depreciating-systemdataoracleclient-but-it-didnt-rank-in-google/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 11:49:21 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.csharphacker.com/technicalblog/?p=185</guid>
		<description><![CDATA[The .Net team announced they will be dropping their code base for supporting the packaged ADO.NET provider for Oracle developed by Microsoft that ships as a part of the .NET Framework. They recommend the Oracle drivers ...]]></description>
			<content:encoded><![CDATA[<p>This skipped past my radar, but it seems 2 days ago the .Net team announced they will be dropping their code base for supporting the packaged ADO.NET provider for Oracle developed by Microsoft that ships as a part of the .NET Framework. Which translates to that you will have to get the Oracle provider direct from Oracle. Which honestly is normally the best practice anyway! The ADO.Net announcement can be found <a href="http://blogs.msdn.com/adonet/archive/2009/06/15/system-data-oracleclient-update.aspx">http://blogs.msdn.com/adonet/archive/2009/06/15/system-data-oracleclient-update.aspx</a>.</p>
<p>Some may consider this a non-event, while it may seriously turn the world upside down for others. The latest set of Oracle drivers can be found here <a href="http://www.oracle.com/technology/tech/windows/odpnet/index.html">http://www.oracle.com/technology/tech/windows/odpnet/index.html</a></p>
<blockquote><p>The Oracle Data Provider for .NET (ODP.NET) features optimized ADO.NET data access to the Oracle database. ODP.NET allows developers to take advantage of advanced Oracle database functionality, including Real Application Clusters, XML DB, and advanced security. The data provider can be used with the latest .NET Framework 3.5 version.</p>
<p>ODP.NET makes using Oracle from .NET more flexible, faster, and more stable. ODP.NET includes many features not available from other .NET drivers, including a native XML data type, array parameters, RAC optimizations, and statement caching. ODP.NET is designed for scalable enterprise Windows solutions by providing full support for Unicode and local and distributed transactions. Distributed transactions are supported using the Oracle Services for MTS.</p></blockquote>
<p>Frankly this package ranks as #1 &amp; #2 when using Google to search for &#8220;oracle .net provider&#8221; so I suspect a lot of developers who use Google will have gone straight to this approach anyway.</p>
<p><span style="text-decoration: underline;"><strong>Update</strong></span></p>
<p>It seems this story is gathering momentum now:</p>
<ul>
<li><a href="http://cwebbbi.spaces.live.com/Blog/cns!7B84B0F2C239489A!4573.entry">http://cwebbbi.spaces.live.com/Blog/cns!7B84B0F2C239489A!4573.entry</a></li>
<li><a href="http://www.theregister.co.uk/2009/06/18/microsoft_kills_oracle_connector/">http://www.theregister.co.uk/2009/06/18/microsoft_kills_oracle_connector/</a></li>
</ul>
<p>Gareth</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csharphacker.com/technicalblog/index.php/2009/06/17/adonet-depreciating-systemdataoracleclient-but-it-didnt-rank-in-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
