José Carlos Ramalho [email protected]...
Transcript of José Carlos Ramalho [email protected]...
![Page 2: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/2.jpg)
D a t a b a s e m i g r a t i o nC L I
José Carlos [email protected]
1terça-feira, 21 de Fevereiro de 2012
![Page 3: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/3.jpg)
• DBML;
• Hardware and Software independent;
• It can go beyond database archiving;
• It can help in data migrations into DBMS;
Intermediate Representation
2terça-feira, 21 de Fevereiro de 2012
![Page 4: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/4.jpg)
• http://redmine.keep.pt/projects/roda-dbpres/wiki/Info
• Link for download at the end of the page
Wiki page for CLI tool
3terça-feira, 21 de Fevereiro de 2012
![Page 5: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/5.jpg)
Synopsys: java -jar roda-common-convert-db.jar -i IMPORT_MODULE [options...] -o EXPORT_MODULE [options...]
Available import modules: SQLServerJDBC serverName [port|instance] database username password useIntegratedSecurity encrypt PostgreSQLJDBC hostName database [port] username password encrypt MySQLJDBC hostName [port] database username password DBML baseDir
Available export modules: SQLServerJDBC serverName [port|instance] database username password useIntegratedSecurity encrypt PostgreSQLJDBC hostName database [port] username password encrypt MySQLJDBC hostName [port] database username password PhpMyAdmin hostName [port] database username password DBML baseDir PostgreSQLFile sqlFile
Syntax
4terça-feira, 21 de Fevereiro de 2012
![Page 6: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/6.jpg)
Setting up the environment
• CLI tool;
• MAMP, XAMPP or WAMP to access DIPs:
‣ The abbreviation "MAMP" stands for: Macintosh, Apache, Mysql and PHP. With just a few mouse-clicks, you can install Apache, PHP and MySQL for Mac OS X!
‣ http://www.mamp.info/en/index.html
‣ http://www.apachefriends.org/en/xampp-windows.html
‣ http://www.wampserver.com/en/
5terça-feira, 21 de Fevereiro de 2012
![Page 7: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/7.jpg)
There are several versions of MSAccess.
In order to extract DB structures we need to have access to the internal DB table Msysrelationships.
Microsoft published a white paper explaining how to do this for all versions: "Preparing a Microsoft Access Database for Migration" (look at the bottom of wiki page).
MyClass case study• Log into the server: remote login to a Windows server;
java -jar roda-common-convert-db.jar -i MSAccess yourpath/MyClass.mdb -o DBML outpath/
Publish the result.
From MS Access into DBML
6terça-feira, 21 de Fevereiro de 2012
![Page 8: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/8.jpg)
With PostGres you have to ensure that TCP/IP connections to the server are allowed and that you have administration credentials.
Those points solved we can extract a database with a single command. Inquirições case study• Log into the server: ssh to my Linux server;
java -jar roda-common-convert-db.jar -i PostgreSQLJDBC localhost inquiricoes jcr jc1015 false -o DBML outpath/
Publish the result.
From PostGres into DBML
7terça-feira, 21 de Fevereiro de 2012
![Page 9: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/9.jpg)
You are going to need administrator credentials to access the database.
With MAMP we have to use the port parameter: 8889. Small case study: TABU• Access MAMP server;
java -jar roda-common-convert-db.jar -i MySQLJDBC localhost 8889 database jcr dbml -o DBML outputdir/
Publish the result.
From MySQL into DBML
8terça-feira, 21 de Fevereiro de 2012
![Page 10: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/10.jpg)
You are going to need administrator credentials to access the database.
With MAMP we have to use the port parameter: 8889. MyClass case study:• Add 310 new records from XML file;• Access MAMP server;
java -jar roda-common-convert-db.jar -i DBML DBMLdir -o PhpMyAdmin localhost 8889 MyClass jcr dbml
Use PhpMyAdmin to access MyClass database.
From DBML to MySQL
9terça-feira, 21 de Fevereiro de 2012
![Page 11: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/11.jpg)
You are going to need administrator credentials to access the database.
With MAMP we have to use the port parameter: 8889. MyClass case study:• Add 310 new records from XML file;• Access MAMP server;
java -jar roda-common-convert-db.jar -i DBML DBMLdir -o MySQLFile MyClass.sql
Use PhpMyAdmin to execute SQL statements.
From DBML to MySQL SQL
10terça-feira, 21 de Fevereiro de 2012
![Page 12: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/12.jpg)
You are going to need administrator credentials to access the database.
Access PostGres and create database myclass:$psql -U postgres>create database myclass;>\q
Inject database from DBML: java -jar roda-common-convert-db.jar -i DBML DBMLdir -o PostgreSQLJDBC localhost myclass jcr jc1015 false
Use psql to access myclass database:$psql -U postgres myclass>\dt (display tables)>select * from students; (display all records)
From DBML to PostGres
11terça-feira, 21 de Fevereiro de 2012
![Page 13: José Carlos Ramalho jcr@keep.pt jcr@di.uminhowiki.opf-labs.org/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access](https://reader034.fdocuments.in/reader034/viewer/2022051907/5ff988994cc92a37202b6bdc/html5/thumbnails/13.jpg)
http://[email protected]
KEEP SOLUTIONS, LDA.Rua Rosalvo de Almeida, nº 5
4710-429 Braga, Portugal
T +351 253066735
F +351 253604471
Questions?
12terça-feira, 21 de Fevereiro de 2012