Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.carlostse:mongo-jdbc:v1.1.1'
}
dependencies {
implementation("com.github.carlostse:mongo-jdbc:v1.1.1")
}
<dependency>
<groupId>com.github.carlostse</groupId>
<artifactId>mongo-jdbc</artifactId>
<version>v1.1.1</version>
</dependency>
libraryDependencies += "com.github.carlostse" % "mongo-jdbc" % "v1.1.1"
:dependencies [[com.github.carlostse/mongo-jdbc "v1.1.1"]]
JDBC driver for MongoDB. A wrapper translates SQL to official MongoDB Java API calls.
This is a fork of http://github.com/erh/mongo-jdbc, and merged some changes from:
EXPERIMENTAL
This project targets to support some simple SQL only, and has no plans to support join tables.
A traditional JDBC application needs to read data stored in MongoDB. Instead of maintaining two copies of data, a JDBC driver has been made. The JDBC application can use the traditional SQL to access the MongoDB without modifications.
JDBC Connection
Query Types
pom.xml
in IntelliJ IDEAHelloWorld
and select Run HelloWorld.main()This project targets to support Java 8. Some additional JDBC functions were added since Java 7, thus which may cause errors where compiling using Java 6 or below, and it is not supported in this project.
If you have MongoDB running on localhost
$ mvn package
If you have MongoDB running on remote machine
$ mvn package -Dmongodb=<MongoDB Hostname or IP address(:port)>
If you do have any MongoDB or want to skip the tests
$ mvn package -Dmaven.test.skip=true
You need to add the following dependency JARs in classpath
mongo-java-driver-<version>.jar
jsqlparser-<version>.jar
Or, you can package all dependencies in one single JAR file
$ mvn assembly:single
Apache License, Version 2.0