Access: Converting your Access Database to Another Format - FogBugz Knowledge Exchange [closed]most recent 30 from http://fogbugz.stackexchange.com2012-02-09T08:57:32Zhttp://fogbugz.stackexchange.com/feeds/question/215http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://fogbugz.stackexchange.com/questions/215/access-converting-your-access-database-to-another-formatAccess: Converting your Access Database to Another FormatFogBugz KB2009-10-13T20:12:54Z2011-10-28T20:22:08Z
<p><em><strong>Official Fog Creek Notice:</strong> <a href="http://fogbugz.stackexchange.com/questions/4949/is-microsoft-access-support-being-deprecated/4950#4950" rel="nofollow">MS Access support is being deprecated in FogBugz 8.0</a>.</em></p>
<p>How do you convert an MS Access database to another format?</p>
http://fogbugz.stackexchange.com/questions/215/access-converting-your-access-database-to-another-format/216#216Answer by FogBugz KB for Access: Converting your Access Database to Another FormatFogBugz KB2009-10-13T20:15:15Z2009-11-19T15:56:49ZMany people end up with strange FogBugz problems after attempting to transfer to another format because of schema issues. If this happens to you, <a href="http://contact.fogcreek.com" rel="nofollow">contact us</a>.</p>
<p>For instructions on migrating your data <strong>from MS Access to SQL Server</strong> <a href="http://www.fogcreek.com/FogBUGZ/KB/dbsetup/UpsizeWizard.html" rel="nofollow">click here</a>.</p>
<p>For migrating <strong>from MS Access to MySQL</strong>, read on.</p>
<ol>
<li>If you are upgrading from a previous version of FogBugz and switching to MySQL, please install the upgraded FogBugz code against the old database, log in once (so FogBugz can do the upgrade) and <em>then</em> proceed to convert your database.
</li>
<li>Backup your existing database. Make a copy of your FogBugz.mdb file.</li>
<li>Create a shell MySQL database. Follow the <a href="http://fogbugz.stackexchange.com/questions/219/new-or-empty-fogbugz-database" rel="nofollow">instructions here</a> so you end up with just the schema and no data. i.e. make sure you run the truncate.sql script after letting fogbugz build the db.</li>
<li>Convert your Access database. Best results are obtained by using <a href="http://easyfrom.net/" rel="nofollow">ESF Database Convert</a>. But you can find a list of (free) conversion utilities on the <a href="http://solutions.mysql.com/" rel="nofollow">MySQL site</a>. Choose one of these programs and convert your database to MySQL format.</li>
<li>Check your new database to make sure the sSignature field in the Licenses table is of type "blob". Some conversion tools will give the sSignature field another type and you will not be able to install licenses! You will simply be prompted to install new licenses over and over again. We have seen this happen using Navicat.</li>
</ol>
http://fogbugz.stackexchange.com/questions/215/access-converting-your-access-database-to-another-format/461#461Answer by Rich Armstrong for Access: Converting your Access Database to Another FormatRich Armstrong2009-10-20T15:24:30Z2009-11-24T23:24:47Z<p>No matter what utility you use, if you have odd behavior afterward, contact us. This is an ongoing answer that will evolve as I discover wrinkles and strategies around them.</p>
<p>Here's my current strategy:</p>
<ol>
<li>Use FogBugz to create a <a href="http://fogbugz.stackexchange.com/questions/219/new-or-empty-fogbugz-database" rel="nofollow">new database</a>. You don't need to empty it.</li>
<li>Use this <a href="http://bullzip.com/products/a2m/info.php" rel="nofollow">MSAccess to MySQL converter</a>. This has some quirks:
<ul>
<li>the dtOpened in the Bug table sometimes has a weird default of zero in Access, which bullzip converts literally, which chokes MySQL</li>
<li>the Attachment table's sData field seems to come over without quotes around the data. I needed to do a regex and use TextPad to correct this.</li>
<li>the BugEvent table's <strong>s</strong> field exports as TEXT, but needs to be LONGTEXT to come across correctly.</li>
</ul></li>
<li>Import the converted .sql file into a new database in the same install as the schema.</li>
<li>Use the script below to query the information_schema database of MySQL and create another script that will pull all the data from the old database (bullzip_import) to the new one (fogbugz_created)</li>
<li>Run the generated script and watch all the data get copied from the makeshift MySQL database into the fresh, valid schema.</li>
<li>(Where necessary) Dump the database and ship off to the client!</li>
</ol>
<p>Heres the script:</p>
<pre><code>SET @old_database = 'bullzip_import';
SET @new_database = 'fogbugz_created';
SELECT CONCAT(
"SELECT '",TABLE_NAME, "'; ",
" TRUNCATE ",@new_database,".", TABLE_NAME,"; ",
" INSERT INTO ", @new_database,".",TABLE_NAME,"(", GROUP_CONCAT(COLUMN_NAME ORDER BY ORDINAL_POSITION), ") ",
" SELECT ", GROUP_CONCAT(COLUMN_NAME ORDER BY ORDINAL_POSITION), " FROM ",@old_database,".", TABLE_NAME,"; ",
" SHOW WARNINGS;") AS Statement
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = @new_database
AND TABLE_NAME NOT LIKE ('%index%')
AND TABLE NAME NOT LIKE ('%license%')
AND COLUMN_NAME NOT LIKE 'FILTER_%'
GROUP BY TABLE_NAME
INTO OUTFILE 'c:\\dump.sql';
</code></pre>
http://fogbugz.stackexchange.com/questions/215/access-converting-your-access-database-to-another-format/754#754Answer by unknown (google) for Access: Converting your Access Database to Another Formatunknown (google)2009-11-18T20:33:11Z2009-11-18T20:33:11Z<p>Addendum to step 5:</p>
<p>To deselect Strict mode:</p>
<p>Open your "my.ini" file within the MySQL installation directory, and look for the text "sql-mode".</p>
<pre><code># Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
</code></pre>
<p>Replace with:</p>
<pre><code># Set the SQL mode to strict
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
</code></pre>
http://fogbugz.stackexchange.com/questions/215/access-converting-your-access-database-to-another-format/9434#9434Answer by jpeacock for Access: Converting your Access Database to Another Formatjpeacock2011-10-21T20:11:52Z2011-10-28T20:22:08Z<p>I am in the process of importing our Access database into MySQL, and have run into a few more quirks than the posts above mentioned. Hopefully this information will help other database newbies like me who are in the same boat. </p>
<p>I am migrating to MySQL Ver 14.14 Distrib 5.5.16, for Win64 (x86)
and used Bullzip 3.0.0.148 to convert the database. </p>
<p>Here is how I fixed the problems which Rich Armstrong identified in his answer.</p>
<blockquote>
<p>the dtOpened in the Bug table sometimes has a weird default of zero in Access, which bullzip converts literally, which chokes MySQL</p>
</blockquote>
<p>In the converted file, dtOpened is defined as:</p>
<pre><code>`dtOpened` DATETIME DEFAULT '0',
</code></pre>
<p>I simply removed the default, since none of the other DATETIME fields had one:</p>
<pre><code>`dtOpened` DATETIME,
</code></pre>
<p>In addition, I got the following error on a large number of table column definitions:</p>
<blockquote>
<p>BLOB/TEXT column can't have a default value</p>
</blockquote>
<p>I fixed it by searching for LONGTEXT, LONGBLOB and removed the default value, just like above.</p>
<hr>
<blockquote>
<p>the Attachment table's sData field seems to come over without quotes around the data. I needed to do a regex and use TextPad to correct this.</p>
</blockquote>
<p>In the converted file they were incorrectly formatted as: </p>
<pre><code>0x0910022...
</code></pre>
<p>I changed them to be formatted as below:</p>
<pre><code>X'0910022...'
</code></pre>
<p>using the regex (exact syntax will vary from application to application):</p>
<pre><code>s/(INSERT INTO.*VALUES.*,\s)0x([0-9a-fA-F]+)/\1X'\2'/
</code></pre>
<p>There were also some other fields that are also declared LONGBLOB with the same quoting problem:</p>
<ul>
<li>Licenses.sSignature*</li>
<li>IndexFilePage.sPage</li>
</ul>
<p>The regex above fixed them as well.</p>
<hr>
<p>If you have large BLOB fields (such as file attachments > 1MB),
then you will need to increase the mysql maximum_packet_size to import them:
<a href="http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html</a></p>
<hr>
<p>Finally when importing it is best to output the results to a log file, as errors can easily scroll off the screen. In windows this can be done using:</p>
<pre><code>mysql -uUSER -pPASSWORD -e "source MY_CONVERTED_DATABASE.sql" 2>&1 > sql_import_results.txt
</code></pre>
<p>Then review that log file. If there are any errors fix the problem, drop the temporary database that was just created (movedb in my case), and then rerun the script. Most of the importing problems I encountered would not have been discovered until much later had I not done this, as everything appeared to be working on the surface.</p>