本文整理了Java中org.mybatis.generator.config.JDBCConnectionConfiguration
类的一些代码示例,展示了JDBCConnectionConfiguration
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDBCConnectionConfiguration
类的具体详情如下:
包路径:org.mybatis.generator.config.JDBCConnectionConfiguration
类名称:JDBCConnectionConfiguration
暂无
代码示例来源:origin: roncoo/roncoo-mybatis-generator
private void parseJdbcConnection(Context context, Node node) {
JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration();
context.setJdbcConnectionConfiguration(jdbcConnectionConfiguration);
Properties attributes = parseAttributes(node);
String driverClass = attributes.getProperty("driverClass"); //$NON-NLS-1$
String connectionURL = attributes.getProperty("connectionURL"); //$NON-NLS-1$
String userId = attributes.getProperty("userId"); //$NON-NLS-1$
String password = attributes.getProperty("password"); //$NON-NLS-1$
jdbcConnectionConfiguration.setDriverClass(driverClass);
jdbcConnectionConfiguration.setConnectionURL(connectionURL);
if (stringHasValue(userId)) {
jdbcConnectionConfiguration.setUserId(userId);
}
if (stringHasValue(password)) {
jdbcConnectionConfiguration.setPassword(password);
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(jdbcConnectionConfiguration, childNode);
}
}
}
代码示例来源:origin: org.mybatis.generator/mybatis-generator-core
/**
* This constructor is called when there is a JDBCConnectionConfiguration
* specified in the configuration.
*
* @param config the configuration
*/
public JDBCConnectionFactory(JDBCConnectionConfiguration config) {
super();
userId = config.getUserId();
password = config.getPassword();
connectionURL = config.getConnectionURL();
driverClass = config.getDriverClass();
otherProperties = config.getProperties();
}
代码示例来源:origin: lishuo9527/MybatisGenerator-UI
jdbcConnectionConfiguration.setConnectionURL(connection);
jdbcConnectionConfiguration.setUserId(userName);
jdbcConnectionConfiguration.setPassword(password);
代码示例来源:origin: cxjava/mybatis-generator-core
private Driver getDriver(JDBCConnectionConfiguration connectionInformation) {
String driverClass = connectionInformation.getDriverClass();
Driver driver;
try {
Class<?> clazz = ObjectFactory.externalClassForName(driverClass);
driver = (Driver) clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException(getString("RuntimeError.8"), e); //$NON-NLS-1$
}
return driver;
}
}
代码示例来源:origin: org.mybatis.generator/mybatis-generator-core
public XmlElement toXmlElement() {
XmlElement xmlElement = new XmlElement("jdbcConnection"); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("driverClass", driverClass)); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("connectionURL", connectionURL)); //$NON-NLS-1$
if (stringHasValue(userId)) {
xmlElement.addAttribute(new Attribute("userId", userId)); //$NON-NLS-1$
}
if (stringHasValue(password)) {
xmlElement.addAttribute(new Attribute("password", password)); //$NON-NLS-1$
}
addPropertyXmlElements(xmlElement);
return xmlElement;
}
代码示例来源:origin: roncoo/roncoo-mybatis-generator
private Driver getDriver(JDBCConnectionConfiguration connectionInformation) {
String driverClass = connectionInformation.getDriverClass();
Driver driver;
try {
Class<?> clazz = ObjectFactory.externalClassForName(driverClass);
driver = (Driver) clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException(getString("RuntimeError.8"), e); //$NON-NLS-1$
}
return driver;
}
}
代码示例来源:origin: roncoo/roncoo-mybatis-generator
public XmlElement toXmlElement() {
XmlElement xmlElement = new XmlElement("jdbcConnection"); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("driverClass", driverClass)); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("connectionURL", connectionURL)); //$NON-NLS-1$
if (stringHasValue(userId)) {
xmlElement.addAttribute(new Attribute("userId", userId)); //$NON-NLS-1$
}
if (stringHasValue(password)) {
xmlElement.addAttribute(new Attribute("password", password)); //$NON-NLS-1$
}
addPropertyXmlElements(xmlElement);
return xmlElement;
}
代码示例来源:origin: cxjava/mybatis-generator-core
private void parseJdbcConnection(Context context, Node node) {
JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration();
context.setJdbcConnectionConfiguration(jdbcConnectionConfiguration);
Properties attributes = parseAttributes(node);
String driverClass = attributes.getProperty("driverClass"); //$NON-NLS-1$
String connectionURL = attributes.getProperty("connectionURL"); //$NON-NLS-1$
String userId = attributes.getProperty("userId"); //$NON-NLS-1$
String password = attributes.getProperty("password"); //$NON-NLS-1$
jdbcConnectionConfiguration.setDriverClass(driverClass);
jdbcConnectionConfiguration.setConnectionURL(connectionURL);
if (stringHasValue(userId)) {
jdbcConnectionConfiguration.setUserId(userId);
}
if (stringHasValue(password)) {
jdbcConnectionConfiguration.setPassword(password);
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(jdbcConnectionConfiguration, childNode);
}
}
}
代码示例来源:origin: roncoo/roncoo-mybatis-generator
public Connection getConnection(JDBCConnectionConfiguration config)
throws SQLException {
Driver driver = getDriver(config);
Properties props = new Properties();
if (stringHasValue(config.getUserId())) {
props.setProperty("user", config.getUserId()); //$NON-NLS-1$
}
if (stringHasValue(config.getPassword())) {
props.setProperty("password", config.getPassword()); //$NON-NLS-1$
}
props.putAll(config.getProperties());
Connection conn = driver.connect(config.getConnectionURL(), props);
if (conn == null) {
throw new SQLException(getString("RuntimeError.7")); //$NON-NLS-1$
}
return conn;
}
代码示例来源:origin: handosme/mybatis-generator-plus
private Driver getDriver(JDBCConnectionConfiguration connectionInformation) {
String driverClass = connectionInformation.getDriverClass();
Driver driver;
try {
Class<?> clazz = ObjectFactory.externalClassForName(driverClass);
driver = (Driver) clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException(getString("RuntimeError.8"), e); //$NON-NLS-1$
}
return driver;
}
}
代码示例来源:origin: handosme/mybatis-generator-plus
public XmlElement toXmlElement() {
XmlElement xmlElement = new XmlElement("jdbcConnection"); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("driverClass", driverClass)); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("connectionURL", connectionURL)); //$NON-NLS-1$
if (stringHasValue(userId)) {
xmlElement.addAttribute(new Attribute("userId", userId)); //$NON-NLS-1$
}
if (stringHasValue(password)) {
xmlElement.addAttribute(new Attribute("password", password)); //$NON-NLS-1$
}
addPropertyXmlElements(xmlElement);
return xmlElement;
}
代码示例来源:origin: org.mybatis.generator/mybatis-generator-core
protected void parseJdbcConnection(Context context, Node node) {
JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration();
context.setJdbcConnectionConfiguration(jdbcConnectionConfiguration);
Properties attributes = parseAttributes(node);
String driverClass = attributes.getProperty("driverClass"); //$NON-NLS-1$
String connectionURL = attributes.getProperty("connectionURL"); //$NON-NLS-1$
jdbcConnectionConfiguration.setDriverClass(driverClass);
jdbcConnectionConfiguration.setConnectionURL(connectionURL);
String userId = attributes.getProperty("userId"); //$NON-NLS-1$
if (stringHasValue(userId)) {
jdbcConnectionConfiguration.setUserId(userId);
}
String password = attributes.getProperty("password"); //$NON-NLS-1$
if (stringHasValue(password)) {
jdbcConnectionConfiguration.setPassword(password);
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(jdbcConnectionConfiguration, childNode);
}
}
}
代码示例来源:origin: cxjava/mybatis-generator-core
public Connection getConnection(JDBCConnectionConfiguration config) throws SQLException {
Driver driver = getDriver(config);
Properties props = new Properties();
if (stringHasValue(config.getUserId())) {
props.setProperty("user", config.getUserId()); //$NON-NLS-1$
}
if (stringHasValue(config.getPassword())) {
props.setProperty("password", config.getPassword()); //$NON-NLS-1$
}
if (stringHasValue(config.getRemarksReporting())) {
props.setProperty("remarksReporting", config.getRemarksReporting()); //$NON-NLS-1$
} else {
props.setProperty("remarksReporting", "true"); //$NON-NLS-1$
}
props.putAll(config.getProperties());
Connection conn = driver.connect(config.getConnectionURL(), props);
if (conn == null) {
throw new SQLException(getString("RuntimeError.7")); //$NON-NLS-1$
}
return conn;
}
代码示例来源:origin: cxjava/mybatis-generator-core
@Override
public boolean validate(List<String> warnings) {
databaseType = context.getJdbcConnectionConfiguration().getDriverClass();
String criterias = context.getJavaModelGeneratorConfiguration().getTargetPackage() + ".Criteria";
criteria = new FullyQualifiedJavaType(criterias);
if (stringHasValue(properties.getProperty("isAllInOne"))) { //$NON-NLS-1$
isAllInOne = StringUtility.isTrue(properties.getProperty("isAllInOne"));
} else {
isAllInOne = false;
}
return true;
}
代码示例来源:origin: cxjava/mybatis-generator-core
public XmlElement toXmlElement() {
XmlElement xmlElement = new XmlElement("jdbcConnection"); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("driverClass", driverClass)); //$NON-NLS-1$
xmlElement.addAttribute(new Attribute("connectionURL", connectionURL)); //$NON-NLS-1$
if (stringHasValue(userId)) {
xmlElement.addAttribute(new Attribute("userId", userId)); //$NON-NLS-1$
}
if (stringHasValue(password)) {
xmlElement.addAttribute(new Attribute("password", password)); //$NON-NLS-1$
}
addPropertyXmlElements(xmlElement);
return xmlElement;
}
代码示例来源:origin: roncoo/roncoo-mybatis-generator
private void parseJdbcConnection(Context context, Node node) {
JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration();
context.setJdbcConnectionConfiguration(jdbcConnectionConfiguration);
Properties attributes = parseAttributes(node);
String driverClass = attributes.getProperty("driverClass"); //$NON-NLS-1$
String connectionURL = attributes.getProperty("connectionURL"); //$NON-NLS-1$
String userId = attributes.getProperty("userId"); //$NON-NLS-1$
String password = attributes.getProperty("password"); //$NON-NLS-1$
jdbcConnectionConfiguration.setDriverClass(driverClass);
jdbcConnectionConfiguration.setConnectionURL(connectionURL);
if (stringHasValue(userId)) {
jdbcConnectionConfiguration.setUserId(userId);
}
if (stringHasValue(password)) {
jdbcConnectionConfiguration.setPassword(password);
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(jdbcConnectionConfiguration, childNode);
}
}
}
代码示例来源:origin: handosme/mybatis-generator-plus
public Connection getConnection(JDBCConnectionConfiguration config)
throws SQLException {
Driver driver = getDriver(config);
Properties props = new Properties();
if (stringHasValue(config.getUserId())) {
props.setProperty("user", config.getUserId()); //$NON-NLS-1$
}
if (stringHasValue(config.getPassword())) {
props.setProperty("password", config.getPassword()); //$NON-NLS-1$
}
props.putAll(config.getProperties());
Connection conn = driver.connect(config.getConnectionURL(), props);
if (conn == null) {
throw new SQLException(getString("RuntimeError.7")); //$NON-NLS-1$
}
return conn;
}
代码示例来源:origin: cxjava/mybatis-generator-core
@Override
public boolean validate(List<String> warnings) {
databaseType = context.getJdbcConnectionConfiguration().getDriverClass();
String criterias = context.getJavaModelGeneratorConfiguration().getTargetPackage() + ".Criteria";
criteria = new FullyQualifiedJavaType(criterias);
if (stringHasValue(properties.getProperty("isAllInOne"))) { //$NON-NLS-1$
isAllInOne = StringUtility.isTrue(properties.getProperty("isAllInOne"));
} else {
isAllInOne = false;
}
return true;
}
代码示例来源:origin: handosme/mybatis-generator-plus
private void parseJdbcConnection(Context context, Node node) {
JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration();
context.setJdbcConnectionConfiguration(jdbcConnectionConfiguration);
Properties attributes = parseAttributes(node);
String driverClass = attributes.getProperty("driverClass"); //$NON-NLS-1$
String connectionURL = attributes.getProperty("connectionURL"); //$NON-NLS-1$
String userId = attributes.getProperty("userId"); //$NON-NLS-1$
String password = attributes.getProperty("password"); //$NON-NLS-1$
jdbcConnectionConfiguration.setDriverClass(driverClass);
jdbcConnectionConfiguration.setConnectionURL(connectionURL);
if (stringHasValue(userId)) {
jdbcConnectionConfiguration.setUserId(userId);
}
if (stringHasValue(password)) {
jdbcConnectionConfiguration.setPassword(password);
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(jdbcConnectionConfiguration, childNode);
}
}
}
代码示例来源:origin: cxjava/mybatis-generator-core
@Override
public boolean validate(List<String> warnings) {
databaseType = context.getJdbcConnectionConfiguration().getDriverClass();
String criterias = context.getJavaModelGeneratorConfiguration().getTargetPackage() + ".Criteria";
criteria = new FullyQualifiedJavaType(criterias);
return true;
}
内容来源于网络,如有侵权,请联系作者删除!