RDF
[ class tree: RDF ] [ index: RDF ] [ all elements ]

Source for file test_SetDatabaseConnection.php

Documentation is available at test_SetDatabaseConnection.php

  1. <?php 
  2. // ----------------------------------------------------------------------------------
  3. // PHP Script: test_SetDatabaseConnection.php
  4. // ----------------------------------------------------------------------------------
  5. /*
  6.  * This is an online demo of RAP's database backend.
  7.  * Tutorial how to connect to different databases and how to create tables.
  8.  *
  9.  * @author Radoslaw Oldakowski <radol@gmx.de>
  10.  */
  11. ?>
  12.  
  13.  
  14. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  15. <html>
  16. <head>
  17.     <title>Test Store Models in Database</title>
  18. </head>
  19. <body>
  20.  
  21. <?php 
  22. // Include RAP
  23. require_once 'RDF.php';
  24. require_once 'RDF/Store/MDB.php';
  25. // # 1. Connect to MsAccess database (via ODBC) and create tables.
  26. // Connect to MsAccess (rdf_db DSN) database using connection settings
  27. // defined in constants.php :
  28. // ----------------------------------------------------------------------------------
  29. // Database
  30. // ----------------------------------------------------------------------------------
  31.  
  32. // Connect to MySQL database with user defined connection settings
  33. $rdf_database =new RDF_Store_MDB(
  34.     array(
  35.         'phptype' => 'mysql',
  36.         'username' => 'root',
  37.         'password' => '',
  38.         'hostspec' => 'localhost',
  39.         'database' => 'rdf2'
  40.     )array());
  41.  
  42. $filename '[path_path]/data/RDF/misc/database_schema.xml';
  43. // Create tables for MySQL
  44. var_dump($rdf_database->createTables($filename));
  45.  
  46. // Close the connection
  47. $rdf_database->close();
  48.  
  49. ?>
  50. </body>
  51. </html>

Documentation generated on Mon, 11 Mar 2019 15:39:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.