Recent

Author Topic: Connect to remote MS-SQL Server  (Read 6352 times)

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Connect to remote MS-SQL Server
« on: January 09, 2007, 11:23:55 am »
Hello and happy new year to everybody.

I'm trying to connect to a remote MS-SQL Server using TODBCConnect but I can't. I set Driver = SQL Server and then I tried different values for DSNFilename, Server, DSN, etc. but it doesn't connect.

How should I connect with the remote MS-SQLServer data base?
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: Connect to remote MS-SQL Server
« Reply #1 on: January 11, 2007, 07:13:04 pm »
1. Create a system-DSN which connects to your DB-server.
Make sure it connects to the server by testing it.
2. Use the name of this system-DSN in the DatabaseName-property of your ODBCConnection.
If you use persistent login information you can connect to DB-server without any other settings in ODBCConnection
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
RE: Connect to remote MS-SQL Server
« Reply #2 on: January 15, 2007, 12:04:04 pm »
Thanks. It works.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

moespi

  • Newbie
  • Posts: 5
RE: Connect to remote MS-SQL Server
« Reply #3 on: January 19, 2007, 08:27:11 pm »
Hi Ñuño, that other components you used to collect data,  for example uses TSQLQuery ? TDataSource? with TODBCConnection

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
RE: Connect to remote MS-SQL Server
« Reply #4 on: January 22, 2007, 05:30:12 pm »
I used TODBCConnection to connect with the database, TSQLQuery to execute SQL commands, TSQLTransaction to manage transactions (just set the TSQLTransaction.Database and TSQLQuery.Transaction propertyes and it should work) and TDataSource to interface the SQL result and the DataControls.

[edit] It should be nice to put an TODBCConnection example in the Lazarus Database Tutorial. I haven't time enought to write it now but I can send a small example I wrote to understand it.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

 

TinyPortal © 2005-2018