All Projects → wise-coders → mongodb-jdbc-driver

wise-coders / mongodb-jdbc-driver

Licence: other
MongoDB JDBC Driver | DbSchema MongoDB Designer

Programming Languages

java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mongodb-jdbc-driver

Hive Jdbc Uber Jar
Hive JDBC "uber" or "standalone" jar based on the latest Apache Hive version
Stars: ✭ 188 (+300%)
Mutual labels:  jdbc, driver
ksql-jdbc-driver
JDBC driver for Apache Kafka
Stars: ✭ 85 (+80.85%)
Mutual labels:  jdbc, driver
neo4j-jdbc
JDBC driver for Neo4j
Stars: ✭ 110 (+134.04%)
Mutual labels:  jdbc, driver
MPU-9250-Sensors-Data-Collect
MPU9250 (MPU6500 + AK8963) I2C Driver in Python for Raspbery PI
Stars: ✭ 51 (+8.51%)
Mutual labels:  driver
AQtion
Aquantia AQC multigigabit NIC linux driver (atlantic) - development preview
Stars: ✭ 60 (+27.66%)
Mutual labels:  driver
hobo vr
SteamVR driver prototyping tool
Stars: ✭ 44 (-6.38%)
Mutual labels:  driver
babashka-sql-pods
Babashka pods for SQL databases
Stars: ✭ 64 (+36.17%)
Mutual labels:  jdbc
ThinkJD
ThinkJD,又名ThinkJDBC,一个简洁而强大的开源JDBC操作库。你可以使用Java像ThinkPHP框架的M方法一样,一行代码搞定数据库操作。ThinkJD, also known as ThinkJDBC, an easy and powerful open source JDBC library. You can operate the database with one line of Java code,just like the M method of ThinkPHP framework.
Stars: ✭ 24 (-48.94%)
Mutual labels:  jdbc
vmwmouse
VMware mouse driver for Windows 3.1
Stars: ✭ 315 (+570.21%)
Mutual labels:  driver
nifi-sqllookup-services-bundle
NIFI controllers for SQL record and attributes lookups with built-in caching
Stars: ✭ 18 (-61.7%)
Mutual labels:  jdbc
GoogleDriveBrowser
Goole Drive Download Library for iOS
Stars: ✭ 13 (-72.34%)
Mutual labels:  driver
sqlite3
The fastest and correct module for SQLite3 in Deno.
Stars: ✭ 143 (+204.26%)
Mutual labels:  driver
HadesVR
The "DIY" SteamVR compatible VR setup made for tinkerers.
Stars: ✭ 88 (+87.23%)
Mutual labels:  driver
FIFO-Driver
Character device driver working as FIFO pipe, created with a Linux Kernel module (SMP-Safe). Works on Android's kernel.
Stars: ✭ 12 (-74.47%)
Mutual labels:  driver
hid-fanatecff
Driver to support ForceFeedback of the FANATEC CSL Elite Wheel Base
Stars: ✭ 81 (+72.34%)
Mutual labels:  driver
swGL
A multithreaded software implementation of OpenGL 1.3 in C++.
Stars: ✭ 50 (+6.38%)
Mutual labels:  driver
thpimon
Native ESXi on Arm hardware status driver for the Raspberry Pi.
Stars: ✭ 32 (-31.91%)
Mutual labels:  driver
-LibraryOS-Exokernel Implementation
Exokernel is one of the major sources for container and library OS techniques.
Stars: ✭ 41 (-12.77%)
Mutual labels:  driver
rtw88-usb
rtw88 family usb driver for linux rtl8723du rtl8822bu rtl8821cu rtl8822cu
Stars: ✭ 40 (-14.89%)
Mutual labels:  driver
golang-migrate-extra
golang-migrate extra drivers for io/fs
Stars: ✭ 13 (-72.34%)
Mutual labels:  driver

MongoDb JDBC Driver | DbSchema MongoDB Designer

The driver is provided by DbSchema - MongoDb Diagram Designer for everybody who needs an MongoDb JDBC driver.

Driver Features

  • JDBC driver capable to execute native MongoDb queries, similar with Mongo Shell.

  • The driver is using the native MongoDb Java driver to connect and execute queries. Therefore, the JDBC URL is the same as MongoDb URL.

  • The driver returns by default a ResultSet with a single Object. Use resultSet.getObject(1) to get this object. Adding the parameter expand=true in the URL will create a column in the result set for each key in the result document. If expand is set the driver will read ahead a number of rows in order to create a correct ResultSetMetaData. This is transparent for the user. This because the first document in the result may have less keys as the next records.

  • To be able to execute native MongoDb queries we embedded an Rhino JavaScript engine inside the driver. Each time you execute a query we parse and run it as JavaScript with Rhino.

  • Calling methods from the DatabaseMetaData.getTables(), getColumns(), etc., the driver will deduce a logical structure of the database. We presume that collections are storing similar documents, so we 'deduce' a virtual schema by scanning random documents from each collection. The number of scanned documents can be set in the URL using the parameter scan=<fast|medium|full>.

  • The collection fields can be sorted by adding sort=true in the URL.

License

GPL-3 dual license. The driver is free to use by everyone. Code modifications allowed only to the current repository as pull requests https://github.com/wise-coders/mongodb-jdbc-driver

Download JDBC Driver Binary Distribution

Download the driver from the DbSchema website. Unpack and include all jars in your classpath. The driver is compatible with Java 11.

Driver URL

jdbc:mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[database][?options]]

The driver is using the same URL, options and parameters as native MongoDb Java driver. Different is only the 'jdbc:' prefix.

How to Use the Driver

The driver can be use similar with any other JDBC driver. The resultSet will always receive a single object as document.

#!java

import java.sql.Connection;
import java.sql.PreparedStatement;

...

Class.forName("MongoJdbcDriver");
Properties properties = new Properties();
properties.put("user", "someuser");
properties.put("password", "somepassword" );
Connection con = DriverManager.getConnection("jdbc:mongodb://host1:9160/keyspace1", properties);
// OTHER URL (SAME AS FOR MONGODB NATIVE DRIVER): mongodb://db1.example.net,db2.example.net:2500/?replicaSet=test&connectTimeoutMS=300000
String query = "db.sampleCollection().find()";
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery( query );
Object json = rs.getObject(1);

Any contributions to this project are welcome. We are looking forward to improve this and make possible to execute all MongoDb native queries via JDBC.

How it Works

The driver implements a PreparedStatement where native MongoDb queries can be passed. Sample: db.myCollection.find(). In the MongoPreparedStatement we start a Rhino JavaScript engine, and pass this query to the engine. The engine receives also an object 'db':new WrappedMongoDatabase().

The WrappedMongoDatabase is a wrapper around the native MongoDatabase object, with support for Collections as native member variables. This make possible to do ´db.myCollection´ - otherwise it would work only db.getCollection('myCollection')

The collection objects are wrapped as well into WrappedMongoCollection. The reason for this is that most of the methods require Bson objects, and JavaScript will generate only Map objects.

For example db.myCollection.find({'age':12}) will result in a call of db.myCollection.find(Bson bson) with a Map instead of Bson, which will throw an error. We tried various solutions for avoiding this, including java Proxy. If you know any better solution please let us know, we can improve the project. Writing the Wrapper class we added methods which receive Map objects and we take care of the conversion.

In test cases we try to add all possible queries we want to support. If you find any query which does not work please feel free to commit in the source code or write us.

Contributors

Please help us to improve this driver by adding fixes and create merge requests to this repository.

How to Test the Driver

The driver can be tested by simply downloading the DbSchema - MongoDB Diagram Designer. The tool can be tested free for 15 days.

DbSchema reads sample JSon documents from the database and deduces a 'logical schema' which is shown as diagrams. Deducing means we consider that each collection documents have similar structure, so we read a bunch of documents from each collection and deduce the schema.

MongoDb Designer with Diagrams of the Database Structure

Connecting to MongoDb is simple. You can choose different methods to connect, the host, port, etc. The driver is downnloaded automatically by DbSchema from dbschema.com webserver.

DbSchema Connection Dialog to MongoDB

The JDBC URL is the same as the native MongoDb Java driver. This can be customized in the second tab.

DbSchema connect using JDBC URL

DbSchema is featuring tools for writing MongoDb queries, in the same way as in the MongoDb Shell:

Visual Query Editor for MongoDB

DbSchema can create virtual foreign keys which will be saved to project file. This are useful in Relational Data Browse, for easy exploring data from multiple tables.

Virtual Foreign keys for MongoDB

Relational Data Browse is a tool for visually exploring the database data.

MongoDB Data Explorer adn Editor

A full description of DbSchema features is available on DbSchema MongoDB Designer Website. DbSchema can be downloaded and tested for free for 15 days.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].