<commit_before>/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */

package io.shardingsphere.example.proxy.main;

import io.shardingsphere.example.proxy.repository.XaRawJdbcRepository;
import org.apache.commons.dbcp.BasicDataSource;

import javax.sql.DataSource;
import java.sql.SQLException;

/*
 * 1. Modify proxy.transaction.enabled: `false` to `true` to enable XA transaction on file resources/config.yaml.
 * 2. Copy resources/config.yaml to sharding-proxy conf folder and overwrite original file.
 * 3. Please make sure sharding-proxy is running before you run this example.
 */
public class ProxyXaMain {
    private static final String PROXY_IP = "localhost";
    
    private static final int PROXY_PORT = 3307;
    
    public static void main(String[] args) throws SQLException {
        XaRawJdbcRepository rawJdbcRepository = new XaRawJdbcRepository(createDataSource());
        rawJdbcRepository.demo();
    }
    
    private static DataSource createDataSource() {
        BasicDataSource result = new BasicDataSource();
        result.setDriverClassName(com.mysql.jdbc.Driver.class.getName());
        result.setUrl(String.format("jdbc:mysql://%s:%d/sharding_db?useServerPrepStmts=true&cachePrepStmts=true", PROXY_IP, PROXY_PORT));
        result.setUsername("root");
        result.setPassword("<PASSWORD>");
        return result;
    }
}<commit_msg>use jdbc repository<commit_after>/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */

package io.shardingsphere.example.proxy.main;

import io.shardingsphere.example.proxy.repository.JdbcRepository;
import org.apache.commons.dbcp.BasicDataSource;

import javax.sql.DataSource;
import java.sql.SQLException;

/*
 * 1. Modify proxy.transaction.enabled: `false` to `true` to enable XA transaction on file resources/config.yaml.
 * 2. Copy resources/config.yaml to sharding-proxy conf folder and overwrite original file.
 * 3. Please make sure sharding-proxy is running before you run this example.
 */
public class ProxyXaMain {
    private static final String PROXY_IP = "localhost";
    
    private static final int PROXY_PORT = 3307;
    
    public static void main(String[] args) throws SQLException {
        JdbcRepository rawJdbcRepository = new JdbcRepository(createDataSource(), true);
        rawJdbcRepository.demo();
    }
    
    private static DataSource createDataSource() {
        BasicDataSource result = new BasicDataSource();
        result.setDriverClassName(com.mysql.jdbc.Driver.class.getName());
        result.setUrl(String.format("jdbc:mysql://%s:%d/sharding_db?useServerPrepStmts=true&cachePrepStmts=true", PROXY_IP, PROXY_PORT));
        result.setUsername("root");
        result.setPassword("<PASSWORD>");
        return result;
    }
}
{'fraction_non_alphanumeric': 0.09433962264150944, 'fraction_numerical': 0.009821659343499612, 'mean_word_length': 3.8496240601503757, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3407763', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1065, 'n_words': 349}