Connecting to SQL

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsConnecting to SQL
(Other SQL)
 
(3 intermediate revisions by 3 users not shown)
Line 7: Line 7:
 
*Go to the Services tab in the admin console.
 
*Go to the Services tab in the admin console.
 
*Click Create.
 
*Click Create.
*Set the Service Type to 'SQL DB.'
+
*From the Service Type menu select Database then ''SQLite.'
 
*Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
 
*Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
 
*Go to the Config tab for the new service.
 
*Go to the Config tab for the new service.
*Set the Driver to 'SQLite.'
 
 
*Set the file name in the connection string to something unique. The entire database is stored in this file, which can be found in /storage/databases of your DreamFactory installation.
 
*Set the file name in the connection string to something unique. The entire database is stored in this file, which can be found in /storage/databases of your DreamFactory installation.
 
*No credentials are required, just click Create Service to save your new service.
 
*No credentials are required, just click Create Service to save your new service.
Line 17: Line 16:
 
== Other SQL==
 
== Other SQL==
  
Connecting to other SQL types is similar to SQLite, except for the connection string which varies depending on which db type you are targeting. Bitnami installs come with a pre-configured MySQL db that you can access without any additional setup.
+
Connecting to other SQL types is similar to SQLite, except for the connection string, which varies depending on which database type you are targeting. Bitnami installs come with a pre-configured MySQL database that you can access without any additional set up.
  
 
*Go to the Services tab in the admin console.
 
*Go to the Services tab in the admin console.
 
*Click Create.
 
*Click Create.
*Set the Service Type to 'SQL DB.'
+
*From the Service Type menu select Database then the SQL db type you want.
 
*Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
 
*Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
 
*Go to the Config tab for the new service.
 
*Go to the Config tab for the new service.
*Set the Driver to according to your desired db type.
+
*Enter the appropriate connection information (host, port, db name, user, password, etc.)
*An example connection string will be generated based on your Driver selection. Tailor this to suit your actual service.
+
 
*Click Create Service to save your new service. If the proper PHP driver is not installed, an error will be displayed with information on what is missing.
 
*Click Create Service to save your new service. If the proper PHP driver is not installed, an error will be displayed with information on what is missing.
 
*Go to the API Docs tab in the admin console to test your new service.
 
*Go to the API Docs tab in the admin console to test your new service.
 +
**A good test is to do a GET on {service name}/_table with the refresh dropdown set to true

Latest revision as of 13:00, 2 September 2016

DreamFactory makes it easy to REST-enable and connect to any SQL database in just a few easy steps. This tutorial explains how to configure DreamFactory to make connections to a SQL database.

SQLite

All DreamFactory instances now come with a pre-created SQLite service named 'db' that you can use for development. To create a new SQLite service follow these steps.

  • Go to the Services tab in the admin console.
  • Click Create.
  • From the Service Type menu select Database then SQLite.'
  • Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
  • Go to the Config tab for the new service.
  • Set the file name in the connection string to something unique. The entire database is stored in this file, which can be found in /storage/databases of your DreamFactory installation.
  • No credentials are required, just click Create Service to save your new service.
  • Go to the API Docs tab in the admin console to test your new service.

Other SQL

Connecting to other SQL types is similar to SQLite, except for the connection string, which varies depending on which database type you are targeting. Bitnami installs come with a pre-configured MySQL database that you can access without any additional set up.

  • Go to the Services tab in the admin console.
  • Click Create.
  • From the Service Type menu select Database then the SQL db type you want.
  • Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
  • Go to the Config tab for the new service.
  • Enter the appropriate connection information (host, port, db name, user, password, etc.)
  • Click Create Service to save your new service. If the proper PHP driver is not installed, an error will be displayed with information on what is missing.
  • Go to the API Docs tab in the admin console to test your new service.
    • A good test is to do a GET on {service name}/_table with the refresh dropdown set to true