Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titlePostgreSQL - ODBC

Connect to PostgreSQL with ODBC:

  1. Set up the ODBC data source: PostgreSQL ODBC Setup

  2. Use a component to connect to the database:

Code Block
languagelua
function main()
      local conn = db.connect{   
      api=db.POSTGRES,
      name='<your_odbc_server_name>',
      user='<your_login>',
      password='<secret>',
      use_unicode = true,
      live = true
   }
 
   conn:execute{sql='SELECT * FROM <your table>', live=true}
end
Expand
titleOracle - ODBC, Oracle OCI (with TNS Alias, or Easy Connect, or ODBC)

Connect to Oracle with OCI (TNS Alias):

  1. Set up the Oracle OCI drivers and create a TNS Alias: Oracle TNS Alias OCI Configuration

  2. Use a component to connect to the database:

Code Block
languagelua
function main()
      local conn = db.connect{   
      api=db.ORACLE_OCI, 
      name='<Oracle OCI name>', -- Oracle tns_alias
      user='<your_login>', 
      password='<secret>',
      use_unicode = true,
      live = true
   }
 
   conn:execute{sql='SELECT * FROM <your table>', live=true}
end

Connect to Oracle with Easy Connect (EZConnect):

  1. Set up the Oracle OCI drivers and EZConnect String: Oracle OCI Easy Connect String (EZCONNECT)

  2. Use a component to connect to the database:

Code Block
languagelua
function main()
      local conn = db.connect{   
      api=db.ORACLE_OCI, 
      name='<Oracle EZCONNECT string>', --[//]host[:port][/service_name]
      user='<your_login>', 
      password='<secret>',
      use_unicode = true,
      live = true
   }
 
   conn:execute{sql='SELECT * FROM <your table>', live=true}
end

Connect with Oracle with ODBC:

  1. Set up the Oracle OCI and ODBC drivers: Oracle ODBC Setup

  2. Use a component to connect to the database:

Code Block
languagelua
function main()
      local conn = db.connect{   
      api=db.ORACLE_ODBC, 
      name='your_odbc_server_name',
      user='your_login',
      password='secret',
      use_unicode = true,
      live = true
   }
 
   conn:execute{sql='SELECT * FROM <your table>', live=true}
end

...