ODBC

Open Database Connectivity (ODBC) is a database API almost exclusively employed by Microsoft.


Connecting

There are a few ways to create an ODBC connection.

ODBCConf.exe

A (deprecated and pending removal) Windows Data Access Components batch script.

odbcconf.exe /a { configdsn "Microsoft Access Driver (*.mdb, *.accdb)" "DSN=DATABASE_NAME|DBQ=ABSOLUTE\PATH\TO\DATABASE.accdb" }

Add-OdbcDsn

A Powershell cmdlet.

Add-OdbcDsn -Name "DATABASE_NAME" -DriverName "Microsoft Access Driver (*.mdb, *.accdb)" -DsnType "User" -SetPropertyValue 'DBQ=ABSOLUTE\PATH\TO\DATABASE.accdb'


Usage

SPSS

get data
 /type=odbc
 /connect='DSN=DATABASE_NAME;DBQ=ABSOLUTE\PATH\TO\DATABASE.accdb;'
 /sql='SELECT * FROM TABLE_NAME'
 /assumedstrwidth=255.


CategoryRicottone

ODBC (last edited 2021-11-20 22:16:07 by DominicRicottone)