<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Open Database() with csv/txt example? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5741#M5740</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think I have ever referenced "DriverId" in my DSN strings.&amp;nbsp; Will it work if you leave it out altogether?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Oct 2012 23:26:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-10-08T23:26:30Z</dc:date>
    <item>
      <title>Open Database() with csv/txt example?</title>
      <link>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5740#M5739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone have an Open Database() example for ODBC'ing to a .csv or .txt file?&amp;nbsp; I can get ODBC to work fine with Excel 2007 .xlsx but haven't deduced the text file connection string correctly for opening a .csv file.&amp;nbsp; I'm even referencing the correct "User DSN" name string via Windows ODBC Data Source Administrator.&amp;nbsp; So I'm wondering if I have the wrong "DriverId" shown below?&amp;nbsp; thx... dj&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works:&lt;/P&gt;&lt;P&gt;dt_excel=open database("DSN=Excel Files xlsx;DBQ=C:\Data.xlsx;DriverId=790;MaxBufferSize=2048;PageTimeout=5;","SELECT *","Result");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This doesn't work:&lt;/P&gt;&lt;P&gt;dt_csv=open database("DSN=Text File;DBQ=C:\Data.csv;DriverId=27;MaxBufferSize=2048;PageTimeout=5;","SELECT *","Result");&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Oct 2012 19:42:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5740#M5739</guid>
      <dc:creator>djhanson</dc:creator>
      <dc:date>2012-10-08T19:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Open Database() with csv/txt example?</title>
      <link>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5741#M5740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think I have ever referenced "DriverId" in my DSN strings.&amp;nbsp; Will it work if you leave it out altogether?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Oct 2012 23:26:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5741#M5740</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-08T23:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Open Database() with csv/txt example?</title>
      <link>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5742#M5741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Chad.&amp;nbsp; I tried removing the "DriverId" string and other subsequent strings and get the same error message.&amp;nbsp; It's as if it cannot find my Text File driver (eventhough it appears fine in the Windows ODBC manager).&amp;nbsp; Else, I've got some sort of typo/mismatch in my connection string?&amp;nbsp; Odd, as this whole thing works great in Excel (but my data files are csv's so I'd rather not have to convert them to .xlsx files to use ODBC).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;This doesn't work:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;dt_csv=open database("DSN=Text File;DBQ=C:\Data.csv;","SELECT *","Result");&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Error message that results:&lt;/P&gt;&lt;P&gt;[Microsoft][ODBC Text Driver] '(unknown)' is not a valid path.&amp;nbsp; Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2012 17:45:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5742#M5741</guid>
      <dc:creator>djhanson</dc:creator>
      <dc:date>2012-10-09T17:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Open Database() with csv/txt example?</title>
      <link>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5743#M5742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0px;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Have you tried this variant? It worked with a sample file, however I had problems with delimiters. But I at least got a table with (messed up) data from the text file.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #801392;"&gt;&lt;SPAN style="color: #000000;"&gt;dt_csv &lt;/SPAN&gt;&lt;SPAN style="color: #160091;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #2800e1;"&gt;Open Database&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;/SPAN&gt;"DSN=Text File;DBQ=C:\;"&lt;SPAN style="color: #160091;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;"SELECT * FROM Data.csv"&lt;SPAN style="color: #160091;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;"Result"&lt;SPAN style="color: #000000;"&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #160091;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 10:29:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5743#M5742</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2012-10-10T10:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Open Database() with csv/txt example?</title>
      <link>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5744#M5743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi MS, yep, late last night I finally figured it out!&amp;nbsp; Yes, it is exactly what you posted above syntax-wise.&amp;nbsp; Thanks for replying to this thread.&amp;nbsp; For the record, here's what I learned about doing an ODBC to a text file.&amp;nbsp; It really has nothing to do with JSL, but rather the industry convention/syntax required to do ODBC to a text file itself:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a. Create schema.ini - must create this file to support the text file format.&amp;nbsp; Place it in the same directory as the text file.&amp;nbsp; Easy to create via Notepad.&amp;nbsp; Google schema.ini for ODBC text file for details.&lt;/P&gt;&lt;P&gt;b. Use correct ODBC syntax - unlike say Excel ODBC DBQ string, text file ODBC DBQ string does not reference the path+filename but rather just the path.&amp;nbsp; This is what I got hung up on.&amp;nbsp; So this is what works (just as you posted above - the key is to reference the DBQ=&amp;lt;path&amp;gt; and not DBQ=&amp;lt;path+filename&amp;gt; and then split up the filename into the SQL FROM statement):&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;dt_csv=open database("DSN=Text File;DBQ=C:\;","SELECT * FROM Data.csv","Result");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;c. Minor detail - just a note.&amp;nbsp; If you're using Win7, there are two different locations for the ODBC Manager.&amp;nbsp; One is the 32 bit location and the other is the 64 bit location.&amp;nbsp; Microsoft named them like Greenland and Iceland (sort of misleading).&amp;nbsp; Just be aware of this when/if you're adding/modifying say the ODBC Text File driver.&amp;nbsp; I hear in Win8 that they may make these separate names or identifiers somehow.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Win7 ODBC Managers:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;32 bit: C:\Windows\SysWOW64\odbcad32.exe&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;64 bit: C:\Windows\System32\odbcad32.exe&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Anyways, the above a.) + b.) does allow me to use JSL to ODBC to a raw text file.&amp;nbsp; Very nice... ...dj&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 13:58:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-Database-with-csv-txt-example/m-p/5744#M5743</guid>
      <dc:creator>djhanson</dc:creator>
      <dc:date>2012-10-10T13:58:59Z</dc:date>
    </item>
  </channel>
</rss>

