⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testddl.java

📁 OBPM是一个开源
💻 JAVA
字号:
package cn.myapps.test;

import junit.framework.TestCase;

import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.ddlutils.Platform;
import org.apache.ddlutils.PlatformFactory;
import org.apache.ddlutils.io.DatabaseIO;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Database;
import org.apache.ddlutils.model.Table;
import org.apache.ddlutils.platform.oracle.Oracle10Platform;
import org.apache.ddlutils.platform.oracle.Oracle9Platform;

public class TestDDL extends TestCase {

	protected void setUp() throws Exception {
		super.setUp();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testDDL() throws Exception {
		/*
		 * String[] names = PlatformFactory.getSupportedPlatforms(); for (int i =
		 * 0; i < names.length; i++) { System.out.println(names[i]); }
		 */
		BasicDataSource ds = new BasicDataSource();
		ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
		ds.setUrl("jdbc:oracle:thin:@192.168.0.100:1521:XE");
		ds.setUsername("wpigb3");
		ds.setPassword("helloworld");

		Oracle9Platform oplatform = new Oracle9Platform();
		oplatform.setDataSource(ds);

		Oracle10Platform platform = new Oracle10Platform();
		platform.setDataSource(ds);
//		platform.getModelReader().get`
		Database db = platform.readModelFromDatabase("XE");
		Table[] tables = db.getTables();
		System.out.println(tables[0].getName());
		
		/*// "author" is a table of the model
		DynaBean author = db.createDynaBeanFor("author", false);

		// "name" and "whatever" are columns of table "author"
		author.set("name", "James");
		author.set("whatever", new Integer(1234));

		//platform.insert(db, author);

		new DatabaseIO().write(db, "f:/test.xml");*/
		/*
		 * Database db = new Database(); db.setName("test"); Table table = new
		 * Table(); table.setName("t_test"); db.addTable(table); String fileName =
		 * "f:/test.xml"; new DatabaseIO().write(db, fileName);
		 */
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -