Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] pgocaml: how to use it?

Expand Messages
  • Richard Jones
    ... Not hugely useful because this just shows that make fails. You need to strace the actual program which fails -- try strace -f and untangle the failing
    Message 1 of 12 , Aug 31, 2007
    • 0 Attachment
      On Fri, Aug 31, 2007 at 11:08:51AM +0200, Johann Spies wrote:
      > I have 'straced' 'make' now. First I found this when I used
      > LC_MESSAGE="af_ZA" or "en_ZA":
      > write(2, "make: ", 6make: ) = 6
      > write(2, "*** [test_pgocaml.cmo] Error 2", 30*** [test_pgocaml.cmo]

      Not hugely useful because this just shows that make fails. You need
      to strace the actual program which fails -- try 'strace -f' and
      untangle the failing program from that.

      Rich.

      --
      Richard Jones
      Red Hat
    • Johann Spies
      ... Will this help: [pid 29893] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b0a3d099000 [pid 29893] read(4,
      Message 2 of 12 , Sep 5, 2007
      • 0 Attachment
        On Fri, Aug 31, 2007 at 11:20:09PM +0100, Richard Jones wrote:

        > Not hugely useful because this just shows that make fails. You need
        > to strace the actual program which fails -- try 'strace -f' and
        > untangle the failing program from that.

        Will this help:

        [pid 29893] mmap(NULL, 4096, PROT_READ|PROT_WRITE,
        MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b0a3d099000
        [pid 29893] read(4, "127.0.0.1\tlocalhost\n127.0.1.1\twe"..., 4096) =
        289
        [pid 29893] read(4, "", 4096) = 0
        [pid 29893] close(4) = 0
        [pid 29893] munmap(0x2b0a3d099000, 4096) = 0
        [pid 29893] getrusage(RUSAGE_SELF, {ru_utime={0, 16001}, ru_stime={0,
        8000}, ...}) = 0
        [pid 29893] getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0,
        0}, ...}) = 0
        [pid 29893] getppid() = 29892
        [pid 29893] uname({sys="Linux", node="werkesel", ...}) = 0
        [pid 29893] socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
        [pid 29893] connect(4, {sa_family=AF_INET, sin_port=htons(5432),
        sin_addr=inet_addr("127.0.0.1")}, 16) = 0
        [pid 29893] fcntl(4, F_GETFD) = 0
        [pid 29893] fcntl(4, F_SETFD, FD_CLOEXEC) = 0
        [pid 29893] lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
        [pid 29893] lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
        [pid 29893] write(4, "\0\0\0\35\0\3\0\0user\0js\0database\0js\0\0",
        29) = 29
        [pid 29893] read(4, "R\0\0\0\f\0\0\0\5s\354p\374", 4096) = 13
        [pid 29893] write(4, "p\0\0\0(md5d773a278418fa13717d2c01d"..., 41) =
        41
        [pid 29893] read(4, "E\0\0\0\\SFATAAL\0C28000\0Mpassword au"..., 4096)
        = 93
        [pid 29893] read(4, "", 4096) = 0
        [pid 29893] close(3) = 0
        [pid 29893] write(2, "File \"\", line 0, characters 0-1:"..., 65File
        "", line 0, characters 0-1:
        Uncaught exception: End_of_file
        ) = 65
        [pid 29893] write(2, "Uncaught exception: End_of_file\n", 32Uncaught
        exception: End_of_file
        ) = 32
        [pid 29893] exit_group(2) = ?
        Process 29892 resumed
        Process 29893 detached

        Regards
        Johann

        --
        Johann Spies Telefoon: 021-808 4036
        Informasietegnologie, Universiteit van Stellenbosch

        "He hath not dealt with us after our sins; nor rewarded
        us according to our iniquities. For as the heaven is
        high above the earth, so great is his mercy toward
        them that fear him. As far as the east is from the
        west, so far hath he removed our transgressions from
        us." Psalms 103:10-12
      • Richard Jones
        ... That s the error ... If you run strace with the `-s option you ll be able to see more of it. Rich. -- Richard Jones Red Hat
        Message 3 of 12 , Sep 6, 2007
        • 0 Attachment
          On Wed, Sep 05, 2007 at 03:42:26PM +0200, Johann Spies wrote:
          > [pid 29893] read(4, "E\0\0\0\\SFATAAL\0C28000\0Mpassword au"..., 4096)

          That's the error ... If you run strace with the `-s' option you'll be
          able to see more of it.

          Rich.

          --
          Richard Jones
          Red Hat
        • Johann Spies
          ... Thanks. I am learning... But: I can use psql with the same environmental variables ( psql -h $PGHOST -d $PGDATABASE -U $PGUSER -p $PGPORT --password) and
          Message 4 of 12 , Sep 6, 2007
          • 0 Attachment
            On Thu, Sep 06, 2007 at 10:11:57AM +0100, Richard Jones wrote:
            > On Wed, Sep 05, 2007 at 03:42:26PM +0200, Johann Spies wrote:
            > > [pid 29893] read(4, "E\0\0\0\\SFATAAL\0C28000\0Mpassword au"..., 4096)
            >
            > That's the error ... If you run strace with the `-s' option you'll be
            > able to see more of it.
            >
            Thanks. I am learning...

            But: I can use psql with the same environmental variables ( psql -h
            $PGHOST -d $PGDATABASE -U $PGUSER -p $PGPORT --password) and log in
            with the same password. Why not using pgocaml?

            Regards
            Johann
            --
            Johann Spies Telefoon: 021-808 4036
            Informasietegnologie, Universiteit van Stellenbosch

            "Behold, I stand at the door, and knock; if any man
            hear my voice, and open the door, I will come in to
            him, and will sup with him, and he with me."
            Revelation 3:20
          • Richard Jones
            ... I ve no idea, but I guess the error message will tell you. Rich. -- Richard Jones Red Hat
            Message 5 of 12 , Sep 6, 2007
            • 0 Attachment
              On Thu, Sep 06, 2007 at 11:39:18AM +0200, Johann Spies wrote:
              > On Thu, Sep 06, 2007 at 10:11:57AM +0100, Richard Jones wrote:
              > > On Wed, Sep 05, 2007 at 03:42:26PM +0200, Johann Spies wrote:
              > > > [pid 29893] read(4, "E\0\0\0\\SFATAAL\0C28000\0Mpassword au"..., 4096)
              > >
              > > That's the error ... If you run strace with the `-s' option you'll be
              > > able to see more of it.
              > >
              > Thanks. I am learning...
              >
              > But: I can use psql with the same environmental variables ( psql -h
              > $PGHOST -d $PGDATABASE -U $PGUSER -p $PGPORT --password) and log in
              > with the same password. Why not using pgocaml?

              I've no idea, but I guess the error message will tell you.

              Rich.

              --
              Richard Jones
              Red Hat
            • Johann Spies
              ... Thanks for your trouble. My preference was to use your library, but I have wasted several hours now to get it working. I do not understand the logic
              Message 6 of 12 , Sep 7, 2007
              • 0 Attachment
                On Thu, Sep 06, 2007 at 12:54:14PM +0100, Richard Jones wrote:
                > On Thu, Sep 06, 2007 at 11:39:18AM +0200, Johann Spies wrote:
                > > On Thu, Sep 06, 2007 at 10:11:57AM +0100, Richard Jones wrote:
                > > > On Wed, Sep 05, 2007 at 03:42:26PM +0200, Johann Spies wrote:
                > > > > [pid 29893] read(4, "E\0\0\0\\SFATAAL\0C28000\0Mpassword au"..., 4096)
                > > >
                > > > That's the error ... If you run strace with the `-s' option you'll be
                > > > able to see more of it.
                > > >
                > > Thanks. I am learning...
                > >
                > > But: I can use psql with the same environmental variables ( psql -h
                > > $PGHOST -d $PGDATABASE -U $PGUSER -p $PGPORT --password) and log in
                > > with the same password. Why not using pgocaml?
                >
                > I've no idea, but I guess the error message will tell you.

                Thanks for your trouble. My preference was to use your library, but I
                have wasted several hours now to get it working. I do not understand
                the logic behind the fact that the connection must be made at
                compile-time and do not understand how it can then be possible to
                build something that will work on another system.

                It is also not clear to me whether your library is using ssl when
                connecting over the network - as is the case with psql.

                I could at one stage get a test program (from the pdf-documentation
                recently published on this list) to compile and connect to
                localhost.

                But I could not repeat it the following day and I cannot see why.

                I can work with the debian library (libpostgresql-ocaml) without these
                problems. I can connect and manipulate databases on localhost and
                other databases on the network.


                Regards
                Johann

                --
                Johann Spies Telefoon: 021-808 4036
                Informasietegnologie, Universiteit van Stellenbosch

                "For whosoever shall call upon the name of the Lord
                shall be saved." Romans 10:13
              • darioteixeira
                Hi, ... Well, don t give up so easily. We re here to help... ... The logic is simple: if the database we not known at compile-time, how could PG OCaml
                Message 7 of 12 , Sep 7, 2007
                • 0 Attachment
                  Hi,

                  > Thanks for your trouble. My preference was to use your library,

                  Well, don't give up so easily. We're here to help...


                  > have wasted several hours now to get it working. I do not understand
                  > the logic behind the fact that the connection must be made at
                  > compile-time and do not understand how it can then be possible to
                  > build something that will work on another system.

                  The logic is simple: if the database we not known at compile-time,
                  how could PG'OCaml possibly know about the database types?

                  This at first sight seems like a huge limitation, but if you
                  think about it, it does not restrict the use of the same programme
                  on different systems. Note that the function PGOCaml.connect
                  allows you to specify the connection parameters to be used at
                  runtime. You can therefore use environment variables and/or
                  statement flags to specify compile-time parameters, and use
                  environment variables and/or PGOCaml.connect arguments for
                  runtime parameters.

                  > But I could not repeat it the following day and I cannot see why.

                  You can always build a very minimal example that replicates your
                  problem and post it on this list.

                  Cheers,
                  Dario
                • Richard Jones
                  ... You want to pay me to consult on this, then fine. Otherwise it s free software and when it breaks you get to keep both halves. Rich.
                  Message 8 of 12 , Sep 9, 2007
                  • 0 Attachment
                    On Fri, Sep 07, 2007 at 10:35:43AM +0200, Johann Spies wrote:
                    > On Thu, Sep 06, 2007 at 12:54:14PM +0100, Richard Jones wrote:
                    > > On Thu, Sep 06, 2007 at 11:39:18AM +0200, Johann Spies wrote:
                    > > > On Thu, Sep 06, 2007 at 10:11:57AM +0100, Richard Jones wrote:
                    > > > > On Wed, Sep 05, 2007 at 03:42:26PM +0200, Johann Spies wrote:
                    > > > > > [pid 29893] read(4, "E\0\0\0\\SFATAAL\0C28000\0Mpassword au"..., 4096)
                    > > > >
                    > > > > That's the error ... If you run strace with the `-s' option you'll be
                    > > > > able to see more of it.
                    > > > >
                    > > > Thanks. I am learning...
                    > > >
                    > > > But: I can use psql with the same environmental variables ( psql -h
                    > > > $PGHOST -d $PGDATABASE -U $PGUSER -p $PGPORT --password) and log in
                    > > > with the same password. Why not using pgocaml?
                    > >
                    > > I've no idea, but I guess the error message will tell you.
                    >
                    > Thanks for your trouble. My preference was to use your library, but I
                    > have wasted several hours now to get it working. I do not understand
                    > the logic behind the fact that the connection must be made at
                    > compile-time and do not understand how it can then be possible to
                    > build something that will work on another system.
                    >
                    > It is also not clear to me whether your library is using ssl when
                    > connecting over the network - as is the case with psql.
                    >
                    > I could at one stage get a test program (from the pdf-documentation
                    > recently published on this list) to compile and connect to
                    > localhost.
                    >
                    > But I could not repeat it the following day and I cannot see why.
                    >
                    > I can work with the debian library (libpostgresql-ocaml) without these
                    > problems. I can connect and manipulate databases on localhost and
                    > other databases on the network.

                    You want to pay me to consult on this, then fine. Otherwise it's
                    free software and when it breaks you get to keep both halves.

                    Rich.
                  • Johann Spies
                    ... Thanks for the explanation. ... Rather not. My emails about this problem already irritate some readers. Thanks for your willingness to help. Regards
                    Message 9 of 12 , Sep 10, 2007
                    • 0 Attachment
                      On Fri, Sep 07, 2007 at 05:58:42PM -0000, darioteixeira wrote:

                      > The logic is simple: if the database we not known at compile-time,
                      > how could PG'OCaml possibly know about the database types?
                      >
                      > This at first sight seems like a huge limitation, but if you
                      > think about it, it does not restrict the use of the same programme
                      > on different systems. Note that the function PGOCaml.connect
                      > allows you to specify the connection parameters to be used at
                      > runtime. You can therefore use environment variables and/or
                      > statement flags to specify compile-time parameters, and use
                      > environment variables and/or PGOCaml.connect arguments for
                      > runtime parameters.


                      Thanks for the explanation.

                      >
                      > > But I could not repeat it the following day and I cannot see why.
                      >
                      > You can always build a very minimal example that replicates your
                      > problem and post it on this list.

                      Rather not. My emails about this problem already irritate some
                      readers.

                      Thanks for your willingness to help.

                      Regards
                      Johann
                      --
                      Johann Spies Telefoon: 021-808 4036
                      Informasietegnologie, Universiteit van Stellenbosch

                      "Draw near to God and he will draw near to you.
                      Cleanse your hands, you sinners; and purify your
                      hearts, you double minded." James 4:8
                    Your message has been successfully submitted and would be delivered to recipients shortly.