David B Copeland wrote:
I've partially solved my problem. I can create a dummy ODBC datasource,
then in Lazarus add the real database name to the Params of the
ODBCConnection object.

I do not exactly understand your original problem, but you surely need to add 
the database name to TODBCConnection.Params. (like e.g. DATABASE=myDB)

ODBC only specifies the some parameters; hence I mapped those to 
TODBCConnection properties. Other parameters can have different names for 
different ODBC drivers, so you need to use the Params property.

The fpc/fcl/db/sqldb/odbc/odbcconn.pas unit says:

   property Driver:string read FDriver write FDriver;                         
// will be passed as DRIVER connection parameter
   property FileDSN:string read FFileDSN write FFileDSN;                      
// will be passed as FILEDSN parameter
   // Redeclare properties from TSQLConnection
   property Password;     // will be passed as PWD connection parameter
   property UserName;     // will be passed as UID connection parameter
   property CharSet;
   property HostName;     // ignored
   // Redeclare properties from TDatabase
   property DatabaseName; // will be passed as DSN connection parameter
   property LoginPrompt;  // if true, ODBC drivers might prompt for more 
details that are not in the connection string
   property Params;       // will be added to connection string

(you can get here by CTRL+Click on TODBCConnection in Lazarus)

So UserName and Password are mapped to properties, just as Driver and FileDSN, 
and DatabaseName to DSN (ODBC Datasource Name). Note: Any parameter can also be 
specified in Params!

For e.g. the MySQL ODBC driver valid Params are e.g. 'PORT=3306', 
'SERVER=example.com' and 'DATABASE=myDB'.

Regards,

Bram

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to