How to migrate data between MySQL bases on different servers?
Tag : mysql , By : dummyadresse
Date : March 29 2020, 07:55 AM
may help you . You can do it with a combination of UPDATE and SELECT query. However since TABLE 1 has the column title which is of type VARCHAR(255) and TABLE 2 has the column Name which is of type VARCHAR(100) might give a problem. The following query can do this migration however any row with column title having length more than 100 will be SHORTENED to 100. INSERT INTO T2
(ID, Name, UserID)
SELECT id, SUBSTR(title, 0, 100), uid
FROM T1
|
Spring Framework connect to multiple data bases xml JAVA
Tag : java , By : Alex Bartzas
Date : March 29 2020, 07:55 AM
help you fix your problem I am trying to connect to two data bases in using my db config file. If i define second bean for data source i have an exception for a not writable property. Which is the correct way to define two data sources ? And do i need to do something in my java classes ? , I find the solution of my problem. <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/test" />
<property name="username" value="root" />
<property name="password" value="root" />
</bean>
<bean id="dataSourceSecond"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/test" />
<property name="username" value="root" />
<property name="password" value="root" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="jdbcTemplateSecond" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSourceSecond" />
</bean>
</beans>
|
Executing raw sql against multiple data bases
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You may use ActiveRecord::Base.establish_connection to switch database connection. Code should be like this: #database.yml
development:
adapter: postgresql
host: 127.0.0.1
username: postgres
password: postgres
database: development_db
development_another_db:
adapter: postgresql
host: 127.0.0.1
username: postgres
password: postgres
database: another_db
ActiveRecord::Base.establish_connection :development_another_db
sql = "Select * from ... your sql query here"
records_array = ActiveRecord::Base.connection.execute(sql)
ActiveRecord::Base.establish_connection :development
sql = "Another select"
records_array = ActiveRecord::Base.connection.execute(sql)
|
If I reinstall MySql Workbech will i lose my data bases and saved connections?
Tag : mysql , By : jamerson
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Mysql workbench is a standalone software. It won't affect your MySQL databases. It's same as removing phpMyAdmin from your server won't affect your databases.
|
Connect to Multiple data bases using Zend Framework 2 and DoctrineORMModule
Date : March 29 2020, 07:55 AM
|