ODBC set up to SQL server

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf ODBC set up to SQL server

  • Creator
    Topic
  • #48973
    Krishna Kumar
    Participant

      I have to extract data from SQL server. I have a stored procedure doing that. How do I set up an ODBC connection so that I can make use of the SP to get data into engine to a flat file.

      I am novice to IE.

      Any suggetions welcome. Thanks

    Viewing 10 reply threads
    • Author
      Replies
      • #60287
        Jim Kosloskey
        Participant

          Krishna,

          Are you running on Unix or Windows?

          Jim Kosloskey

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #60288
          Krishna Kumar
          Participant

            Jim Kosloskey wrote:
            Krishna,

            Are you running on Unix or Windows?

            Jim Kosloskey

            Jim:

            We are using Windows 2003 server. thanks

            K

          • #60289
            Krishna Kumar
            Participant

              Krishna Kumar wrote:
              Jim Kosloskey wrote:
              Krishna,

              Are you running on Unix or Windows?

              Jim Kosloskey

              Jim:

              We are using Windows 2003 server. thanks

              K

            • #60290
              Jim Kosloskey
              Participant

                Krishna,

                We are AIX and have just begun to use the ODBC Driver add-on.

                I am not sure but I don’t think you need the add-on for the Windows environment (especially not for Sql-Server I would guess).

                Hopefully one of the Windows Cloverleaf(R) gurus out there can guide you.

                Jim Kosloskey

                email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

              • #60291
                Jonathan Hamilton
                Participant

                  In a Windows Server environment you can use the Microsoft ODBC manager to define an ODBC connection to SQL Server then use the TclODBC extensions for Tcl.  TclODBC isn’t as powerful as the Merant drivers but it’s a lot easier to learn.

                  http://sourceforge.net/projects/tclodbc

                • #60292
                  Krishna Kumar
                  Participant

                    Jonathan Hamilton wrote:
                    In a Windows Server environment you can use the Microsoft ODBC manager to define an ODBC connection to SQL Server then use the TclODBC extensions for Tcl.

                  • #60293
                    Jim Kosloskey
                    Participant

                      Krishna,

                      To what level are you trained (Level 1, Level 2, etc.)?

                      The reason I ask is it might make it easier to frame the replies/questions if we knew the knowledge level.

                      Thanks,

                      Jim Kosloskey

                      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                    • #60294
                      Krishna Kumar
                      Participant

                        Jim Kosloskey wrote:
                        Krishna,

                        To what level are you trained (Level 1, Level 2, etc.)?

                        The reason I ask is it might make it easier to frame the replies/questions if we knew the knowledge level.

                        Thanks,

                        Jim Kosloskey

                        Level1

                      • #60295
                        Jonathan Hamilton
                        Participant

                          Do you have experience with database programming with other languages and or know SQL?

                          Otherwise, this may be a little too advanced to start learning Cloverleaf/Tcl programming with.

                          The basics though are:

                          1.  Create the ODBC configuration using the Windows ODBC Administration tool.

                          2.  In your Tcl code, request the tclodbc package using ‘package require tclodbc’.

                          3.  Open a connection to the database using ‘database connect db $DSN $database $user $password’.  Note the third value (db) is a variable name which acts as a pointer to the database instance.

                          4.  Create your SQL statement using parsed data or whatever.  i.e. ‘set sql “SELECT ClientLabCode FROM LabCodes WHERE Vendor=’$vendor’ AND LabCode=’$labcode'”‘.

                          5.  Execute the sql using the database instance.  ‘set clientLabCode [db $sql]’.

                          6.  Close the database instance.  ‘db disconnect’.

                          That’s the basics.  Depending on what you want to accomplish there may be more necessary.

                          Jonathan

                        • #60296
                          Krishna Kumar
                          Participant

                            Jonathan Hamilton wrote:
                            Do you have experience with database programming with other languages and or know SQL?

                            Otherwise, this may be a little too advanced to start learning Cloverleaf/Tcl programming with.

                            The basics though are:

                            1.

                          • #60297
                            Jonathan Hamilton
                            Participant

                              Shouldn’t be very difficult for you then.  If you are fetching multiple fields from a table the values are returned as a Tcl list.

                              If you have any questions once you get into it you can email me at jonathan.hamilton@hcahealthcare.com since I don’t always watch the forums.

                              Jonathan

                          Viewing 10 reply threads
                          • The forum ‘Cloverleaf’ is closed to new topics and replies.