# aios

> Socket client for Aios server

Latest version **1.0.1** (published 2020-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install aios
pnpm add aios
yarn add aios
bun add aios
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-08-05 |
| First published | 2015-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 115.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Robert Kania |
| Maintainers | cezaryrk |
| Keywords | jdbc, driver, aios, database, datasources |

## Links

- npm: https://www.npmjs.com/package/aios
- Repository: https://github.com/thinkbaer/node-aios
- Issues: https://github.com/thinkbaer/node-aios/issues
- npm.io page: https://npm.io/package/aios

## Dependencies (2)

- [bson](https://npm.io/package/bson.md) ^4.0.4
- [lodash](https://npm.io/package/lodash.md) ^4.17.19

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-08-05
- 1.0.0 — 2020-06-22
- 0.3.0 — 2020-01-15
- 0.2.3 — 2019-02-13
- 0.2.2 — 2019-02-13
- 0.2.1 — 2019-02-12
- 0.2.0 — 2018-09-13
- 0.1.8 — 2018-09-06
- 0.1.7 — 2018-08-29
- 0.1.6 — 2018-08-28
- 0.1.5 — 2016-02-03
- 0.1.4 — 2016-02-03
- 0.1.3 — 2015-07-15
- 0.1.2 — 2015-07-11

## README

# Socket client for aios server

The aios server is an in java implemeted lightweight server were currently different jdbc datasources can be registered and are accessible throw a socket connection. The exchanged messages an bson en-/decoded.

__To use this package you need an aios server up and running.__

Sources and documentation for the aios server can be found on [https://github.com/thinkbaer/aios](https://github.com/thinkbaer/aios).

__This is an experimantal implementation under active development don't use it on production systems!__



Per default the aios server listens for socket connection on 
 * host: localhost
 * port: 8118

## Usage

### Synchronized (with sockit-to-me)




__Setup the server connection__
```js
var AiosServer = require('aios');

/**
 * Default implementation
 */
var server = new AiosServer({host:'localhost',port:8118});

// Sends the current timestamp and receives server time and duration
var response = server.ping();
/*
resonpse = {
	time: DateObject
	duration: long
}
*/
```

__Register a JDBC datasource on aios server__
```js
// name for the datasource configuration
var dsn = 'hsql_test'

// necassary specification for datasource
var dsSpec = {
	type: 'jdbc',
	driver: 'org.hsqldb.jdbc.JDBCDriver',
	// if the driverLocation is remote then the driver will be downloaded by the server
	// a local driver path will be directly used 
	driverLocation: "http://central.maven.org/maven2/org/hsqldb/hsqldb/2.3.3/hsqldb-2.3.3.jar",
	url: "jdbc:hsqldb:file:/tmp/test_server/hsql_test",
	user: 'SA',
	password: ''
}

// register the datasource on aios server (needed only once)
var dataSource = server.dataSource(dsn, dsSpec);

// if the datasource is already registered, you can access the dataSource Object through
var sameDataSource = server.dataSource(dsn);
```

__Query the registered datasource__

```js
var createDBSchema =[
    'CREATE TABLE  IF NOT EXISTS car ( id INTEGER IDENTITY, type VARCHAR(256), name VARCHAR(256))'
    "INSERT INTO car (type, name) VALUES('Ford', 'Mustang')",
    "INSERT INTO car (type, name) VALUES('Volkswagen', 'Golf')"
]

// like JDBC executeBatch 
// http://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#executeBatch--
var results = ds.executeBatch(createDBSchema);

// like JDBC execute
// http://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#execute--
results = ds.execute("INSERT INTO car (type, name) VALUES('Volvo', 'V70')");

// like JDBC executeUpdate
// http://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#executeUpdate--
results = ds.update("INSERT INTO car (type, name) VALUES('Volvo', 'V70')");

// like JDBC executeQuery
// http://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#executeQuery--
results = ds.query("SELECT * FROM car");
// returns an array with query results


```




### Asynchron (with net.Socket)

__Currently not implemented, coming soon ...__

```js
// TODO
```


## Links

__aios server__
 * [github](https://github.com/thinkbaer/aios)
 * [issues](https://github.com/thinkbaer/aios/issues)
 * [wiki](https://github.com/thinkbaer/aios/wiki)

__nodejs aios client__
 * [github](https://github.com/thinkbaer/node-aios)
 * [issues](https://github.com/thinkbaer/node-aios/issues)
 * [wiki](https://github.com/thinkbaer/node-aios/wiki)


----


## Work in progress ...

* Error Handling
* Connection pooling
* Asynchon implementation
* Performance optimization
* Benchmarks

---
_Source: https://npm.io/package/aios · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
