<br><b>Code</b>: rsb:print<br><b>Error</b>: Formatter [ extraconnectionprops ] failed in the evaluation of <p> The [company_name] ODBC Driver for [service] enables you to write data access code for [datasource] in PHP. This article shows how to use PHP's ODBC built-in functions to connect to [datasource], execute queries, and output the results. </p> <h2>Configure a DSN</h2> <p> To connect to [datasource], your application will use connection properties defined in the data source name (DSN).</p> <p> Below is a typical connection string: </p> <p> [extraconnectionprops] </p> <p> You can configure the DSN in the built-in Microsoft ODBC Data Source Administrator. This is the last step of the driver installation. See the "Getting Started" chapter in the help documentation for a guide to use the Microsoft ODBC Data Source Administrator to create and configure a DSN for [datasource]. </p> <h2>Establish a Connection</h2> <p>Open the connection to [service] by calling the <tt>odbc_connect</tt> or <tt>odbc_pconnect</tt> methods. To close connections, use <tt>odbc_close</tt> or <tt>odbc_close_all</tt>.</p> <code> $conn = odbc_connect("[company_name] ODBC [service] Source","user","password"); </code> <p>Connections opened with <tt>odbc_connect</tt> are closed when the script ends. Connections opened with the <tt>odbc_pconnect</tt> method are still open after the script ends. This enables other scripts to share that connection when they connect with the same credentials:</p> <code> $conn = odbc_pconnect("[company_name] ODBC [service] Source","user","password"); ... odbc_close($conn); //persistent connection must be closed explicitly </code> <h2>Create Prepared Statements</h2> <p> Create prepared statements and parameterized queries with the <tt>odbc_prepare</tt> function. </p> <code> $query = odbc_prepare($conn, "SELECT * FROM [extable] WHERE [exselectwherecol] = ?"); </code> <h2>Execute Queries</h2> <p> Execute prepared statements with <tt>odbc_execute</tt>. </p> <code > $conn = odbc_connect("[company_name] ODBC [service] Source","user","password"); $query = odbc_prepare($conn, "SELECT * FROM [extable] WHERE [exselectwherecol] = ?"); $success = odbc_execute($query, array('[exselectwherecolequals]')); </code> <p> Execute nonparameterized queries with <tt>odbc_exec</tt>. </p> <code> $conn = odbc_connect("[company_name] ODBC [service] Source","user","password"); $query = odbc_exec($conn, "SELECT * FROM [extable]"); </code> <h2>Process Results</h2> <p>Access a row in the result set as an array with the <tt>odbc_fetch_array</tt> function.</p> <code> $conn = odbc_connect("[company_name] ODBC [datasource] Source","user","password"); $query = odbc_exec($conn, "SELECT * FROM [extable]"); while($row = odbc_fetch_array($query)){ echo $row\["[excol#1]"] . "\\n"; } </code> <p>Display the result set in an HTML table with the <tt>odbc_result_all</tt> function.</p> <code> $conn = odbc_connect("[company_name] ODBC [datasource] Source","user","password"); $query = odbc_prepare($conn, "SELECT * FROM [extable] WHERE [exselectwherecol] = ?"); $success = odbc_execute($query, array('[exselectwherecolequals]')); if($success) odbc_result_all($query); </code> </li> </ol> <h2>Test the Example Queries</h2> <p> One easy way to test the queries above is to use PHP's built-in test server to set up a basic stand-alone test environment. To start it, follow the steps below: </p> <ol> <li><p>Download the binaries for the latest version of PHP.</p> <li><p>Extract files to a folder.</p> <li><p>Open the folder.</p> <li><p>Rename php.ini-development to php.ini for a basic development setup.</p> <li><p>Run the command below to access your test scripts from the browser:</p> <code> php -S localhost:8000 -t C:\path-to-your-scripts -c C:\path-to-php\php.ini </code> </li> </ol> <h2>More Example Queries</h2> <p> You will find complete information on the driver's supported SQL in the help documentation. The code examples above are [service]-specific adaptations of the <a href="https://php.net/manual/en/ref.uodbc.php">PHP community documentation for all ODBC functions</a>. </p>. The error was: The value of the attribute could not be accessed: The attribute does not exist.<br><b>URL</b>: /jp/kb/tech/sql-odbc-php.rst