<?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: Catching database error message in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Catching-database-error-message/m-p/6751#M6745</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for this great tips. Log Capture function is the function that I was looking for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 18 May 2013 18:59:02 GMT</pubDate>
    <dc:creator>gbu</dc:creator>
    <dc:date>2013-05-18T18:59:02Z</dc:date>
    <item>
      <title>Catching database error message</title>
      <link>https://community.jmp.com/t5/Discussions/Catching-database-error-message/m-p/6749#M6743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know if there is a way to catch database error message and put it into one jmp variable.&lt;/P&gt;&lt;P&gt;Example for an Oracle DB, if I try to insert one value already existing on ID primary key :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* JSL */&lt;/P&gt;&lt;P&gt;sql = "INSERT INTO MY.TABLE (ID, DATA) VALUES ('A',150)";&lt;/P&gt;&lt;P&gt;OpenDatabase (dsnDB, sql);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* LOG display */&lt;/P&gt;&lt;P&gt;[Oracle][ODBC][Ora]ORA-00001: unique constraint (MY.TABLE) violated&lt;/P&gt;&lt;P&gt;ORA-06512: at line 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to have in a jsl variable this sting : "[Oracle][ODBC][Ora]ORA-00001: unique constraint (MY.TABLE) violated".&lt;/P&gt;&lt;P&gt;I didn't find any solutions for the moment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2013 07:47:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Catching-database-error-message/m-p/6749#M6743</guid>
      <dc:creator>gbu</dc:creator>
      <dc:date>2013-05-16T07:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Catching database error message</title>
      <link>https://community.jmp.com/t5/Discussions/Catching-database-error-message/m-p/6750#M6744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #dc3f19;"&gt;One way to do this is with the Log Capture function. &lt;/SPAN&gt;&lt;SPAN style="color: #dc3f19;"&gt;To test the JSL code I simulated two different types of errors:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL class="MailOutline"&gt;&lt;LI&gt;&lt;SPAN style="color: #dc3f19;"&gt;A failure error by not establishing a connection to the Access database prior to selecting the columns from the specified table&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #dc3f19;"&gt;A failure error by not having an appropriate ODBC driver installed&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="color: #dc3f19;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #dc3f19;"&gt;I have included an example of how you could accomplish what you want to do in the following JSL code and the resulting error messages: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #dc3f19;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-size: 14px; font-family: Courier; color: #032ce4;"&gt;Names Default To Here&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier; color: #032ce4;"&gt;&lt;SPAN style="color: #000000;"&gt;AccessError01 &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #942193;"&gt;"Access Error:"&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;||&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;Log Capture&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;Open Database&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier; color: #942193;"&gt;"DSN=MS Access Database;DBQ=C:UsersstkoprDocumentsMovinOn.accdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier; color: #942193;"&gt;"SELECT * FROM tblVehicle"&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier; color: #942193;"&gt;"tblVehicle"&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 14px; font-family: Courier;"&gt;&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="color: #dc3f19;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #dc3f19;"&gt;The following is written to the log and the error string is stored in the variable AccessError01 for scenario test 1.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;DIV style="font-size: 12px; font-family: Courier;"&gt;&lt;STRONG&gt;"Access Error:&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: Courier;"&gt;&lt;STRONG&gt;[Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'. &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: Courier;"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="color: #dc3f19;"&gt;The following is written to the log and the string is stored in the variable AccessError01 for scenario test 2. &lt;/SPAN&gt;&lt;/P&gt;&lt;DIV style="color: #000000; text-align: -webkit-auto; font-size: 14px; font-family: Courier;"&gt;&lt;STRONG&gt;"Access Error:&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #000000; text-align: -webkit-auto; font-size: 14px; font-family: Courier;"&gt;&lt;STRONG&gt;[iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="color: #000000; text-align: -webkit-auto; font-size: 14px; font-family: Courier;"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://blogs.sas.com/content/jmp/2013/05/10/using-jmp-to-connect-to-databases-insert-records/" title="http://blogs.sas.com/content/jmp/2013/05/10/using-jmp-to-connect-to-databases-insert-records/"&gt;Yes, you can...connect to an ODBC database&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 May 2013 15:33:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Catching-database-error-message/m-p/6750#M6744</guid>
      <dc:creator>stan_koprowski</dc:creator>
      <dc:date>2013-05-17T15:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Catching database error message</title>
      <link>https://community.jmp.com/t5/Discussions/Catching-database-error-message/m-p/6751#M6745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for this great tips. Log Capture function is the function that I was looking for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 May 2013 18:59:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Catching-database-error-message/m-p/6751#M6745</guid>
      <dc:creator>gbu</dc:creator>
      <dc:date>2013-05-18T18:59:02Z</dc:date>
    </item>
  </channel>
</rss>

