com.mongodb.jdbc.MongoSQLConnection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongodb-jdbc Show documentation
Show all versions of mongodb-jdbc Show documentation
JDBC Driver for MongoDB Atlas SQL interface
package com.mongodb.jdbc;
import com.mongodb.ConnectionString;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public class MongoSQLConnection extends MongoConnection implements Connection {
public MongoSQLConnection(ConnectionString cs, String database) {
super(cs, database);
}
@Override
public Statement createStatement() throws SQLException {
checkConnection();
try {
return new MongoSQLStatement(this, currentDB);
} catch (IllegalArgumentException e) {
throw new SQLException(e);
}
}
@Override
public PreparedStatement prepareStatement(String sql) throws SQLException {
try {
return new MongoPreparedStatement(sql, new MongoSQLStatement(this, currentDB));
} catch (IllegalArgumentException e) {
throw new SQLException(e);
}
}
@Override
public DatabaseMetaData getMetaData() throws SQLException {
return new MongoSQLDatabaseMetaData(this);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy