Using Lazarus to connect to MSSQL 2005 lazarus / 16-Databases ---------------------------------------------------------------------- MainMeat · 2011-03-09 15:33 Hi Everyone, I am having trouble getting Lazarus / FPC to connect to a MS SQL 2005 server. I am using CentOS 5.5 as the host operating system and MS SQL Server 2005 is running on a Windows 2003 Enterprize platform. What I have done, as this is new to me, is install unixODBC on CentOS and configured a odbc.ini profile as follows: Code: [Select][PostgreSQL] Description             = Test to Postgres Driver          = PostgreSQL #Driver         = SQL Server Trace           = Yes TraceFile               = sql.log Database                = ACTIONS_LOGGED Servername              = 10.0.0.102 UserName                = datauser Password                = datUser Port            = 1433 Protocol                = 6.4 ReadOnly                = No RowVersioning           = No ShowSystemTables                = No ShowOidColumn           = No FakeOidIndex            = No ConnSettings            = In my test application I have the following basic code: Code: [Select]conn := TODBCConnection.Create(nil); qry := TSQLQuery.Create(nil); trans := TSQLTransaction.Create(nil); conn.hostname := '10.0.0.102'; conn.DatabaseName := 'PostgreSQL'; //this is the odbc template to use? conn.Transaction := trans; conn.Username := datauser cobn.Password := dataUser qry.Database := conn; conn.Connected := true; When I run this code I get the following error (had various other errors but this is where I am stuck now): Code: [Select]Could not connect with connection string "DSN=PostgreSQL;UID=datauser;PWD=datUser;". ODBC error details: LastReturnCode: SQL_ERROR; Record 1: SqlState: HY000; NativeError: 101; Message: [unixODBC]Could not connect to the server; Could not connect to remote socket.; Can anyone perhaps guide me as to how I can connect, and execute queries on a MS SQL 2005 database from a CentOS 5.5 platform. If ODBC is not the way to go, is there perhaps an easier or better alternative that I can use? Many many thanks for any inputs! ---------------------------------------------------------------------- Lacak2 · 2011-03-10 05:34 http://wiki.lazarus.freepascal.org/ODBCConn ---------------------------------------------------------------------- xenblaise · 2011-03-11 15:03 use TSQLConnectoR, that is the msSQL connection base. Someone, Please correct me if I am wrong. ---------------------------------------------------------------------- JimBeam · 2011-03-13 18:14 Eehm, yes... I have a sneaky suspicion TSQLConnector is a parent from which the others such as the Postgres and Firebird connectors inherit. IIRC, you would need to use ODBC to access SQL Server..