Rochdi Badis · Mar 22, 2022

Import Access database

Hi Guys,

is there an easy way to import MS Access database into ensemble? 


Product version: Caché 2014.1
0 186
Discussion (1)1
Log in or sign up to continue

You may configure an ODBC Data Source to your MSAccess "file" and use the %SQLGatewayConnection class. When I had to use it around 2012 was looking like this:

set dsn="<yourODBCSource>"
set conn=##class(%SQLGatewayConnection).%New()
set sc=conn.Connect(dsn,"","",0) 
set res=##class(%ResultSet).%New("%DynamicQueryGW:SQLGW")
set sc=res.Prepare("SELECT * FROM yourAccessTable",,conn)
set sc=res.Execute()
while res.Next() { 
  write !;res.Get("yourColumn")