@@ -37,7 +37,7 @@ var Jdbc = require('informix-wrapper');
3737var req = require ( 'request' ) ;
3838var helper ;
3939
40- var javaReadBridge = process . env . JAVA_READ_BRIDGE || "http://localhost:5555 /bridge" ;
40+ var javaReadBridge = process . env . JAVA_READ_BRIDGE || "http://localhost:8082 /bridge" ;
4141
4242/**
4343 * Regex for sql paramters e.g @param_name@
@@ -117,24 +117,36 @@ function executePreparedStatement(api, sql, parameters, connection, next, db) {
117117 async . waterfall ( [
118118 function ( cb ) {
119119 parameterizeQuery ( sql , parameters , cb ) ;
120- } , function ( parametrizedQuery , cb ) {
120+ } ,
121+ function ( parametrizedQuery , cb ) {
121122 sql = parametrizedQuery ;
122123
123124 if ( api . helper . readTransaction ) {
124- api . log ( "CALLING SANTTOSH'S MAGIC" ) ;
125+ api . log ( "Calling Java Bridge" , "debug" ) ;
126+
127+ api . log ( sql , "debug" ) ;
125128
126129 var body = {
127130 "sql" : new Buffer ( sql ) . toString ( 'base64' ) ,
128131 "db" : db
129132 } ;
130133
131- api . log ( body ) ;
134+ api . log ( JSON . stringify ( body ) , "debug" ) ;
132135
133- req ( { url : javaReadBridge , body : body , json : true } , function ( response ) {
134- api . log ( response ) ;
136+ req ( { url : javaReadBridge , method : "POST" , body : body , json : true } , function ( error , response , body ) {
137+ if ( error ) {
138+ api . log ( error , "error" ) ;
139+ cb ( error ) ;
140+ }
141+
142+ if ( response . statusCode != 200 ) {
143+ api . log ( response , "error" ) ;
144+ cb ( response . statusMessage ) ;
145+ }
146+
147+ api . log ( "Response:" + JSON . stringify ( body ) , "debug" ) ;
148+ cb ( null , body . results ) ;
135149 } ) ;
136-
137- cb ( null , [ ] ) ;
138150 } else {
139151 api . log ( "Database connected" , 'debug' ) ;
140152 // the connection might have been closed due to other errors, so this check must be done
0 commit comments