firstworks Using SQL Relay on Windows

Using SQL Relay on Windows

- Introduction
- Building SQL Relay
- Running the SQL Relay Server
- Using the Command Line Interfaces

Introduction

SQL Relay is not production-ready for Windows. You have to build it from source, many databases and languages are unsupported and I haven't done any performance benchmarking yet. But, that said, you can run a database, SQL Relay server and certain SQL Relay clients, entirely on Windows. So, if you're interested in tinkering with SQL Relay on Windows, you can.

Building SQL Relay

SQL Relay requires Cygwin to build and run, so the first step in building SQL Relay is to download and install Cygwin.

I recommend doing a complete Cygwin installation to make sure you have all of the components necessary to build and run SQL Relay.

Now, download, compile and install whatever languages or databases you need SQL Relay to support. Many languages and a few databases come with Cygwin. Others have to be compiled from source and installed in the Cygwin environment. Currently, SQL Relay cannot be compiled against non-Cygwin dll's, the resulting binaries don't work, so you can't for instance, build against Oracle or Sybase, or download the native Windows version of MySQL and build against it.

Now, download SQL Relay and follow the standard instructions for building and installing it. Use the Cygwin shell rather than the Windows Command Line or DOS shell to build and install SQL Relay.

Running the SQL Relay Server

SQL Relay makes extensive use of shared memory and semaphores. The Cygwin IPC server simulates these facilities on Windows. Install the server as a service and start it up following the instructions here.

After installing the Cygwin IPC server, you need to add a CYGWIN environment variable. Use the System control panel to add an environment variable called CYGWIN with the value server.

Once the IPC server is running, start up the database and follow the standard instructions for running SQL Relay. Note that you will have to use handoff="reconnect" rather than handoff="pass" in the sqlrelay.conf file. handoff="pass" is currently unsupported on Windows. Also, make sure to execute the instructions from within a Cygwin shell rather than from the Windows Command Line or DOS shell.

NOTE: Do not ssh into your windows machine and run from SQL Relay from that shell. When logging in over ssh, the CYGWIN environment variable get's overridden and doesn't contain server, preventing SQL Relay from using the Cygwin IPC server.

Currently, there is no facility for installing SQL Relay as a service, so it must be started and stopped manually from a Cygwin shell.

Using the Command Line Interfaces

Once the SQL Relay server is running, you can access it from the SQL Relay command line interfaces. Follow the standard instructions for running the command line interfaces. Again, you should use the Cygwin shell rather than the Windows Command Line or DOS shell when running the SQL Relay command line interfaces.