<?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>ODBC &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/odbc/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Wed, 26 Jun 2024 15:45:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>New Database Connections</title>
		<link>https://blog.xojo.com/2024/06/26/new-database-connections/</link>
		
		<dc:creator><![CDATA[William Yu]]></dc:creator>
		<pubDate>Wed, 26 Jun 2024 15:00:00 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[2024r2]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Console]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[ODBC]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13226</guid>

					<description><![CDATA[While Xojo has always supported adding database connections, the old method was far from ideal. Let's delve into the improved approach using the new DatabaseConnection project items and explore some recent additions to our database API.]]></description>
										<content:encoded><![CDATA[
<p>While Xojo has always supported adding database connections, the old method was far from ideal. Let&#8217;s delve into the improved approach using the new Database Connection project items and explore some recent additions to our database API.</p>



<h2 class="wp-block-heading">Out With The Old</h2>



<p>The old database connections were quite limiting, requiring you to create a new connection and re-enter all the parameters whenever one changed. With our new Database Connection items, you can now easily update specific connection parameters directly in the inspector.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="303" src="https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-1024x303.png" alt="" class="wp-image-13230" srcset="https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-1024x303.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-300x89.png 300w, https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-768x228.png 768w, https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-1536x455.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-2048x607.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Additionally, you can now choose whether the item will auto-connect or if you prefer to connect to it later in your code.</p>



<h2 class="wp-block-heading">Connecting to a Specific Database</h2>



<p>There are times when you need to connect to a database for debugging and testing, but for the final builds, you want to connect to your production database/server. Setting this up correctly with the old database connection method required creating two separate connection items—one for debug and one for release. With the new Database Connection items, this process is much simpler and fits more easily into the build process.  You now have several new Database Connection subitems that can be customized based on the stage of your build. These subitems are linked to the Stage Code in your Shared Build Settings, ensuring that when you build a final release, your database connection uses the correct settings automatically.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="329" src="https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-1024x329.png" alt="" class="wp-image-13238" srcset="https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-1024x329.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-300x96.png 300w, https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-768x247.png 768w, https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-1536x493.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode.png 1968w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Additional Database Features</h2>



<p>In addition to this change, there are two new database APIs that may be useful to you:</p>



<ol class="wp-block-list">
<li>A new method, IsConnected, has been added to the SQLiteDatabase, ODBCDatabase, PostgreSQLDatabase, and MySQLCommunityServer classes. This method returns true if the connection is still active, and false if it is not.</li>



<li>We&#8217;ve enhanced <a href="https://documentation.xojo.com/api/databases/database.html#database-addrow">Database.AddRow</a> with a new signature that returns the unique ID of the newly inserted row. This feature is supported for SQLiteDatabase, ODBCDatabase, PostgreSQLDatabase, and MySQLCommunityServer classes. It is recommended to use this new API instead of the deprecated SQLiteDatabase.LastRowID and MySQLCommunityServer.LastInsertedRowID</li>
</ol>



<p>Let&#8217;s explore how the new Database.AddRow feature can assist you. Previously, only SQLiteDatabase and MySQLCommunityServer had APIs to retrieve the unique ID of the last inserted row. Now, PostgreSQLDatabase and ODBCDatabase also have this capability by using the new <code>Database.AddRow(tableName As String, row As DatabaseRow, idColumnName As String = "") As Integer</code></p>



<p>The new aspect of this signature is the idColumnName parameter and the return value. For databases that support the SQL <strong>RETURNING</strong> clause, the idColumnName specifies the column whose value will be returned.  For databases that do not support the <strong>RETURNING</strong> clause, we will use the suitable method for each specific database to return a unique value.</p>



<p>We recognize the significance of databases in your Xojo apps. So with these updates to database connectivity for your desktop, web and console apps, and the addition of new features, we aim to make your database programming easier and more efficient.</p>



<p><em><em><em>William Yu grew up in Canada learning to program BASIC on a Vic-20. He is Xojo’s resident Windows and Linux engineer, among his many other skills. Some may say he has joined the dark side here in the USA, but he will always be a Canadian at heart.</em></em></em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Spotlight: Build Flexible, Powerful and Secure Database Applications</title>
		<link>https://blog.xojo.com/2017/06/22/use-xojo-to-create-database-apps/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Thu, 22 Jun 2017 07:56:05 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[ODBC]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=2696</guid>

					<description><![CDATA[Xojo's powerful language allows for rapid development while supporting a wide variety of databases &#038; ODBC, it offers flexible form design, database binding, reporting and more.]]></description>
										<content:encoded><![CDATA[<p>Whether you are new to building database applications or you need to expand your toolbox, Xojo is a smart choice. With Xojo you can build real, native apps. And Xojo&#8217;s powerful language allows for rapid app development while supporting a wide variety of databases and ODBC, plus it offers flexible form design, database binding, reporting and more.</p>
<p><span id="more-2696"></span></p>
<h3>Multiple Databases Supported</h3>
<p>Xojo supports a wide variety of databases, including: SQLite, PostgreSQL, MySQL, Microsoft SQL Server and Oracle.</p>
<p>In addition, you can use ODBC to connect to other databases such as Access (JET), FoxPro, FileMaker, Firebird and even IBM iSeries (DB2). You’ll always have access to your data using Xojo, <a href="http://blog.xojo.com/2013/06/19/database-connectivity-with-xojo/">read more</a> about connectivity between Xojo and your preferred database.</p>
<h3>Flexible Form Design</h3>
<p>Xojo includes dozens of controls available for desktop, web and mobile apps. You can use these controls to design any type of user interface that you can imagine. You’ll find controls for buttons, check boxes, popup menus, text fields, text areas, graphics, tabs, progress, lists, HTML, images and more.</p>
<h3>Simple and Powerful Programming Language</h3>
<p>How can a language be both simple and powerful? Xojo is simple because its language is small, focused and object-oriented. It is powerful because its framework, which is also object-oriented, includes robust capabilities you can start using right away, including: native user interface controls, file management, graphics, text processing, networking, threading and more.</p>
<p align="center"><img decoding="async" src="https://www.xojo.com/resources/images/database/Figure04-Code.png" /></p>
<h3>Database Binding for Security</h3>
<p>Xojo has built-in support for SQL binding so that you can avoid the security risks that can occur with <a href="http://blog.xojo.com/2016/02/18/avoiding-sql-injection/">SQL injection</a>, a type of security vulnerability that can occur when you create SQL statements using simple string manipulation.</p>
<h3>Reporting</h3>
<p>What good is data without a way to report on it? Xojo desktop apps can use the built-in reporting tool to help you design and display simple reports. And there are also many <a href="http://documentation.xojo.com/Resources:3rd_Party_Products#Reporting">3rd party reporting products</a> available for those with more advanced needs or for other platforms.</p>
<p align="center"><img decoding="async" src="https://www.xojo.com/resources/images/database/Figure05-Report.png" /></p>
<h3>Documentation</h3>
<p>If you are new to this, read about how to get started on database apps in this <a href="http://blog.xojo.com/2014/07/08/working-with-databases/">earlier post</a>. Xojo has an in-depth <a href="http://documentation.xojo.com/getting_started/introduction/what_is_xojo?.html">User Guide</a>, a complete <a href="http://documentation.xojo.com/Category:Keywords">Language Reference</a>, and a <a href="https://www.youtube.com/playlist?list=PLPoq910Q9jXhRoPw0_mHKdVUKPXpL9TKV">playlist of videos</a> about using databases with Xojo. The User Guide even has sections on migrating from <a href="http://developer.xojo.com/migrating-from-microsoft-access">Microsoft Access</a>, <a href="http://developer.xojo.com/migrating-from-visual-foxpro">Visual FoxPro</a> and <a href="http://developer.xojo.com/migrating-from-filemaker">FileMaker</a>!</p>
<h3>Try Xojo Free</h3>
<p>Xojo is free to use for learning and development. <a href="http://www.xojo.com/download">Download and try it today</a> and see for yourself!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>XojoTalk 016: Magical Toolkit</title>
		<link>https://blog.xojo.com/2015/08/05/xojotalk-016-magical-toolkit/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 05 Aug 2015 00:00:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[XojoTalk]]></category>
		<category><![CDATA[ODBC]]></category>
		<category><![CDATA[Podcast]]></category>
		<category><![CDATA[xDev Magazine]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2015/08/05/xojotalk-016-magical-toolkit/</guid>

					<description><![CDATA[Paul talks with Craig Boyd about Xojo, databases, Oracle, IBM, ODBC, Linux, Raspberry Pi and more.]]></description>
										<content:encoded><![CDATA[<p>In this episode of XojoTalk, Paul talks with Craig Boyd, Xojo developer and <a href="https://en.wikipedia.org/wiki/Data_architect">Data Architect</a>. Craig also writes the database column for <a href="http://www.rbdeveloper.com/" target="_blank" rel="noopener">xDev Magazine</a>.</p>
<p><span id="more-356"></span>Download <a href="http://files.xojo.com/Podcasts/XojoTalk-016.mp3">MP3</a>.</p>
<p><a href="http://feeds.feedburner.com/xojotalk">Subscribe to the XojoTalk podcast</a> in your favorite RSS reader or Podcast software! You can also <a href="https://itunes.apple.com/us/podcast/xojotalk-podcast/id920411434">subscribe on iTunes</a> or choose to get <a href="https://feedburner.google.com/fb/a/mailverify?uri=xojotalk&amp;amp;loc=en_US">email notifications</a> of new episodes.</p>
<h2>Show Links</h2>
<ul>
<li><a href="http://www.oracle.com/technetwork/database/database-technologies/express-edition/overview/index.html">Oracle Database</a></li>
<li><a href="http://www-01.ibm.com/software/data/netezza/">Natezza</a></li>
<li><a href="https://en.wikipedia.org/wiki/IBM_i">IBM iSeries</a></li>
<li><a href="http://www.xdevmag.com">xDev Magazine</a></li>
<li><a href="http://www.xojo.com/blog/en/2014/04/using-firebird-with-xojo.php">Firebird Database</a></li>
<li><a href="http://www.valentina-db.com/en/">Valentina Database</a></li>
<li><a href="http://developer.xojo.com/webinar-using-odbc">ODBC webinar</a></li>
<li><a href="http://www.actualtech.com">Mac ODBC Drivers</a></li>
<li><a href="http://www.microsoft.com/en-us/windows/features">Windows 10</a></li>
<li><a href="http://www.kubuntu.org">Kubuntu</a></li>
<li><a href="http://www.linuxmint.com">Linux Mint</a></li>
<li><a href="http://www.xojo.com/blog/en/2015/05/what-is-raspberry-pi.php">Raspberry Pi</a></li>
</ul>
<p style="text-align: center;"><!--HubSpot Call-to-Action Code --> <span id="hs-cta-wrapper-82dd8c4f-9f5b-49b7-aead-cd9b7194166b" class="hs-cta-wrapper"> <span id="hs-cta-82dd8c4f-9f5b-49b7-aead-cd9b7194166b" class="hs-cta-node hs-cta-82dd8c4f-9f5b-49b7-aead-cd9b7194166b"><br />
<!-- [if lte IE 8]></p>





<div id="hs-cta-ie-element"></div>


<![endif]--> <a href="http://blog.xojo.com/2015/07/01/xojotalk-015-type-my-password-like-an-animal/" target="_blank" rel="noopener"><img decoding="async" id="hs-cta-img-82dd8c4f-9f5b-49b7-aead-cd9b7194166b" class="hs-cta-img aligncenter" style="border-width: 0px;" src="https://blog.xojo.com/wp-content/uploads/2015/08/82dd8c4f-9f5b-49b7-aead-cd9b7194166b.png" alt="Xojo Talk Listen Podcase" width="612" height="97" /></a></span></span><br />
<!-- end HubSpot Call-to-Action Code --></p>
]]></content:encoded>
					
		
		<enclosure url="http://files.xojo.com/Podcasts/XojoTalk-016.mp3" length="19287689" type="audio/mpeg" />

			</item>
		<item>
		<title>Database Connectivity with Xojo</title>
		<link>https://blog.xojo.com/2013/06/19/database-connectivity-with-xojo/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 19 Jun 2013 00:00:00 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[ODBC]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2013/06/19/database-connectivity-with-xojo/</guid>

					<description><![CDATA[Working with database using Xojo is easy and consistent.  Xojo can connect to a wide variety of databases, including: SQLite, PostgreSQL, MySQL, Oracle, Microsoft SQL Server and pretty much anything else using ODBC. A must-read for anyone building their first database application.]]></description>
										<content:encoded><![CDATA[<p>Xojo can connect to a wide variety of databases, including: SQLite, PostgreSQL, MySQL, Oracle, Microsoft SQL Server and pretty much anything else using ODBC. A must-read for anyone building their first database application.</p>
<p><span id="more-34"></span></p>
<h2>SQLite</h2>
<p>SQLite is built-in to Xojo. As of 2015r4, Xojo uses SQLite 3.9.2 (SQLite 3.8.8 is used on iOS). To use SQLite with Xojo, you use the <a href="http://developer.xojo.com/sqlitedatabase-classic">SQLiteDatabase</a> class A similar <a href="http://developer.xojo.com/sqlitedatabase">SQLiteDatabase</a> class is also used for iOS. SQLite is referred to as an &#8220;embedded&#8221; database because the database engine is embedded into your application. SQLite is a great choice for local databases used by your desktop apps. SQLite is so useful that it is sometimes used to save app preferences and even as a custom file format for some apps! SQLite also works well with web apps that primarily display data and have a low volume of concurrent database writes.</p>
<p><img loading="lazy" decoding="async" class="mt-image-right" style="margin: 0 auto 20px; display: block;" src="https://blog.xojo.com/wp-content/uploads/2013/06/sqlexample-thumb-303x226-12.pngt1466486449161ampwidth303ampheight226" sizes="auto, (max-width: 303px) 100vw, 303px" alt="SQLExample.png" width="303" height="226" /></p>
<p><span style="line-height: 1.62;">Connecting to a SQLite database is easy:</span></p>
<pre>Dim dbFile As FolderItem = GetFolderItem("MyDatabase.sqlite")
Dim db As New SQLiteDatabase
db.DatabaseFile = dbFile
If db.Connect Then
  MsgBox("Connected!")
Else
  MsgBox("Error: " + db.ErrorMessage)
End If</pre>
<p>For more information on using SQLite, refer to its entries in the Reference Guide and User Guide:</p>
<ul>
<li><a href="http://developer.xojo.com/sqlitedatabase-classic">SQLiteDatabase</a> (Desktop, Web, Console)</li>
<li><a href="http://developer.xojo.com/sqlitedatabase">SQLiteDatabase</a> (iOS)</li>
<li><a href="http://developer.xojo.com/userguide/sqlite">SQLite in User Guide</a></li>
</ul>
<p>Or watch one of our webinars:</p>
<ul>
<li><a href="http://developer.xojo.com/webinar-sqlite">SQLite</a></li>
<li><a href="http://developer.xojo.com/webinar-using-sqlite">Using SQLite</a></li>
</ul>
<h2>Database Servers</h2>
<p>The other database options are fall under the &#8220;server&#8221; category. For Xojo, this means two things:</p>
<ol>
<li>You&#8217;ll need to make sure the appropriate plugin is coped to your Plugins folder.</li>
<li>You&#8217;ll need a <a href="https://www.xojo.com/store/index.php">Desktop, Web, Pro or Enterprise version of Xojo</a>.</li>
</ol>
<p>A database server is much more powerful than SQLite, but also more complicated. The big advantage of a database server is that they are designed for multiple concurrent users. Xojo has built-in support for these database servers: PostgreSQL, MySQL, Oracle and Microsoft SQL Server.</p>
<p>Although you need to have a database server installed somewhere that is accessible to your app, connecting to one is just as easy as it is with SQLite. This example connects to a PostgreSQL database server:</p>
<pre>Dim db As New PostgreSQLDatabase
db.Host = "192.168.1.172"
db.Port = 5432
db.DatabaseName = "myDatabase"
db.Username = "Bob"
db.Password = "fdf#$uy@"
If db.Connect Then
  //proceed with database operations
Else
  MsgBox("The connection failed.")
End If</pre>
<p>Connecting to other database servers is similar. For more information refer to the topics in the Reference Guide, User Guide and our webinars:</p>
<ul>
<li><a href="http://developer.xojo.com/postgresqldatabase">PostgreSQLDatabase</a></li>
<li><a href="http://developer.xojo.com/mysqlcommunityserver">MySQLCommunityServer</a></li>
<li><a href="http://developer.xojo.com/oracledatabase">OracleDatabase</a></li>
<li><a href="http://developer.xojo.com/mssqlserverdatabase">MSSQLServerDatabase</a></li>
<li><a href="http://developer.xojo.com/userguide/database-concepts">Databases</a> in User Guide</li>
<li><a href="http://developer.xojo.com/webinar-postgresql">PostgreSQL</a> webinar</li>
</ul>
<h2>ODBC</h2>
<p>ODBC is not really a database. It is a database connection protocol. It can be used to connect to database servers for which we do not provide a plugin, such an IBM iSeries (AS/400) database or Microsoft Access. In order to use ODBC to connect to a database you first have to make sure the ODBC driver is installed on your system. Then you usually need to configure it using the ODBC Control Panel or ODBC Adminitrator Tool for your system.</p>
<p><a href="http://www.xojo.com/blog/en/assets_c/2013/06/ODBCWin8-8.php"><img loading="lazy" decoding="async" class="mt-image-right" style="margin: 0 auto 20px; display: block;" src="https://blog.xojo.com/wp-content/uploads/2013/06/odbcwin8-thumb-303x212-8.pngt1466486449161ampwidth303ampheight212" sizes="auto, (max-width: 303px) 100vw, 303px" alt="ODBC Control Panel on Windows 8" width="303" height="212" /></a><span style="line-height: 1.62;">This example prompts you to choose a previously configured ODBC connection (called a DataSourceName or DSN) and attempts to connect to it:</span></p>
<pre>Dim db As New ODBCDatabase
db.DataSource = ""
 // Force user to choose a DSN
If db.Connect Then
 //proceed with database operations
Else
 MsgBox("The connection failed.")
End If
</pre>
<p>View ODBC in the Reference Guide, User Guide and the ODBC webinar for more information:</p>
<ul>
<li><a href="http://developer.xojo.com/odbcdatabase">ODBCDatabase</a></li>
<li><a href="http://developer.xojo.com/userguide/odbc">ODBC in User Guide</a></li>
<li><a href="https://youtu.be/dpvnc4DL9_A">Using ODBC</a> webinar</li>
</ul>
<h2>Data Access</h2>
<p>Regardless of how you connected to the database, accessing the data is achieved the same way. You use the <a href="http://documentation.xojo.com/api/deprecated/deprecated_class_members/database.sqlselect.html">SQLSelect</a> method to query the data and the <a href="http://documentation.xojo.com/api/deprecated/deprecated_class_members/database.sqlexecute.html">SQLExecute</a> method to run commands. When you query data, the results are stored in a <a href="http://documentation.xojo.com/api/deprecated/recordset.html">RecordSet</a>. You can interate through the RecordSet to get the data to display or modify it. These and other database topics are covered in the <a href="http://developer.xojo.com/userguide/database-operations">User Guide</a>.</p>
<p>Working with database using Xojo is easy and consistent. So if you are coming from another tool or are simply looking to make your next great app using Xojo, rest assurred that you can connect to the database you need.</p>
<p><span style="font-size: 10px;">(Updated March 10, 2016)</span><!-- end HubSpot Call-to-Action Code --></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
