Accessing HSQLDB via Perl DBI

James P
2010-05-15
2014-01-19
  • James P
    James P
    2010-05-15

    Hi

    Does anyone know of the best way to access a HSQLDB using Perl DBI?

    There is the HSQLDB-BER module but this is 5 years old and I reckon probably out of date.

     
  • James P
    James P
    2010-05-15

    Thanks.
    Can you point me to where i can find instructions on how to build and install hsqlodbc?

     
  • Blaine Simpson
    Blaine Simpson
    2010-05-15

    There are installation guides and a User Guide under the doc directory.

     
  • James P
    James P
    2010-05-16

    I'm using Windows and don't have a vc++ compiler.

    Can I download the binaries/installer from somewhere?

     
  • James P
    James P
    2010-05-18

    Ok, I need a little help here.

    Firstly, The current version of VC++ Express is 2010, not 2008 SP1.
    So this is what I downloaded aand installed.

    Secondly, I'm not too sure on what version I should usse for the AC_INIT parameter in configure.ac.
    I left it as it is for this first attempt.

    nmake win32.mak appeared to ccomplete successfully, albeit with some warnings. 
    About 20 or so warnings of 'warning C4018: '<' : signed/unsigned mismatch' and
    1 of 'warning C4723: potential divide by 0'.

    The link gave the following output, but I think was still successful.

            link.exe @C:\Users\Peanut\AppData\Local\Temp\nm3AA4.tmp
    LINK : warning LNK4224: /INCREMENTAL:YES is no longer supported;  ignored
       Creating library ..\build\unicode_win32\hsqlodbcu.lib and object ..\build\unicode_win32\hsqlodbcu.exp
    odbccp32.lib(dllload.obj) : warning LNK4217: locally defined symbol __vsnprintf imported in function _StringVPrintfWorkerA@20
            cl.exe @C:\Users\Peanut\AppData\Local\Temp\nm3FA4.tmp
    pgxalib.cpp
            link.exe @C:\Users\Peanut\AppData\Local\Temp\nm4466.tmp
       Creating library ..\build\unicode_win32\pgxalib.lib and object ..\build\unicode_win32\pgxalib.exp
    odbccp32.lib(dllload.obj) : warning LNK4217: locally defined symbol __vsnprintf imported in function _StringVPrintfWorkerA@20
            link.exe @C:\Users\Peanut\AppData\Local\Temp\nm458F.tmp

    But, problems arose when I tried to generate the MSI.
    I assume these errors were down to using the vc++ 2010 compiler and not the 2008 version.
    I tried hacking hsqlodbc.wxs to refer to VC100 and similar, but this didn't work.
    Any ideas?

    Here's the MSI build output:

    C:\Program Files\hsqlodbc\msi-src>build win32
    Building hsqlodbc merge module v. 1.9.0.3…
    hsqlodbc-mm.wxs
    light -nologo -o ..\dist\hsqlodbc-win32-1.9.0.3.msm hsqlodbc-mm.wixobj
    Building hsqlodbc MSI database v. 1.9.0.3 for the MM…
    hsqlodbc.wxs
    C:\Program Files\hsqlodbc\msi-src\hsqlodbc.wxs(51) : error LGHT0129 : Cannot open the merge module 'msvcr90dll' from file 'C:\Program Files/Common Files/Merge Modules/Microsoft_VC90_CRT_x86.msm'.
    Light execution for MSI failed

     
  • Fred Toussi
    Fred Toussi
    2010-05-18

    We have never used VC++ 2010. Please download the 2008 version, which is still available. It compiles with only some warnings if you follow our compile instructions exactly to the letter.

     
  • James P
    James P
    2010-05-19

    OK, downloaded the 2008 vc++ version.
    Everything compiled and installed without problems.

    Now, I'm new to all this ODBC malarky, so excuse the next question.
    I have a HSQLDB server running.
    Configuring the ODBC driver, I'm stuck as to what exactly I should put in the Database and Server fields.
    For database, I tried the alias defined in HSQLDB,  //localhost/xdb
    For the server, I don't really know…
    The documentation doesn't really say anything, only a snapshot of the DSN screen.

     
  • Blaine Simpson
    Blaine Simpson
    2010-05-19

    Server means host name for a listen address.
    Alias corresponds to server.dbname.n from server.properties.

    The hsqlodbc guide explains the special case of the default dbname.

     
  • James P
    James P
    2010-05-19

    Ok, so / for database and localhost for server, but now socket write errors from the server …

     
  • James P
    James P
    2010-05-20

    Nearly there, but keep getting these errors when I try to connect:
    Any ideas?

    C:\&gt;java -cp "C:/Program Files/hsqldb/lib/hsqldb.jar" org.hsqldb.server.Server -database.0 file:\Users\Peanut\Documents\STS\dev\db\db1 -dbname.0 xdb

    : [Thread]: checkRunning(false) entered
    : [Thread]: checkRunning(false) exited
    : Startup sequence initiated from main() method
    : Loaded properties from
    : Initiating startup sequence…
    : Server socket opened successfully in 19 ms.
    : Database  opened sucessfully in 305 ms.
    : Startup sequence completed in 325 ms.
    : 2010-05-20 23:13:01.633 HSQLDB server 2.0.0 is online on port 9001
    : To close normally, connect and execute SHUTDOWN SQL
    : From command line, use + to abort abruptly
    java.net.SocketException: Connection reset by peer: socket write error
            at java.net.SocketOutputStream.socketWrite0(Native Method)
            at java.net.SocketOutputStream.socketWrite(Unknown Source)
            at java.net.SocketOutputStream.write(Unknown Source)
            at java.io.BufferedOutputStream.write(Unknown Source)
            at java.io.FilterOutputStream.write(Unknown Source)
            at org.hsqldb.server.ServerConnection.handshake(Unknown Source)
            at org.hsqldb.server.ServerConnection.init(Unknown Source)
            at org.hsqldb.server.ServerConnection.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)
    org.hsqldb.HsqlException: Network client is not a HSQLDB JDBC driver
            at org.hsqldb.error.Error.error(Unknown Source)
            at org.hsqldb.error.Error.error(Unknown Source)
            at org.hsqldb.server.ServerConnection.handshake(Unknown Source)
            at org.hsqldb.server.ServerConnection.init(Unknown Source)
            at org.hsqldb.server.ServerConnection.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)

     
  • Blaine Simpson
    Blaine Simpson
    2010-05-21

    The server's not receiving the ODBC startup packet from the client.  I can't think of why that would be, because it worked the last time I ran it on Windows, and I don't think anybody has changed any networking code since then.  I won't have time until the weekend at earliest to re-test this all on Windows.

    There is one thing you can try, which will work if the problem is a client or connection lag of some sort.  In your server distribution, edit src/org/hsqldb/server/ServerConnection and raise the value of MAX_WAIT_FOR_CLIENT_DATA from 1000 (ms.) to 30000 or so, and rebuild hsqldb.jar.

    IIRC, the Windows ODBC utility allows you to ping defined data sources, thereby eliminating the client from the equation.  This wouldn't fix your program of course, but could help to narrow the part where the problem lies.

     
  • Imperatorn
    Imperatorn
    2011-12-07

    Hello!

    Is there any lonely soul out there who has been successfull in compiling the odbc-driver for windows?

    I have tried, but my time is very limited. I was able to get the unicode dll-version but could not build the msi.

    So, is there anyone in the history of mankind who has ever succeeded in building this?

    Best regards,
    Johan

     
  • Imperatorn
    Imperatorn
    2011-12-07

    fredt:

    Ok, thanks!

    I will follow the instructions. Guess I just have to take the time to do it the proper way.

    Thanks for answering so fast btw! :)