Data Connections
Data Connections
Generally, one of the first steps when you are trying to work with databases is
open it. You can find several types of those, and each have a different mode of
connection. When you try to connect with your database sometimes, you don't know
the correct connection string that you must use. It is for that I wrote this
article. I wanted to compile the connection strings to the majority of known
databases...
ODBC DSN Less Connection
ODBC Driver for dBASE
Note: You must specify the filename in the SQL statement... For example:
If you are using tab delimited files, you must create the schema.ini file, and you
must inform the Format=TabDelimited option in your connection string.
Note: You must specify the filename in the SQL statement... For example:
If you are using a database container, the connection string is the following:
If you are working without a database container, you must change the SourceType
parameter by DBF as in the following connection string:
If you are using a Workgroup (System database): you need to inform the SystemDB
Path, the User Name and its password. For that, you have two solutions: inform the
user and password in the connection string or in the moment of the open operation.
For example:
Also, you can use the parameter Trusted_Connection that indicates that you are
using the Microsoft Windows NT Authentication Mode to authorize user access to the
SQL Server database. For example:
If the SQL Server is running in the same computer, you can replace the name of the
server by the word (local) like in the following sample:
If you want to connect with a remote SQL Server, you must inform the address, the
port, and the Network Library to use:
The Address parameter must be an IP address and must include the port. The Network
parameter can be one of the following:
dbnmpntw Win32 Named Pipes
dbmssocn Win32 Winsock TCP/IP
dbmsspxn Win32 SPX/IPX
dbmsvinn Win32 Banyan Vines
dbmsrpcn Win32 Multi-Protocol (Windows RPC)
If you want to connect to a local database, you can use a connection string like
the following:
If you want to connect with a remote database, you need to specify the name of the
server or its IP in the Server parameter. If the Port is distinct to 3306 (default
port), you must specify it.