title: node js and hbase
body: <p>I am trying to connect to hbase via. nodejs hbase module.
  I have used </p>
  
  <ul>
  <li><a href="https://github.com/wdavidw/node-hbase" rel="nofollow">https://github.com/wdavidw/node-hbase</a></li>
  </ul>
  
  <p>to download hbase module for nodejs and trying to run the below code in my nodejs script which uses express and handles the incoming request :- 
  .......</p>
  
  <pre><code>app.post('/upload', function(req, res,next){
       var read_stream = fs.createReadStream(req.files.upload_file.path, {encoding: 'base64'});
                read_stream.on("data", function(data){
                 // process.stdout.write(data);
                  dataload(data);
                });
                read_stream.on("error", function(err){
                  console.error("An error occurred: %s", err)
                });
                read_stream.on("close", function(){
                  console.log("File closed.")
              });
  
  
  }
  
  function dataload(data){
   var hbase = require('hbase');
  
  
   var tableobj=hbase({ host: "{my server ip}", port: "8080" }).getTable('my_table1');
                 sys.debug(tableobj);
  
  
                  tableobj.create("my_column_family", function(err, success){
                      if(err)
                      {
                          sys.debug("error1");
                      }
                      else
                      {
  
                          this.getRow('my_row')
                          .put('my_column_family:my_column', data, function(err, success){
                              if(err)
                              {
                              sys.debug("error");
                              }
                              else
                              {
                              sys.debug("success");
                              }
  
  
                              });
  
                      }
  
                      });
  }
  </code></pre>
  
  <p>Problem faced :- when i restart the server[i.e the server created by this script by again giving "node {script js file name}" on cygwin command prompt] , then the hbase table is re-created and all the rows previously inserted are removed.</p>