Rebol > NetRexx


Table of contents
  1. 1. Instructions

I am going to learn a little NetRexx so that I can bridge to databases on Linux which have JDBC support, but no native REBOL support.

JdbcFirebirdQry.nrx - script to connect to Firebird using Jdbc

JDBC-bridge.nrx - multi-threaded tcp server that executes SQL on the database via a JDBC connection


Make sure that your database driver is in your classpath.  If it is not, then you will have to set it with the -cp when you invoke java.  Download the two class files ( ServerThread.class and SrvSockTDB.class ).

The following example uses Firebird. Note that since \ is the escape character we have to use \\ for windows paths.

java -cp c:\firebird\jaybird-full-2.1.6.jar 
 SrvSockTDB 80 jdbc:firebirdsql:localhost/3050:c:\\emr\\remr.fdb sysdba masterke

This invokes the server on port 80, and uses the userid of SYSDBA and password of masterke

If you are connecting to DB2, Oracle, Mysql, Sql Server, Postgresql, or Sybase, then it should detect the right database, and load the appropriate driver.  However, this is untested.

With luck you'll see something like this

Protocol: jdbc
Driver/DB: firebirdsql
UserPrefix: localhost/3050:c:\\emr\\remr.fdb
DB: localhost/3050:c:\\emr\\remr.fdb
URL:  jdbc:firebirdsql:localhost/3050:c:\\emr\\remr.fdb
Userid: SYSDBA
Password: masterke
Loading firebirdsql driver classes...
Connecting to: jdbc:firebirdsql:localhost/3050:c:\\emr\\remr.fdb
Server: ServerSocket[addr=,port=0,localport=80] 

 and the server is now ready waiting for connections.

Now, open a Rebol console, and connect.  You should get back a single molded Rebol series which you load to convert back to Rebol values.


p: open/lines tcp://localhost:80
insert p {select * from staff}
result: copy p
data: load result/1


If you want to query the DB again, you need to open/lines again as the server closes the connection after each query. 

New version allows the thread to remain alive to accept new queries. 


Retrieved from ""

Tag page
You must login to post a comment. portal where you can upload your ideas and interests and educational mind set for a free website account please apply here