Evridb: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Scott
imported>Scott
 
(5 intermediate revisions by the same user not shown)
Line 4: Line 4:


This object is not heavily maintained for all database types. For a more extensive set of database tools see [http://www.mathworks.com/products/database/| The MathWorks Database Toolbox].
This object is not heavily maintained for all database types. For a more extensive set of database tools see [http://www.mathworks.com/products/database/| The MathWorks Database Toolbox].
Examples of creating and using objects [[Evridb_examples|here.]]


The general workflow of using a EVRIDB object:
The general workflow of using a EVRIDB object:
Line 9: Line 11:
* Set connection attributes.
* Set connection attributes.
* Test the connection.
* Test the connection.
* Set query properties.
* Run queries.
* Run queries.


Line 18: Line 21:
<tt>.type</tt>
<tt>.type</tt>
| Type of connection (e.g., 'access' 'mysql' mssql') Determines what driver is used. When set, default values will be added to .provider, .driver, and .driver_jar_file where appropriate.
| Type of connection (e.g., 'access' 'mysql' mssql') Determines what driver is used. When set, default values will be added to .provider, .driver, and .driver_jar_file where appropriate.
===Microsoft Windows Connection===
===Microsoft Windows Connections===
* access - Microsoft Access database.
* access - Microsoft Access database.
* mssql - Microsoft SQL Server.
* mssql - Microsoft SQL Server.
* mysql - MySQL database (Windows).
* mysql - MySQL database (Windows).
* dsn - Microsoft database (Data Source Name).
* dsn - Microsoft database (Data Source Name).
===JDBC Type Connections===
===JDBC Connections===
* jmysql - MySQL database(JDBC).
* jmysql - MySQL database(JDBC).
* oracle - Oracle database.
* oracle - Oracle database.
Line 94: Line 97:
| Sub structure of additional arguments. This value must be a sting of exactly what is required in the database connection string.
| Sub structure of additional arguments. This value must be a sting of exactly what is required in the database connection string.
|}
|}
==Query Properties==
==Query Properties==


Line 100: Line 104:
|valign="top" |
|valign="top" |
<tt>.sql_string</tt>
<tt>.sql_string</tt>
| Returns the short "keyword" model type of the current model (or empty string if the model type has not been set). This keyword most often is linked to the PLS_Toolbox function that created the given model. This can be assigned to any model type listed in the
| Stored SQL statement run if .execute is empty.
|-
|-
|valign="top" |
|valign="top" |
Line 121: Line 125:
==Connection Methods==
==Connection Methods==


{| border="1" cellpadding="5" cellspacing="0" style="margin-left:3em"
|-
|valign="top" |
<tt>.getconnection</tt>
| Get connection object.
|-
|valign="top" |
<tt>.test</tt>
| Test database connection.
|-
|valign="top" |
<tt>.close</tt>
| Close database connection
|-
|valign="top" |
<tt>.closeconnection_force</tt>
| Close connection even if it's persistent.
|-
|valign="top" |
<tt>.shutdown_derby</tt>
| Try a graceful shutdown of Derby.
|}


==Query Methods==
==Query Methods==
{| border="1" cellpadding="5" cellspacing="0" style="margin-left:3em"
|-
|valign="top" |
<tt>.runquery</tt>
| Run query.
|-
|valign="top" |
<tt>.ms_get_last</tt>
| Try to get last id from auto-increment ID value.
|-
|valign="top" |
<tt>.get_tables</tt>
| Get table names from ADO.
|}

Latest revision as of 14:19, 20 August 2015

Introduction

EVRIDB Objects provide connection and query capability for many types of databases. For MySQL, ODBC, and JavaDB databases EVRIDB objects work with no special preparations. For other databases a JDBC Driver will be necessary. The object can return a cell array of values (with a mix of datatypes) or a DataSet Object .

This object is not heavily maintained for all database types. For a more extensive set of database tools see The MathWorks Database Toolbox.

Examples of creating and using objects here.

The general workflow of using a EVRIDB object:

  • Set connection attributes.
  • Test the connection.
  • Set query properties.
  • Run queries.

Connection Properties

.type

Type of connection (e.g., 'access' 'mysql' mssql') Determines what driver is used. When set, default values will be added to .provider, .driver, and .driver_jar_file where appropriate.

Microsoft Windows Connections

  • access - Microsoft Access database.
  • mssql - Microsoft SQL Server.
  • mysql - MySQL database (Windows).
  • dsn - Microsoft database (Data Source Name).

JDBC Connections

  • jmysql - MySQL database(JDBC).
  • oracle - Oracle database.
  • derby - Derby (JavaDB) local database.

Custom Connections

  • generic - Custom type connection.

.location

Folder containing database file (on local file system).

.create

Depending on type of database, create database is not already.

.persistent

Do not close connection object after creation or query, stored (in appdata 0). When calling multiple times this can help reduce time to return results.

.driver

Driver to be used for connection (these must be currently installed on the machine, use the ODBC Manager from Administrative Tools to view currently available drivers on a Windows machine. JDBC must have driver location in .driver_jar_file.

.driver_jar_file

JDBC driver jar file location. This is added to the dynamic class path in Matlab.

.provider

Only used by ADODB object so this will always be 'MSDASQL'.

.use_authentication

Use user authentication when making connection, must provide .username and .pw.

.username

User to connect as.

.pw

Password to connect as.

.use_encryption

Whether or not to use database encryption (derby).

.encryption_hash

Hash key for encryption.

.server

IP address for database (default location is 'localhost').

.dsn

Data Source Name (set up on local computer using ODBC Manager from Administrative Tools). If the database connection remains static, this can be a simple way to manage the connection. See the "ODBC" topic in Windows help for more information on DSN.

.port

Connection port number.

.arguments.name

Sub structure of additional arguments. This value must be a sting of exactly what is required in the database connection string.

.arguments.value

Sub structure of additional arguments. This value must be a sting of exactly what is required in the database connection string.

Query Properties

.sql_string

Stored SQL statement run if .execute is empty.

.return_type

[{'cell'} 'dso']Specify how to return data, as DSO or Cell array.

.use_column_names

['yes' 'no'] If return type = DSO, try to use column names as variable names in the DSO or the first row if cell output.

.query_watibar

['on' 'off' {'auto'}] Show a waitbar when parsing jdbc record sets, 'auto' is set to show if larger than 1000 records.

.null_as_nan

[{1} 0] Interpret null values in a numeric column as NaN. Set to 0 to help speed up query parsing.

Connection Methods

.getconnection

Get connection object.

.test

Test database connection.

.close

Close database connection

.closeconnection_force

Close connection even if it's persistent.

.shutdown_derby

Try a graceful shutdown of Derby.

Query Methods

.runquery

Run query.

.ms_get_last

Try to get last id from auto-increment ID value.

.get_tables

Get table names from ADO.