Problem with Perl DBI - IO::Socket::INET:

Discussion in 'Perl Misc' started by Lucas Young, Dec 11, 2005.

  1. Lucas Young

    Lucas Young Guest

    Hi all

    I'm trying to setup a connection to a Hypersonic SQL database on Ubuntu Linux.
    I've installed HSQLDB-BER from
    http://sourceforge.net/projects/hsqldb-ber/ and the server seems to
    start OK, but I get this error running the sample.pl script:

    DBI connect('hostname=localhost:9111;url=ber:hsqldb:play','sa',...)
    failed: Failed to open socket to server: IO::Socket::INET: connect:
    Connection refused at sample.pl line 27
    Failed to connect: (104) Failed to open socket to server:
    IO::Socket::INET: connect: Connection refused

    The line of code is:

    $dsn = "dbi:JDBC:hostname=localhost:9111;url=ber:hsqldb:play";

    What can cause the IO::Socket::INET: error, and can you suggest ways
    to debug it?
    many thanks in advance
     
    Lucas Young, Dec 11, 2005
    #1
    1. Advertising

  2. Lucas Young

    John Bokma Guest

    Lucas Young <lucas _a_t_ digitalus _dot_ co _dot_ nz> wrote:

    > Hi all
    >
    > I'm trying to setup a connection to a Hypersonic SQL database on
    > Ubuntu Linux. I've installed HSQLDB-BER from
    > http://sourceforge.net/projects/hsqldb-ber/ and the server seems to
    > start OK, but I get this error running the sample.pl script:
    >
    > DBI connect('hostname=localhost:9111;url=ber:hsqldb:play','sa',...)
    > failed: Failed to open socket to server: IO::Socket::INET: connect:
    > Connection refused at sample.pl line 27
    > Failed to connect: (104) Failed to open socket to server:
    > IO::Socket::INET: connect: Connection refused
    >
    > The line of code is:
    >
    > $dsn = "dbi:JDBC:hostname=localhost:9111;url=ber:hsqldb:play";


    I doubt if that's line 27, unless $dsn has some magic.

    --
    John Small Perl scripts: http://johnbokma.com/perl/
    Perl programmer available: http://castleamber.com/
    I ploink googlegroups.com :)
     
    John Bokma, Dec 11, 2005
    #2
    1. Advertising

  3. John Bokma wrote:
    > Lucas Young <lucas _a_t_ digitalus _dot_ co _dot_ nz> wrote:
    >
    >> Hi all
    >>
    >> I'm trying to setup a connection to a Hypersonic SQL database on
    >> Ubuntu Linux. I've installed HSQLDB-BER from
    >> http://sourceforge.net/projects/hsqldb-ber/ and the server seems to
    >> start OK, but I get this error running the sample.pl script:
    >>
    >> DBI connect('hostname=localhost:9111;url=ber:hsqldb:play','sa',...)
    >> failed: Failed to open socket to server: IO::Socket::INET: connect:
    >> Connection refused at sample.pl line 27
    >> Failed to connect: (104) Failed to open socket to server:
    >> IO::Socket::INET: connect: Connection refused
    >>
    >> The line of code is:
    >>
    >> $dsn = "dbi:JDBC:hostname=localhost:9111;url=ber:hsqldb:play";

    >
    > I doubt if that's line 27, unless $dsn has some magic.
    >


    Vim tells me it's line 24 :)

    $dsn = "dbi:JDBC:hostname=localhost:9111;url=ber:hsqldb:play";
    my %null;

    $dbh = DBI->connect($dsn, "sa", "", \%null)
    or ( die("Failed to connect: ($DBI::err) $DBI::errstr\n"));

    Lucas: you need to verify that the server is running, and that it is
    listening on the port on which you think it is running. If it produces
    error logs, what is in them? Have you verified that there is a process
    listening on the port to which the sample script is trying to connect
    ie does

    telnet localhost 9111

    connect or do you get connection refused? lsof is also good for
    diagnosing (among other things) what process is listening on which port.
    What does

    lsof -i :9111

    return?


    What is in the error logs for the server?

    Mark
     
    Mark Clements, Dec 11, 2005
    #3
  4. Lucas Young

    Lucas Young Guest

    On 2005-12-12 00:09:42 +1300, Mark Clements
    <> said:

    > John Bokma wrote:
    >> Lucas Young <lucas _a_t_ digitalus _dot_ co _dot_ nz> wrote:
    >>
    >>> Hi all
    >>>
    >>> I'm trying to setup a connection to a Hypersonic SQL database on
    >>> Ubuntu Linux. I've installed HSQLDB-BER from
    >>> http://sourceforge.net/projects/hsqldb-ber/ and the server seems to
    >>> start OK, but I get this error running the sample.pl script:
    >>>
    >>> DBI connect('hostname=localhost:9111;url=ber:hsqldb:play','sa',...)
    >>> failed: Failed to open socket to server: IO::Socket::INET: connect:
    >>> Connection refused at sample.pl line 27
    >>> Failed to connect: (104) Failed to open socket to server:
    >>> IO::Socket::INET: connect: Connection refused
    >>>
    >>> The line of code is:
    >>>
    >>> $dsn = "dbi:JDBC:hostname=localhost:9111;url=ber:hsqldb:play";

    >>
    >> I doubt if that's line 27, unless $dsn has some magic.
    >>

    >
    > Vim tells me it's line 24 :)
    >
    > $dsn = "dbi:JDBC:hostname=localhost:9111;url=ber:hsqldb:play";
    > my %null;
    >
    > $dbh = DBI->connect($dsn, "sa", "", \%null)
    > or ( die("Failed to connect: ($DBI::err) $DBI::errstr\n"));
    >
    > Lucas: you need to verify that the server is running, and that it is
    > listening on the port on which you think it is running. If it produces
    > error logs, what is in them? Have you verified that there is a process
    > listening on the port to which the sample script is trying to connect
    > ie does
    >
    > telnet localhost 9111
    >
    > connect or do you get connection refused? lsof is also good for
    > diagnosing (among other things) what process is listening on which
    > port. What does
    >
    > lsof -i :9111
    >
    > return?
    >
    >
    > What is in the error logs for the server?
    >
    > Mark


    Hi Guys
    Silly me, I didnt have a server running :) Now the sample is working fine.
    What I'd like to be aable to do is connect to the Hypersonic SQL
    database that comes with Readerware (Readerware lets you scan
    book/dvd/cd barcodes, it looks them up on Amazon etc and stores them in
    a database). The developer has provided the database info:

    Readerware uses Hypersonic SQL.
    The JDBC driver is distributed with Readerware in lib\hsql.jar
    Login Name: sa
    Password:
    (Leave the password field blank)

    URL: jdbc:HypersonicSQL:C:\Readerware\RWareDB.rwd
    Driver: org.hsql.jdbcDriver
    Driver Location: C:\Readerware\lib\hsql.jar

    How could I configure the sample to connect to this database? I'd be a
    very happy camper after that :)
    Thanks for all the help

    Lucas
     
    Lucas Young, Dec 14, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rad
    Replies:
    0
    Views:
    570
  2. Aggro

    Re: INET socket programming questions

    Aggro, Jun 28, 2003, in forum: C Programming
    Replies:
    1
    Views:
    1,229
    Artemio
    Jun 29, 2003
  3. Joe
    Replies:
    10
    Views:
    301
  4. Hobbit HK

    IO::Socket::INET Problem

    Hobbit HK, Feb 9, 2004, in forum: Perl Misc
    Replies:
    6
    Views:
    186
    Hobbit HK
    Feb 12, 2004
  5. Stuart Gall

    IO::Socket::INET on OSX or TCP stack problem

    Stuart Gall, May 7, 2009, in forum: Perl Misc
    Replies:
    17
    Views:
    408
    Stuart Gall
    May 15, 2009
Loading...

Share This Page