|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javatools.database.Database javatools.database.OracleDatabase
public class OracleDatabase
This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools).
It is licensed under the Creative Commons Attribution License
(see http://creativecommons.org/licenses/by/3.0) by
the YAGO-NAGA team (see http://mpii.de/yago-naga).
The class OracleDatabase implements the Database-interface for an
Oracle SQL data base. Make sure that the file "classes12.jar" of the
Oracle distribution is in the classpath. When using Eclipse, add
the file via Project ->Properties ->JavaBuildPath ->Libraries
->ExternalJARFile.
Example:
Database d=new OracleDatabase("user","password"); d.queryColumn("SELECT foodname FROM food WHERE origin=\"Italy\"") -> [ "Pizza Romana", "Spaghetti alla Bolognese", "Saltimbocca"] Database.describe(d.query("SELECT * FROM food WHERE origin=\"Italy\"") -> foodname |origin |calories | ------------------------------ Pizza Rom|Italy |10000 | Spaghetti|Italy |8000 | Saltimboc|Italy |8000 |This class also provides SQL datatypes (extensions of SQLType.java) that behave according to the conventions of Oracle. For example, the ANSI SQL datatype BOOLEAN is mapped to NUMBER(1). Furthermore, VARCHAR string literals print inner quotes as doublequotes.
Oracle (and only Oracle!) often complains "ORA-01000: maximum open cursors exceeded". This does not necessarily mean that the maximum number of open cursors is exceeded. It can also mean that your SQL statement has an invalid character. Check your SQL statements carefully. If the statements are OK, try the following:
Nested Class Summary | |
---|---|
static class |
OracleDatabase.Bigint
|
static class |
OracleDatabase.Bool
|
static class |
OracleDatabase.Varchar
|
Nested classes/interfaces inherited from class javatools.database.Database |
---|
Database.CommitTransactionSQLException, Database.ConnectionBrokenSQLException, Database.InitTransactionSQLException, Database.Inserter, Database.RollbackTransactionSQLException, Database.StartAutoCommitSQLException, Database.TransactionSQLException |
Field Summary | |
---|---|
static OracleDatabase.Bigint |
bigint
|
static OracleDatabase.Bool |
bool
|
static OracleDatabase.Varchar |
varchar
|
Fields inherited from class javatools.database.Database |
---|
java2SQL, MINCOLUMNWIDTH, SCREENWIDTH, type2SQL |
Constructor Summary | |
---|---|
OracleDatabase()
Constructs a non-functional OracleDatabase for use of getSQLType |
|
OracleDatabase(java.lang.String user,
java.lang.String password)
Constructs a new OracleDatabase from a user and a password on the localhost |
|
OracleDatabase(java.lang.String user,
java.lang.String password,
java.lang.String host)
Constructs a new OracleDatabase from a user, a password and a host |
|
OracleDatabase(java.lang.String user,
java.lang.String password,
java.lang.String host,
java.lang.String port)
Constructs a new OracleDatabase from a user, a password and a host |
|
OracleDatabase(java.lang.String user,
java.lang.String password,
java.lang.String host,
java.lang.String port,
java.lang.String inst)
Constructs a new OracleDatabase from a user, a password and a host |
Method Summary | |
---|---|
void |
connect()
connects to the database specified |
boolean |
connected()
Checks whether the connection to the database is still alive |
boolean |
jarAvailable()
TRUE if the required JAR is there |
java.lang.String |
limit(java.lang.String sql,
int n)
Makes an SQL query limited to n results |
static void |
main(java.lang.String[] args)
|
void |
resetConnection()
Deprecated. replaced by Database.reconnect() |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static OracleDatabase.Varchar varchar
public static OracleDatabase.Bool bool
public static OracleDatabase.Bigint bigint
Constructor Detail |
---|
public OracleDatabase()
public OracleDatabase(java.lang.String user, java.lang.String password, java.lang.String host) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.sql.SQLException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.sql.SQLException
public OracleDatabase(java.lang.String user, java.lang.String password, java.lang.String host, java.lang.String port) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.sql.SQLException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.sql.SQLException
public OracleDatabase(java.lang.String user, java.lang.String password, java.lang.String host, java.lang.String port, java.lang.String inst) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.sql.SQLException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.sql.SQLException
public OracleDatabase(java.lang.String user, java.lang.String password) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
@Deprecated public void resetConnection() throws java.sql.SQLException
Database.reconnect()
java.sql.SQLException
public void connect() throws java.sql.SQLException
connect
in class Database
java.sql.SQLException
public java.lang.String limit(java.lang.String sql, int n)
limit
in class Database
public boolean jarAvailable()
Database
jarAvailable
in class Database
public boolean connected()
connected
in class Database
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |