Retrieving data from a database
To fetch data from a database most of the time only very few steps have to be taken:
The fist step is to load the Database Link.
![[Graphics:Images/index_gr_1.gif]](Images/index_gr_1.gif)
The second step is to connect to the database. If the target database is file based like a MS Access database just feed DatabaseConnect with the filename including the full path.
![[Graphics:Images/index_gr_2.gif]](Images/index_gr_2.gif)
Retrieve the data with a standard SQL command as a string embedded in the Mathematica Sql-command which comes with the Database Link
![[Graphics:Images/index_gr_3.gif]](Images/index_gr_3.gif)
Getting information on a database
The previous example assumed that the user already knows enough about the database to do the query. To get informations on a database the command DatabaseInfo is provided.
To get basic information on a database just use DatabaseInfo together with the handle pointing to the target database after the conncetion (for connecting see: Retrieving data from a database)
![[Graphics:Images/index_gr_5.gif]](Images/index_gr_5.gif)
To retrieve information on a specific table use
![[Graphics:Images/index_gr_7.gif]](Images/index_gr_7.gif)
To see what a query is about use
![[Graphics:Images/index_gr_9.gif]](Images/index_gr_9.gif)