Welcome, Guest
Username: Password: Remember me
Components and Libraries for Database Development, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11105

  • Felipe Eduardo Ortiz López
  • Felipe Eduardo Ortiz López's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • PASCAL programmers do it recursively...
  • Posts: 9
  • Thank you received: 0
Hi there!

New to CT, but worked a lot in Delphi, so the style of coding is not a mistery to me..., I connected to Firebird (piece of cake) and Postgres (simple as can be), but I couldn't connect to MS SQL Server 2014 or any other version.

Can you provide me with a tutorial or step-by-step or something to allow me to connect? Working on Win 10-64, MSSQLS 2014, CT 6.3.
____________________________________
Felipe Eduardo Ortiz López.
"A programmer is a biological machine that transforms coffe into code lines."

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11106

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
Thanks Sir
Did you try to connect to your MS SQL server with
Database Desktop tool ?
with SQLDB direct or
with ODBC ?

pl_ZeosDBO is the next option to connect with a MSSQL Server




PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11107

  • usbdoo
  • usbdoo's Avatar
  • Visitor
  • Visitor
I try this in Firebird.

If table define as


CREATE TABLE "sKonto"
(
"KontoID" varchar(8) NOT NULL,
"Konto" varchar(100) NOT NULL,
"Analitika" char(1),
"KorDat" date,
"Korisnik" varchar(14),
CONSTRAINT "PK_Konto" PRIMARY KEY ("KontoID")
);


not vork

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11108

  • Manos S. Pappas
  • Manos S. Pappas's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 69
  • Thank you received: 1

Sternas Stefanos wrote: Thanks Sir
Did you try to connect to your MS SQL server with
Database Desktop tool ?
with SQLDB direct or
with ODBC ?

pl_ZeosDBO is the next option to connect with a MSSQL Server





Hello Mr. Sternas,

Using CT 6.3 final, Database Desktop crashes both on 32-bit and 64-bit of TyphonIDE.
Crash occurs with either option (New Dictionary, new connection etc).
Best Regards,
Manos S. Pappas
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by Manos S. Pappas.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11109

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
Sir
please look in files:

C:\codetyphon\fpcsrc\packages\dblib\src\dblib.pp
**********************************************************************
    FreeTDS (http://www.freetds.org/userguide/choosingtdsprotocol.htm):
      tds version = 5.0 - Sybase System 10 and above
                    7.0 - MS SQL Server 7
                    7.1 - MS SQL Server 2000 (*default*)
                    7.2 - MS SQL Server 2005
                    7.3 - MS SQL Server 2008
                    7.4 - MS SQL Server 2012/2014
      tds version can be set using env.var. TDSVER or in freetds.conf or .freetds.conf
}
unit dblib;

{$IFDEF FPC}{$mode objfpc}{$ENDIF}{$H+}

{ $DEFINE ntwdblib}  //if you are using MS SQL Server Client Library (ntwdblib.dll)
{$IFNDEF ntwdblib}
 {$DEFINE freetds}  //if you are using db-lib from FreeTDS project (MS SQL Server + Sybase support)
{$ENDIF}

{$DEFINE LOAD_DYNAMICALLY}

interface

const
  DBLIBDLL=
{$IFDEF WINDOWS}
  {$IFDEF ntwdblib}'ntwdblib.dll'{$ENDIF}
  {$IFDEF freetds} 'dblib.dll'   {$ENDIF}
{$ELSE}
  {$IFDEF DARWIN}
    'libsybdb.dylib'
  {$ELSE}
    'libsybdb.so'
  {$ENDIF}
{$ENDIF}


C:\codetyphon\fpcsrc\packages\fcl-db\src\sqldb\mssql\mssqlconn.pp
    MS SQL Server Client Library is required (ntwdblib.dll)
    - or -
    FreeTDS (dblib.dll)
      freetds.conf: (http://www.freetds.org/userguide/freetdsconf.htm)
        [global]
        tds version = 7.1
        client charset = UTF-8
        port = 1433 or instance = ...  (optional)
        dump file = freetds.log        (optional)
        text size = 2147483647         (optional)

    TMSSQLConnection properties:
      HostName - can be specified also as 'servername:port' or 'servername\instance'
                 (SQL Server Browser Service must be running on server to connect to specific instance)
      CharSet - if you use Microsoft DB-Lib and set to 'UTF-8' then char/varchar fields will be UTF8Encoded/Decoded
                if you use FreeTDS DB-Lib then you must compile with iconv support (requires libiconv2.dll) or cast char/varchar to nchar/nvarchar in SELECTs
      Params - "AutoCommit=true" - if you don't want explicitly commit/rollback transactions
               "TextSize=16777216" - set maximum size of text/image data returned
               "ApplicationName=YourAppName" - Set the app name for the connection. MSSQL 2000 and higher only
}
unit mssqlconn;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, sqldb, db, BufDataset,
  dblib;


if your PC have dblib.dll all are OK
if your PC have ntwdblib.dll then go to
C:\codetyphon\fpcsrc\packages\dblib\src\dblib.pp and set
in line 32: {$DEFINE ntwdblib}
and Rebuild FPCXX
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: Manos S. Pappas

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11111

  • Felipe Eduardo Ortiz López
  • Felipe Eduardo Ortiz López's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • PASCAL programmers do it recursively...
  • Posts: 9
  • Thank you received: 0
...and some questions... (thanks for the "sir" part ;) )

* Where I can find (or construct) dblib.dll ?
* Do you have any additional informaion regarding MS SQL conections?

Tried the solution, but as reported above, had an exception. Right now applied the solution and rebuilding the tools and Big IDE (I assume thats the correct building), when its done, I'll try and will be reporting any pending issue. Thanks in advance.
____________________________________
Felipe Eduardo Ortiz López.
"A programmer is a biological machine that transforms coffe into code lines."

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11112

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11114

  • Manos S. Pappas
  • Manos S. Pappas's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 69
  • Thank you received: 1

Sternas Stefanos wrote: if your PC have dblib.dll all are OK
if your PC have ntwdblib.dll then go to
C:\codetyphon\fpcsrc\packages\dblib\src\dblib.pp and set
in line 32: {$DEFINE ntwdblib}
and Rebuild FPCXX


Thank you for your answer.
Unfortunately, the Database Desktop tool crashes when trying to create a new dictionary.
Best Regards,
Manos S. Pappas

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11115

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
More info Sir
-did you test "dblib.dll" or "ntwdblib.dll" ?
-Typhon32 or Typhon64 ?
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11117

  • Manos S. Pappas
  • Manos S. Pappas's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 69
  • Thank you received: 1

Sternas Stefanos wrote: More info Sir
-did you test "dblib.dll" or "ntwdblib.dll" ?
-Typhon32 or Typhon64 ?


Thank you sir.

- Tried ntwdblib.dll, compiled fine and is detected right. The access violation also appears when the tool is compiled for dblib.dll.
- Both Typhon32 and Typhon64 expose the problem.

Using CT 6.30 final.
Best Regards,
Manos S. Pappas

Please Log in or Create an account to join the conversation.

Last edit: by Manos S. Pappas.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11118

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
Thanks
we working in a new version of ctdatadesktop
more soon...
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: Manos S. Pappas, Felipe Eduardo Ortiz López

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11122

  • Felipe Eduardo Ortiz López
  • Felipe Eduardo Ortiz López's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • PASCAL programmers do it recursively...
  • Posts: 9
  • Thank you received: 0

Sternas Stefanos wrote: Thanks
we working in a new version of ctdatadesktop
more soon...


Well, so my news had became old...

Done everything as requested (changin the file, rebuilding) but no effect, still having the exception...

And I need to connect my application to MS SQL Server. How 'soon' is 'more soon'?
____________________________________
Felipe Eduardo Ortiz López.
"A programmer is a biological machine that transforms coffe into code lines."

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11123

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
Soon is "LAB soon" :)

Please try the new (BETA) ctdatadesktop

and your help please....
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: Manos S. Pappas

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 6 years 11 months ago #11126

  • Manos S. Pappas
  • Manos S. Pappas's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 69
  • Thank you received: 1

Sternas Stefanos wrote: Soon is "LAB soon" :)

Please try the new (BETA) ctdatadesktop

and your help please....


Replaced the CT6.30 one inside the source typhon package, rebuilt everything and it works great both 32 and 64 bit.
Thank you very much :)
Best Regards,
Manos S. Pappas

Please Log in or Create an account to join the conversation.

Last edit: by Manos S. Pappas.

CodeTyphon connecting to MS SQL Server 2014 5 years 11 months ago #12910

  • Guido
  • Guido's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
is there also a fix for the error
Can not load DB-Lib client library "libsybdb.so". Check your installation.
Success

This is very annoying it seems this lib is for sybase, i am trying to connect to ms sql server
I am getting this from the IDE so I DO NOT WANT runtime solutions, I want this working in the IDE

If I am to switch from Delphi to CT than it should be working off course

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 1 year 1 month ago #18062

  • Guido
  • Guido's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Is there a solution for this problem by now ? I am having the exact same problem, still not fixed

Please Log in or Create an account to join the conversation.

CodeTyphon connecting to MS SQL Server 2014 1 year 1 month ago #18063

  • Guido
  • Guido's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
working with version 8.2 of the database desktop, the problem is still not fixed. How to connect with SQL Server please, and not an explanation that does not works and not finds the DLL even if they are there

Please Log in or Create an account to join the conversation.

Last edit: by Guido.

CodeTyphon connecting to MS SQL Server 2014 1 year 4 weeks ago #18097

  • Rain
  • Rain's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 71
  • Thank you received: 8
This works for me:
// ftp://ftp.freepascal.org/pub/fpc/contrib/windows/dblib_1.3.zip
// put only these DLLs in exe ProgramDir: (make sure 64bit for 64bit exe . . .  just saying)
// dblib.dll 
// libiconv.dll


uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  Classes
  { you can add units after this },
  SysUtils,
  MSSQLConn,  sqldb, Generics.Collections;


procedure getSQLrow();
var
  AConnection  : TMSSQLConnection;//TSQLConnection;
  ATransaction : TSQLTransaction;
  Query        : TSQLQuery;

  aRow : TStringArray;
  i:integer ;
begin
  rowlist := TStringList.create;

  AConnection := TMSSQLConnection.create(nil);
  AConnection.Hostname := '192.168.0.100';
  AConnection.username := 'anuser';
  AConnection.Password := '123456';

  ATransaction := TSQLTransaction.Create(AConnection);
  AConnection.Transaction := ATransaction;
  AConnection.DatabaseName := 'andb';
  Query := TSQLQuery.Create(nil);

  Query.SQL.Text := 'SELECT ...... ;';

  aRow := [ 'row1','row2'];
 

  Query.Database := AConnection;
  Query.Open;
  while not Query.Eof do
  begin
   // etc  . . .
  

    Query.Next;
  end;
  Query.Close;
  AConnection.Close;
  Query.Free;
  ATransaction.Free;
  AConnection.Free;


end;

Please Log in or Create an account to join the conversation.

Last edit: by Rain.
  • Page:
  • 1