13
José Carlos Ramalho [email protected] [email protected] 1 terça-feira, 21 de Fevereiro de 2012

José Carlos Ramalho [email protected] [email protected]/download/attachments/12059470/DBPres-cli.pdfSetting up the environment ¥ CLI tool; ¥ MAMP, XAMPP or WAMP to access

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

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

D a t a b a s e m i g r a t i o nC L I

José Carlos [email protected]

[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

• 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

• 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

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

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

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

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

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

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

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

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

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