Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- @Rollback(true)
- public void checkMysqlConnection() {
- Connection connection = null;
- ResultSet tableDatasRsult = null;
- try {
- Class.forName("com.mysql.jdbc.Driver");
- Properties properties = new Properties();
- properties.setProperty("user", "root");
- properties.setProperty("password", "root");
- String url = "127.0.0.1:3306/unicity";
- connection = DriverManager.getConnection("jdbc:mysql://" + url, properties);
- Assert.assertNotNull(connection);
- String sqlq = "select DIST_ID,PV_DATE,POST_DATE from odh";
- PreparedStatement preparedStatement = connection.prepareStatement(sqlq);
- tableDatasRsult = preparedStatement.executeQuery();
- ArrayList<OdhDO> odhDOs = new ArrayList<>();
- while (tableDatasRsult.next()) {
- OdhDO odhDO = new OdhDO();
- odhDO.setDistId(tableDatasRsult.getLong("DIST_ID"));
- odhDO.setPvDate(tableDatasRsult.getString("PV_DATE"));
- odhDO.setPostDate(tableDatasRsult.getString("POST_DATE"));
- odhDOs.add(odhDO);
- Map<String, Object> params = new HashMap<>();
- params.put(odhDO.getDistId().toString(), odhDO);
- System.out.println(params);
- }
- } catch (ClassNotFoundException e) {
- System.out.println("MySql Driver Class Not Found Exception");
- e.printStackTrace();
- } catch (SQLException e) {
- System.out.println("Sql Exception");
- e.printStackTrace();
- } finally {
- try {
- connection.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
- @Test
- @Rollback(true)
- public void checkneo4jConnection(){
- String URL= "http://localhost:7474";
- Configuration configuration = new Configuration();
- configuration.driverConfiguration().setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver").setURI(URL).setCredentials("neo4j", "admin");
- String cypher = "MATCH (Distributor) WHERE Distributor.DISTID IN {odhDOs} RETURN Distributor";
- Map<String, Object> params = new HashMap<>();
- List<String> odhDOs = new ArrayList<>();
- params.put("odhDOs", odhDOs);
- //add some names to the names list
- //params.put(key, value)
- }`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement