What is the current (or default) schema in the database being accessed?
select user from dual;
https://forums.oracle.com/thread/495481
How do I create a schema?
Schemas are associated with database users in a one-to-one relationship. To create a schema, create a new user. This usually means you will need to have administrative access to the database.
CREATE USER sidney
IDENTIFIED BY out_standing1
DEFAULT TABLESPACE example
QUOTA 10M ON example
TEMPORARY TABLESPACE temp
QUOTA 5M ON system
PROFILE app_user
PASSWORD EXPIRE;
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_8003.htm#i2065278
How do I find out what schemas are available on the database I am accessesing?
Since schemas are linked to user accounts,
SELECT username FROM all_users ORDER BY username;
http://stackoverflow.com/questions/4833459/oracle-sql-query-for-listing-all-schemas-in-a-db
Creating table in other schema oracle using select.
CREATE TABLE schema1.table1 AS (SELECT * FROM SCHEMA.table@LinkedDB);
http://stackoverflow.com/questions/10730596/creating-table-in-other-schema-oracle-using-select
When issuing a command in maven that appears to go wrong, guard the arguments with double-quotes:
mvn install:install-file "-DgroupId=org.mozilla" "-DartifactId=jss" "-Dversion=4.2.5" "-Dpackaging=jar" "-Dfile=C:\Users\AArmijos\workspace\componentes-1.0.4\deps\jss-4.2.5.jar"
http://stackoverflow.com/questions/16348459/maven-3-0-5-command-error-the-goal-you-specified-requires-a-project-to-execute
Add the Oracle JDBC driver to your Maven environment.
mvn install:install-file "-Dfile={Path/to/your/ojdbc.jar}" "-DgroupId=com.oracle" "-DartifactId=ojdbc6" "-Dversion=11.2.0" "-Dpackaging=jar"
http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/
Use the Oracle JDBC driver in your Maven project.
# pom.xml
<!-- ORACLE JDBC driver, need install yourself -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
<br />
# hibernate.cfg.xml
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@127.0.0.1:1521:MKYONG</property>
<property name="hibernate.connection.username">mkyong</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.default_schema">MKYONG</property>
<property name="show_sql">true</property>
<mapping resource="com/mkyong/user/DBUser.hbm.xml"></mapping>
</session-factory>
</hibernate-configuration>
<br />
# HibernateUtil.java
static {
try {
factory = new AnnotationConfiguration().configure().
setNamingStrategy(SrvTableNamePrefixNamingStrategy.INSTANCE).
// addPackage("com.xyz") //add package if used.
buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Failed to create sessionFactory object." + ex);
throw new ExceptionInInitializerError(ex);
}
}
# Runner.java
protected Session getSession(){
Session session = HibernateUtil.getSessionFactory().openSession();
return session;
}
Convert a Maven project to an eclipse project.
mvn eclipse:eclipse
http://www.mkyong.com/hibernate/maven-3-hibernate-3-6-oracle-11g-example-xml-mapping/
Skip running the test phase when running Maven.
"-Dmaven.test.skip=true"
http://stackoverflow.com/questions/1607315/build-maven-project-without-running-unit-tests
What is the "printf" equivalent for Java?
String status = String.format("The rename status is (%d)", RENAME_SUCCEEDED);
http://alvinalexander.com/blog/post/java/use-string-format-java-string-output
Strip off '[' and ']' from a line.
:%s/^\[\([^\]]\+\)\]$/\1/g
Convert code blocks using '{{' and '}}' to a <pre class="code"> block
:%s/^}}/ç/g
:%s/\n{{\(\([\r\n]\+[^ç]\+.*\)\+\)\nç/\r<pre class=\"code\">\1\r<\/pre>/g
Create titles
:%s/^==\+ \(.\+\)$/<h4>\1<\/h4>/g
Create links
:%s/^\[\([^\]]\+\)\]$/<a href=\"\1\" target=\"_new\">\1<\/a>/g
Create breaks
:%s/>\n\n/>\r<br \/>\r\r/g
Escape < in code example blocks
:%s/\t</\t \</g
:%s/</\</g
No comments:
Post a Comment