JDBC

Overview of GOLDILOCKS JDBC Driver

Concepts of GOLDILOCKS JDBC Driver

GOLDILOCKS provides GOLDILOCKS JDBC driver (excluding some features) which complies with standard JDBC 4.0 based on TCP/IP connection. The user can use various transaction features and data query features by using GOLDILOCKS JDBC driver and connecting to GOLDILOCKS in Java program. GOLDILOCKS JDBC driver is written and built based on JDK 1.6. Therefore, it supports JDBC 4.0 features. The driver can be used by adding $GOLDILOCKS_HOME/lib/goldilocks6.jar file to the class path.

The number after goldilocks refers to the JDK version. For more information, refer to Supporting Versions.

GOLDILOCKS JDBC complies with most of JDBC standard specifications, and it also supports non-standard API methods and classes to provide some unique features. For more information about non-standard methods, refer to each class API of JDBC API References or Using Other Data Types.

Characteristics

• Type-4 JDBC Driver

GOLDILOCKS JDBC is a JDBC Type-4 type which is implemented only with pure Java. A user can use a JDBC driver only with jar file without any additional libraries. Also, it is faster and reliable than JDBC-ODBC Bridge type, and it has better portability than Type-2 using Native API.

• JDBC Standard Compliance

GOLDILOCKS JDBC can recycle most of other existing JDBC programs without changing because it complies with the JDBC standard. The connection, various statements and ResultSet features can be used without modifying. However, the connection URL and property name, the name of driver class to be loaded should be changed to suit GOLDILOCKS. And the non-standard features and types are usable with the separate classes and methods API.

• Supporting Various Java Versions

GOLDILOCKS JDBC driver supports three files such as goldilocks8.jar, goldilocks7.jar, goldilocks6.jar, so that a user can select and use the file appropriate for user's Java run-time environment. Because each jar file was built based on JDK 1.8, JDK 1.7, JDK 1.6, it complies with each JDBC 4.2, JDBC 4.1, JDBC 4.0 specifications.

• Flexible Version Compatibility with the Server

Refer to the protocol version for the compatibility with the server and the JDBC driver. If the protocol version of server is higher than that of the JDBC driver, it can be connected.

• API Support for Connection Pooling

JDBC connection object is a resource which is expensive to generate. Therefore, the JDBC standard define a pooling system for it, and ConnectionPoolDataSource and PooledConnection are its interfaces. GOLDILOCKS JDBC implements these interfaces and provides the pooling facility in third party middleware products.

• Supporting XA API

A user can perform the global transaction work by implementing XA interface which is the global transaction standard. And a user can perform the various XA features complying with a standard by using XAResource which is JDBC interface.

• GOLDILOCKS-specific Data Type

GOLDILOCKS uses the data types which are not provided by the JDBC standard. For example, they are Interval related type, the type with time zone information such as Timestamp with time zone, etc. The driver provides a way to obtain or insert these types to DB.

• Server-based Powerful Cursor Scroll Feature

Other JDBC drivers cache the row set in the driver for ResultSet scroll, so uses excessively memory of a client application program. For example, if the cursor is open by scroll insensitive and the rows are patched up to the last, all rows are cached in the driver, and the entire table resides in the client memory. It causes the out of memory error and the excessive use of client memory resource.

However, GOLDILOCKS supports the cursor scroll feature within the server, and clients may have lightweight, fast and reliable performance.

• Efficient Use of Resources

Because GOLDILOCKS minimizes the memory which maintains the row information compared to other JDBC drivers and it does not use Java objects as possible. It can avoid the excessive garbage collection, and perform fast and reliable table scanning with less memory.

• Accurate and Extensive Metadata

Because DatabaseMetaData interface of JDBC standard is faithfully and accurately implemented, it is easy to be linked with various DB tools. In addition, the usability is increased by retrieving DB meta information through various system views.

• Powerful Logging

Various logging features are provided to monitor the usual JDBC API calls and network usage as well as the problem. If the logging-related features are specified in the connection URL, a user can leave a the content log to the console or files. Four types of logging exist, which are logging for JDBC method call recording, logging for protocol sending and receiving, logging for the SQL statement used, logging for global connection usage.

• Connection Failover

Connection failover is supported on JDBC driver level to continuously use an existing connection by automatically reconnecting to the previously registered alternate server when the connection with the execution GOLDILOCKS server fails or is disconnected. A user can use connection failover feature as an existing JDBC program without any exception handling in preparation for the broken connection.

• Connectivity between server and direct attach

Other than TCP/IP based connection, it can be connected with direct attach method interworking with a process as same as the server. Like as ODBC connection supports direct attach method and Client/ Server method, GOLDILOCKS JDBC driver also provides both methods. JDBC program connected with direct attach does not communicate with TCP/IP, but it can use the server features in jvm by directly interworking with the server process. The perfomance is doubled or more than the JDBC program connected with TCP/ IP.

Supporting Versions

GOLDILOCKS JDBC versions

GOLDILOCKS JDBC version information can be viewed when executing goldilocks6.jar file as follows.

shell>java -jar goldilocks6.jar

 GOLDILOCKS JDBC Driver 1.1 Procotol-2.5.2, JDBC4.0 compiled with JDK1.6

The examples above describe that current GOLDILOCKS JDBC driver version is 1.1, and the protocol version is 2.5.2, and JDBC standard version is 4.0 and it is built in JDK 1.6. The driver version is displayed apart from GOLDILOCKS product version, and it goes up whenever the function is strengthened. For more information about JDBC driver version, refer to getDriverMajorVersion, getDriverMinorVersion, getDriverVersion of DatabaseMetaData.

Protocol version determines compatibility with the server, and the driver can interwork with the server if the version is equal to or lower than the server protocol version. The server supports all clients API of the lower protocol version.

goldilocks6.jar complies with JDBC 4.0 standard and it was built in JDK 1.6. goldilocks7.jar complies with JDBC 4.1 standard and it was built in JDK 1.7. goldilocks8.jar complies with JDBC 4.2 standard and it was built in JDK 1.8. Therefore, if the user's java environment is higher than JDK 1.8, use goldilocks8.jar. However, when using Java JDK 1.9 or higher, goldilocks8.jar can be used but API or classes of JDBC 4.3 can not be used.

Examples

Setting Class Path

CLASSPATH should be set to use GOLDILOCKS JDBC driver.

export CLASSPATH=.:$GOLDILOCKS_HOME/lib/goldilocks6.jar

Or, add a suitable jar file for the user's Java execution environment to the path.

Loading Driver Class

The driver class can be loaded as follows.

Class.forName("sunje.goldilocks.jdbc.GoldilocksDriver");

The example above is the conventional method of using JDBC, and it is the method of dynamically loading the driver class and registering in DriverManager and getting the connection. Nowadays, the way to get the connection through DataSource is used more. For more information, refer to the corresponding class in JDBC API References.

Getting Connection

The following code is used to get the connection.

Connection con = DriverManager.getConnection(
    "jdbc:goldilocks://127.0.0.1:22581/test", "TEST", "test");

The connection URL should be started with "jdbc:goldilocks:" to use GOLDILOCKS JDBC. The next is the IP address and port number of the server and "/test" which is the final part of URL is the DB name. The current GOLDILOCKS does not specifically check the DB name because it does not support multi DB. A user connected URL may be obtained again through DatabaseMetaData.getURL().

It connects in Direct Attach (D/A) mode when setting IP to 0.0.0.0, and a port to 0. Or, the connecting protocol, da, can be used instead of ip:port. In other words, both of the following two URL enables connecting in DA mode.

"jdbc:goldilocks://0.0.0.0:0/test"
"jdbc:goldilocks:da/test"

Username and password should respectively use the account and password for DB.

Using Statement and ResultSet

Statement and ResultSet are used in the same way as other JDBC programs.

Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT NAME, ADDRESS FROM EMP");
while (rs.next())
{
    System.out.println("name = " + rs.getString(1));
    System.out.println("address = " + rs.getString(2));
}
rs.close();
stmt.close();

Feature Specification

Connection

Connection Using DriverManager

The traditional way to get a connection is to use DriverManager.

Connection con = DriverManager.getConnection(url_string, user_name, password);

url_string has the following three types.

jdbc:goldilocks://[ip address]:[port_no]/[db_name]
jdbc:goldilocks:da/[db_name]
jdbc:goldilocks:locator//[ip address]:[port_no][, [ip address]:[port_no] ]*/[db_name]

The host name, IPv4 and IPv6 are available for IP address, and port_no refers to the port number set. db_name is not used for the current connection so it can have any name. However, it can not be omitted. The following is an example of URL.

String url_string = "jdbc:goldilocks://localhost:22581/test";
String url_string = "jdbc:goldilocks://127.0.0.1:22581/test";
String url_string = "jdbc:goldilocks://[::1]:22581/test";

IP "0.0.0.0" and port 0 are used as a special address for D/A connection. For more information about D/A mode, refer to Connecting in Direct Attach Mode.

user_name and password refer to GOLDILOCKS account.

The following method is used for various property settings except for the getConnection() method above.

Properties prop = new Properties();
prop.setProperty("user", user_name);
prop.setProperty("password", password);
Connection con = DriverManager.getConnection(url_string, prop);
A locator keyword can be added to  url_string to obtain the server connection information from glocator instead of using the connection property. In this case, ip address and port_no is considered as the connection information of glocator. 
The following is an example of using the locator keyword to the connection statement.
String url_string = "jdbc:goldilocks:locator//127.0.0.1:42581,127.0.0.1:42582/test?locator_service=S1";

The first connection information (127.0.0.1:42581) is the connection information of glocator, and the latter connection information is processed as ALTERNATE_LOCATORS property such as 127.0.0.1:42582.

The following is the property setting which has the meaning as same as the url_string above.

String url_strng = "jdbc:goldilocks://0.0.0.0:0/test";
Properties prop = new Properties();
prop.setProperty("locator_host", "127.0.0.1");
prop.setProperty("locator_port", "42581");
prop.setProperty("alternate_locators", "127.0.0.1:42582");
prop.setProperty("locator_service", "S1");
Connection con = DriverManager.getConnection(url_string, prop);

The property list which can be used for the connection is known through getPropertyInfo() method of GoldilocksDriver. For more information, refer to Connection property.

The login timeout of the connection object which is created by DriverManager and the logger uses the value registered in DriverManager. The logger is used by all JDBC interfaces generated from the connection object. Each connection object is not allowed to have an individual logger.

Connection Using DataSource

The JDBC standard recommends to use DataSource rather than the previous DriverManager. It is because DataSource is a single interface to access any data source, and it can individually set the values related to the various data sources, and may remotely send a DataSource object literally.

A connection object can be obtained through DataSource as follows.

import sunje.goldilocks.jdbc.GoldilocksDataSource;

GoldilocksDataSource ds = new GoldilocksDataSource();
ds.setServerName("127.0.0.1");
ds.setPortNumber(22581);
ds.setDatabaseName("test");
ds.setUser("TEST");
ds.setPassword("test");
Connection con = ds.getConnection();
GoldilocksDataSource classes should be used to create a DataSource object.

Then, various connection information should use setter method which is not DataSource standard API.For more information, refer to DataSource.

When using DriverManager, the login timeout and the logger should be globally set. However, when using DataSource, the login timeout and the logger can be individually set.

ds.setLoginTimeout(10);
ds.setLogWriter(out);

Interworking with Middleware

It is necessary to know the name of the class which implements XADataSource, ConnectionPoolDataSource interface to interwork with middleware such as Weblogic, JBoss, etc. GOLDILOCKS provides GoldilocksXADataSource, GoldilocksConnectionPoolDataSource for sunje.goldilocks.jdbc package. Both classes offer the various setter methods such as GoldilocksDataSource.

import sunje.goldilocks.jdbc.GoldilocksXADataSource;

GoldilocksXADataSource ds = new GoldilocksXADataSource();
ds.setServerName("127.0.0.1");
ds.setPortNumber(22581);
ds.setDatabaseName("test");
ds.setUser("TEST");
ds.setPassword("test");
XAConnection con = ds.getXAConnection();

Connection Property

Connection property

Name

Mandatory/

optional

Valid value

Description

alternate_servers

Optional

IP:PORT[,IP:PORT]+

It is the list of alternate servers for failover. It is delimited by comma (,).

alternate_locators

Optional

IP:PORT[,IP:PORT]+

It is the list of alternate of glocator.

batch_count

Optional

Any integer

It is the number of the batch jobs which can be processed in a single protocol transmission and reception. The default value is 1,000. If the value is too small, too much frequent network communication causes poor performance of the batch processing. If the value is too large, the server memory is increased because the session stacks the execution results.

connection_retry_count

Optional

Any integer

It stores the number of retrials to connect. The default value is 0, then it does not retry to connect.

connection_retry_delay

Optional

Any integer

It stores the delay before the connection retrial in seconds when trying to connect again. The default value is 3.

date_format

Optional

Any string

It is the character format which is used to interconvert

between date and string inside the driver.

da_buffer_size

Optional

Any integer

It sets the size of a buffer which sends and receives data when fetching and binding while connected in direct attach mode. The default value is 100000.

decoding_replacement

Optional

Any string

It is the character replacing a byte value which can not be decoded when decoding a byte array into a string. The default value is ?.

failover_granularity

Optional

{"0", "1", "2"}

It determines whether failover is successful. non-atomic(0), atomic(1), 2 are not yet supported. When an error occurs for the existing prepared statements in the prepare process during failover, if it is 0, then it proceeds the failover, and if it is 1, it determines that the failover fails. The default value is 0.

failover_type

Optional

{"connection", "session"}

It determines the failover types.

  • Connection: Failover is used only when connecting to server.

  • Session: Failover is used when connecting to server as well as communicating with the server like execution.

The default value is session.

format_grammar

Optional

{"db", "java"}

It determines whether the property string such as date_format is the GOLDILOCKS syntax or the syntax used in SimpleDateFormat of java. The default value is db.

global_connection_log

Optional

boolean

It determines whether to perform the global connection logging. The default value is false.

global_logger

Optional

{"console"}

It specifies the logging target.

Currently only console is available. Only the first specified one is valid.

home_dir

Optional

Any string

It specifies a home directory of a cluster server. The default value is null.

include_synonyms

Optional

boolean

It sets whether to include the synonym object in DatabaseMetaData.getColumns(). The default value is false.

keep_alive

Optional

boolean

It determines whether to set the keep_alive as the socket property of the connection. Using the property, the connection remains by periodically sending and receiving ack inside TCP socket. LAN cable error detection can forcibly cut off the connection. The default value is false.

locality_aware_transaction

Optional

boolean

It determines whether to use GLOBAL CONNECTION. If it is set to true, then it uses GLOBAL CONNECTION. The default value is false.

locality_group_policy

Optional

{"0", "1", "2"}

It determines how to select a group if neither of groups are available, or two or more groups are available when using GLOBAL CONNECTION.

  • 0: It randomly selects the group.

  • 1: It sequentially selects groups which exist in LOCALITY_GROUP_PATH setting. If neither of groups in LOCALITY_GROUP_PATH are not available, it randomly selects the group.

  • 2: It sequentially selects groups. It always selects groups in an order of they are connected to the driver.

locality_group_path

Optional

Group name list

It defines the list of selected groups when the available group is not a single one when using GLOBAL CONNECTION. Each group is distinguished with comma (,).

e.g. G1,G2,G3

locality_member_policy

Optional

{"0","1","2","3","4"}

It determines how to select a member in the selected group when using GLOBAL CONNECTION.

  • 0: DML : MASTER / SELECT : MASTER

  • 1: DML : ANY / SELECT : ANY

  • 2: DML : MASTER / SELECT : ANY

  • 3: DML : MASTER / SELECT : SLAVE

  • 4: It sequentially selects members which exist in LOCALITY_MEMBER_PATH setting. If neither of members in LOCALITY_MEMBER_PATH are not available, it uses the MASTER in the selected group.

locality_member_path

Optional

Member name list

It defines the list of members to be used in the selected group when using GLOBAL CONNECTION. Each member is distinguished with comma (,).

e.g. G1N1,G2N1,G3N1,G1N2,G2N2,G3N2

locality_on_demand

Optional

boolean

It accesses to a specific member in need when using GLOBAL CONNECTION. The default value is false.

  • false: It accesses to all members from the beginning.

  • true: It accesses to a specific member when it is required.

locator_connection_timeout

Optional

Any integer

It is the time of waiting for receiving a packet from glocator.

locator_file

Optional

Any string

It is a location file.

locator_host

Optional

IP address

It is host address of glocator.

locator_port

Optional

Port no

It is port of glocator.

locator_service

Optional

Any string

It is the service name to obtain the server connection information.

login_timeout

Optional

Any integer

It sets the timeout duration (second) of the socket when connecting to the server. The default value is 0, and it indefinitely waits.

lzeros

Optional

Any integer

When a numeric is expressed as a string and the number of zeros following the decimal point exceeds this value, it is expressed in exponent notation. The default value is 15.

new_password

Optional

Any string

It can change the account password by using old_password property together.

old_password

Optional

Any string

It can change the account password by using new_password property together.

packet_compression_threshold

Optional

Any integer

It compresses the communication data to be sent to the server when the data size is bigger than packet_compression_threshold. The property range is 32 ~ 2113929216.

password

Mandatory

Any string

It is user account password.

prefer_ipv6

Optional

boolean

It sets whether IPv6 takes precedence over other IP addresses on the host name. The default value is false.

program

Optional

Any string

It is program description.

protocol_log

Optional

boolean

It determines whether to log sending and receiving a protocol. The default value is false.

query_log

Optional

boolean

It determines whether to log a query.

The default value is false.

role

Optional

{"", "SYSDBA",

"ADMIN"}

It specifies the account role. The default value is "".

session_type

Optional

{"1", "2", "3"}

or

{"dedicate", "shared", "default"}

It is one of dedicated/ shared/ default.

(It is selected by DB when it is set to default.)

statement_pool_on

Optional

boolean

It enables the statement pool. The default value is false.

statement_pool_size

Optional

Any integer

It sets the size of the statement pool.

time_format

Optional

Any string

It is the character format which is used to interconvert between time and string inside the driver.

tcp_nodelay

Optional

boolean

It sets TCP_NODELAY(Nagle's Algorithm) property on the socket of the connection. The default value is true.

timestamp_format

Optional

Any string

It is the character format which is used to interconvert between timestamp and string inside the driver.

time_with_time_zone_format

Optional

Any string

It is the character format which is used to interconvert between time with timezone and string inside the driver.

timestamp_with_time_zone_format

Optional

Any string

It is the character format which is used to interconvert between timestamp with timezone and string inside the driver.

trace_log

Optional

boolean

It determines whether to log the trace. The default value is false.

tzeros

Optional

Any integer

When a numeric is expressed as a string and the number of zeros in digit goes beyond this value, it is expressed in exponent notation. The default value is 15.

user

Mandatory

Any string

It is user account name.

use_global_session

Optional

boolean

It is whether to use GLOBAL SESSION. The default value is false.

use_targettype

Optional

{"0", "1", "2"}

It is the information which is to be received together when receiving a column type through communication.

  • 0: none

  • 1: name

  • 2: all

Data Manipulation

Data Manipulation Using Statement

Various SQL statements can be executed by using statement objects. Statement object can be obtained from the connection object as follows.

Connection con = DriverManager.getConnection(...);
Statement stmt = con.createStatement();

Various DML or DDL statements can be executed by using the execute method of the created statement object, and the executeUpdate method.

stmt.executeUpdate("create table emp ( id varchar(20), name varchar(30), age integer )");
stmt.executeUpdate("insert into emp values ('1234560000', 'Yuna', 24)");
int updated = stmt.executeUpdate("delete from emp where age > " + age);

The difference between execute and executeUpdate methods is only the return values. The execute method indicates whether the executed SQL statement returns ResultSet. The executeUpdate method returns the number of updated rows. The execute method can be used for both of DML and SELECT statements, but it throws SQLException if the executeUpdate method is used for SELECT statement.

Direct-execution refers to execution of SQL statement by using statement. It is the method of performing the prepare operation(parsing, validation, optimization) and execution for the SQL statement at a time. On the other hand, prepare-execution refers to the method of preparing the operation, then repeating the execution. Direct-execution repeatedly performs prepare and execution operation every time it is performed, so prepare-execution is more efficient when repeatedly performing the SQL statement.

Data Manipulation Using PreparedStatement

The JDBC standard provides PreparedStatement interface which can use a parameter for data manipulation, and it enables a user to run it more efficiently. In addition, PreparedStatement quickly perform the repeated operation of the SQL statement because performs the prepare operation for the SQL statement only once.

Connection con = DriverManager.getConnection(...);
PreparedStatement pstmt = con.prepareStatement(
  "insert into emp values (?, ?, ?)");
pstmt.setString(1, "55544123000");
pstmt.setString(2, "Gildong");
pstmt.setInt(3, 32);
pstmt.executeUpdate();
pstmt.setString(1, "1357924680");
pstmt.setString(2, "Dooli");
pstmt.setInt(3, 41);
pstmt.executeUpdate();

After preparing the SQL statement as shown in the lines 2-3, the data is bound and performed. PreparedStatement which is prepared once, can bind and execute repeatedly.

If the binding is omitted and execute() is performed, the previously bound values are used.

pstmt.setString(1, "333555777000");
pstmt.setString(2, "Kang");
pstmt.setInt(3, 55);
pstmt.executeUpdate();
pstmt.setString(1, "245778884440");
pstmt.executeUpdate();

When the value is not bound to the second, third parameters as shown in line 6 but immediately executed, the value, "Kang" and 55, which was previously bound, is used. If the previously bound value does not exist, it throws SQLException.

All bound values are deleted by using clearParameters().

pstmt.setString(1, "333555777000");
pstmt.setString(2, "Kang");
pstmt.setInt(3, 55);
pstmt.executeUpdate();
pstmt.clearParameters();
pstmt.setString(1, "245778884440");
pstmt.executeUpdate();

After deleting parameters in line 5, if the value is bound only to the first parameter and executed (line 7), then it throws SQLException.

The main reason to use PreparedStatement is because it can bind the data of various types. It is inconvenient to handle the data of the type such as binary or timestamp because the value can be expressed only in the character string when using Statement. Therefore, it is more convenient to bind all types by using PreparedStatement.

pstmt.setTimestamp(1,
  new Timestamp(Calendar.getInstance().getTimeInMillis()));
pstmt.setCharacterStream(2, new StringReader(BIG_STRING));
pstmt.setObject(3, someObj, Types.LONGVARCHAR);
pstmt.setObject(4, otherObj);

In the sample above, lines 1 ~ 2 binds java.sql.Timestamp object. The binding type (It is GOLDILOCKS type of the data when the data is sent to the server) is TIMESTAMP. For more information about the binding type which is determined by the various setter methods, refer to the corresponding API of PreparedStatement.

Line 3 binds a reader object, and it is bound as LONG VARCHAR type internally.

Line 4 binds the object of Java object type, and explicitly notifies that the type is LONG VARCHAR. For more information about GOLDILOCKS type which is mapped to the type of Types, refer to SQL types → GOLDILOCKS types.

Line 5 literally binds the Java object type, and it is bound to the corresponding GOLDILOCKS data type according to the class type. For more information about mapping between class types and GOLDILOCKS data types, refer to Java objects → GOLDILOCKS types.

Batch Execution Using Statement

The different SQL statements can be executed as the batch job by using addBatch() and executeBatch() of Statement.

stmt.addBatch("insert into emp values ("12345", "Jake", 22)");
stmt.addBatch("insert into salary values ("12345", 5000)");
stmt.addBatch("update members set total_count=total_count+1 where age=22");
stmt.executeBatch();

Likewise, different SQL statements may be performed through a single executeBatch () method. However, this does not mean that the method call executes three statements in the server, gathers the results, sends the results to the JDBC driver with a single protocol. Internally, three times of protocol transmission, execution in the server and result transmission are performed. In other words, it does not have a big performance advantage.

After performing executeBatch, all registered jobs are deleted.

Even if an error occurs during execution, all registered jobs are performed until it is completed. Whether an error occurs or not can be known by the value of the returned int [] type. In other words, if int [] has EXECUTE_FAILED value, it means that the job is failed.

Batch Execution Using PreparedStatement

More powerful batch operation can be performed by using addBatch() and executeBatch() methods of PreparedStatement.

PreparedStatement pstmt = con.prepareStatement("insert into emp values (?, ?, ?)");
pstmt.setString(1, "12345000");
pstmt.setString(2, "John");
pstmt.setInt(3, 33);
pstmt.addBatch();

pstmt.setString(1, "222333555");
pstmt.setString(2, "Henry");
pstmt.setInt(3, 24);
pstmt.addBatch();
int[] inserted = pstmt.executeBatch();

The example above is a process of inserting two rows. The values configuring the two rows are bound through addBatch (), and then if executeBatch () is called, the bound value and the protocol for execution are sent to the server and executed. It is more efficient than the batch execution of Statement and the performance is faster because communication occurs only when executeBatch() is called.

The new value should be bound to execute executeBatch() again because the bound values are deleted after executing executeBatch(). clearBatch() does not be to be explicitly called to delete the registered job after execution.

Even if an error occurs during execution, all registered jobs are performed until it is completed. Whether an error occurs or not can be known by the value of the returned int [] type. In other words, if int [] has EXECUTE_FAILED value, it means that the job is failed.

GOLDILOCKS JDBC provides a separate method which is executeBatchAtomic() in addition to executeBatch(). executeBatch () performs the execution as many as the number of the registered jobs in the server, but the response time is fast because executeBatchAtomic() performs the execution at once with the registered job (the bound values). However, if any one fails, everything fails as it can be seen from the name which is atomic. Therefore, the return type is not int[], but int.

...
int inserted = ((GoldilocksPreparedStatement)pstmt).executeBatchAtomic();

Data Retrieval

Getting Column Values

The data can be retrieved through ResultSet object which is obtained by executeQuery () of the Statement or PreparedStatement.

...
ResultSet rs = pstmt.executeQuery();
while(rs.next())
{
    String id = rs.getString(1);
    String name = rs.getString(2);
    int age = rs.getInt(3);
    ...
}
The contents of the column can be obtained through various getter methods in the ResultSet after retrieving the data in the table. The data in the table is sent to JDBC drivers in the original form of GOLDILOCKS data type, and it is converted to an appropriate Java data type according to the types of getter methods called by a user and it is transmitted to the user. For more information about type conversion mapping of GOLDILOCKS data type and getter method, refer to Whether supporting getter method for GOLDILOCKS type - 1 .
If GOLDILOCKS data type can not be converted to the type of getter, it throws SQLException.

Closing ResultSet

The ResultSet which is used up can release the resources through close(). Even if a user does not explicitly call close(), the followings bring the result as same as when calling close() of ResultSet.

The two ResultSets which are created from a single statement can not be remained simultaneously in the third case above. Only the ResultSet object which is created by the last executeQuery() is valid.

Fetch Size

JDBC can specify the number of rows fetched at once from the server through setFetchSize(int rows) of Statement. The default value of the ResultSet property of GOLDILOCKS is 0. 0 automatically determines the number of rows fetched by the server. For forward only, it is the maximum number of rows fetched in a communication packet. For scrollable, it is fixed to 100. If the value is too large, the amount of memory used by JDBC ResultSet becomes large. If the value is too small, the communication is frequently executed.

The value is mainly used in a scrollable ResultSet because it is not sensitive even when it is scroll sensitive while moving within the row cache of ResultSet. If the value is set too large, the latest information about the changes of rows can not be known.

Field Size Limit

JDBC may limit the maximum length of the column through setMaxFieldSize(int size) of statement. The maximum length can be limited for the types of CHAR, VARCHAR, LONG VARCHAR, BINARY, VARBINARY, and LONG VARBINARY. The data bigger than the length is truncated. The default value is 0, and the maximum length is not limited in this case.

This property is ignored for other types such as INTEGER, DATE, etc..

ResultSet Scroll

Getting Scrollable ResultSet

There are two kinds of scrollable ResultSet, which are scroll sensitive and scroll insensitive. Scroll sensitive is the cursor type which can view the values changed by the transaction itself or other transaction while traversing the ResultSet, but scroll insensitive is not. GOLDILOCKS server supports both of the scroll types, and those facilities can be used by JDBC.

Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                                     ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery("select id, name, age from emp");

If the ResultSet type is TYPE_SCROLL_INSENSITIVE when creating statement as line 1, ResultSet which is created from the statement object is scroll sensitive cursor. However, the current GOLDILOCKS does not support the updatable ResultSet.

The type should be set to TYPE_SCROLL_INSENSITIVE to obtain scroll insensitive ResultSet. The default value is TYPE_FORWARD_ONLY.

However, even it is a scroll sensitive ResultSet, a user can not know the latest value or whether it is changed, when moving within the row cache of ResultSet. The row should be fetched again from the server to find out the latest value or whether it is changed.

Scrolling

JDBC API provides the following methods to scroll the cursor.

public boolean next() throws SQLException;
public boolean previous() throws SQLException;
public boolean first() throws SQLException;
public boolean last() throws SQLException;
public boolean absolute(int rows) throws SQLException;
public boolean relative(int rows) throws SQLException;
public void beforeFirst() throws SQLException;
public void afterLast() throws SQLException;

next() is the method which can be used for forward only or scrollable ResultSet, and it sets the cursor position to the next row. If the row can be read at the moved position, it is true. Otherwise, it is false. Other methods can be used only for scrollable ResultSet.

previous() moves the cursor to the previous row, first() moves the cursor to the first row, last() moves the cursor to the last row, absolute() moves the cursor to the absolute position and relative() moves the cursor to the relative position from the current position. beforeFirst() moves the cursor to before the first row. afterLast()moves the cursor to after the last row.

rs.afterLast();
while (rs.previous())
{
    String id = rs.getString(1);
    String name = rs.getString(2);
    int age = rs.getInt(3);
    ...
}
The code above will query backwards from the last row to the first row.
The current cursor position can be known by the following method.
public int getRow() throws SQLException;

Scrolling Principle

The ResultSet scroll is easy to use, but it may cause poor performance without knowing internal operating principles. Scrolling is performed in result cache within ResultSet of JDBC driver, but it is performed on the server in case when the range exceeds the cache, so the communication may occur. Therefore, it should be used carefully to prevent the poor performance.

The internal default value of the fetch size of scrollable ResultSet is 100 (the external default value is 0 and it can be changed through setFetchSize() method). It means that the number of rows that are fetched to JDBC driver at once are 100. The row cache of ResultSet consists of 100 rows, and the cursor position of ResultSet should be changed if the row position to be moved is in the cache. However, if it is not in the cache, the row at the position where to be moved should be got from the server. At this time, it is necessary to know how to get the row set including the row to be moved.

For example, if the ResultSet has rows from 1 to 100 and the current cursor position is at 100, calling next () will fetch rows 101 through 200 from the server because the next row does not exist in the cache. On the other hand, the rows from 101 to 200 are in ResultSet cache, and it is not appropriate to fetch rows from 100 to 199 from the server by calling previous() if the current cursor position is 101 row. When this approach is used, row should be fetched from the server whenever previous() is called. However, GOLDILOCKS fetches the rowset which includes the corresponding last row from the server when it is required to fetch the row from the server due to calling previous () to prevent this inefficiency. For example, when it is necessary to fetch row of the number 100 by calling previous(), GOLDILOCKS fetches the rows from 1 to 100. Then it is fetched in favor of previous ().

The rule is generalized as follows.

When moved backward, the fetch is performed in favor of next(). When moved forward, the fetch is performed in favor of previous(). This is also applied to absolute () and relative ().

Using Other Data Types

Interval Type

GOLDILOCKS supports the following 13 types related to interval.

sunje.goldilocks.jdbc.GoldilocksInterval object is created and the insert operation is executed by setObject() of PreparedStatement to insert the interval data into a table using JDBC.

GoldilocksInterval object can be created by using createIntervalXXX which is the static method of GoldilocksInterval.

import sunje.goldilocks.jdbc.GoldilocksInterval;

...
GoldilocksInterval interval = GoldilocksInterval.createIntervalDayToSecond(2, 6, "2 08:23:54.560843");
PreparedStatement pstmt = con.prepareStatement("insert into interval_table values (?,?)");
pstmt.setString(1, someId);
pstmt.setObject(2, interval);
pstmt.executeUpdate();

For more information about createIntervalXXX method, refer to GoldilocksInterval. Likewise, GoldilocksInterval is created and it is bound via setObject. Or, a type is explicitly specified as follows.

import sunje.goldilocks.jdbc.GoldilocksTypes;
...
pstmt.setObject(2, interval, GoldilocksTypes.INTERVAL_DAY_TO_SECOND);

The data may be inserted by using a character string without GoldilocksInterval object.

pstmt.setObject(2, "2 08:23:54.560843", GoldilocksTypes.INTERVAL_DAY_TO_SECOND);

In this case, a GoldilocksInterval object is created within JDBC driver and bound to a host variable. Or it may be bound as a string by using setString() method.

pstmt.setString(2, "2 08:23:54.560843");

The string is literally sent to the server when using this method, and the string is converted to Interval day to second type and inserted in the server.

getObject() or getString() of ResultSet queries the Interval type from the DB.

import sunje.goldilocks.jdbc.GoldilocksInterval;

ResultSet rs = stmt.executeQuery("select interval_value from some_table");
while (rs.next())
{
    GoldilocksInterval interval = (GoldilocksInterval)rs.getObject(1);
    System.out.println("type = " + interval.getTypeName() + 
                       ", value = " + interval.toString());
}

The data of GoldilocksInterval type can be retrieved via getObject() of ResultSet. GoldilocksInterval class provides getter like getYear(), getHour(), etc. that return various time data. For more information about getter API, refer to GoldilocksInterval.

Time with Time Zone and Timestamp with Time Zone Types

Concerning time, GOLDILOCKS provides not only SQL standard types such as Date, Time, Timestamp but also Time with time zone and Timestamp with time zone types.

CREATE TABLE SAMPLE_TABLE ( C1 TIME WITH TIME ZONE,
                            C2 TIMESTAMP WITH TIME ZONE );

GOLDILOCKS JDBC provides setTimeTimeZone(int colIndex, Time time, Calendar timezone) method and setTimestampTimeZone(int colIndex, Timestamp time, Calendar timezone) method in GoldilocksPreparedStatement class to insert the data of Time with time zone and Timestamp with time zone types. For more information about specifications refer to setTimeTimeZone and setTimestampTimeZone.

The data can be inserted via existing setTime() and setTimestamp() methods, but the time zone value of the column is unconditionally set to the local time zone of Java execution environment. Therefore, setTimeTimeZone() or setTimestampTimeZone should be used to insert various time zone information.

Time, Timestamp data can be inserted with the given time zone value via setTimeTimeZone and setTimestampTimeZone.

import sunje.goldilocks.jdbc.GoldilocksPreparedStatement;

PreparedStatement pstmt = con.prepareStatement(
    "INSERT INTO SAMPLE_TABLE VALUES (?,?,?,?)");
Calendar now = Calendar.getInstance();
Calendar usNow = Calendar.getInstance(TimeZone.getTimeZone("GMT-8"));

Time t = new Time(now.getTimeInMillis());
Timestamp ts = new Timestamp(now.getTimeInMillis());

pstmt.setTime(1, t);
pstmt.setTimestamp(2, ts);
pstmt.executeUpdate();

((GoldilocksPreparedStatement)pstmt).setTimeTimeZone(1, t, now);
((GoldilocksPreparedStatement)pstmt).setTimestampTimeZone(2, ts, now);
pstmt.executeUpdate();

((GoldilocksPreparedStatement)pstmt).setTimeTimeZone(1, t, usNow);
((GoldilocksPreparedStatement)pstmt).setTimestampTimeZone(2, ts, usNow);
pstmt.executeUpdate();

Line 11, 12 binds the column to time type and timestamp type. Each value of t and ts is sent to the server and the default time zone value is inserted to DB column in the server.

On the other hand, line 15, 16 binds the column to time with time zone type and timestamp with time zone type, and is sent to the server together with time zone information. As a result, if the time zone settings of a server and a client are same, the rows which are inserted by lines 11~13 and 15~17 are same.

Line 19, 20 inserts time zone information of GMT-8 time zone.

There are two ways to query data, which are time with time zone and timestamp with time zone. One is the way to get data as char from the server, and the other is the way to get data of the corresponding type by JDBC and to obtain as time or as timestamp object.

ResultSet rs = stmt.executeQuery("select c1, cast(c1 as char(33)), c2, cast(c2 as char(33)) from sample_table");
while (rs.next())
{
    System.out.println("c1 = " + rs.getTime(1).toString());
    System.out.println("c1 as char = " + rs.getString(2));

    System.out.println("c2 = " + rs.getTimestamp(3).toString());
    System.out.println("c2 as char = " + rs.getString(4));
}

When executing the code above, the results are as follows.

c1 = 12:35:26
c1 as char = 12:35:26.052000 +09:00           
c2 = 2014-03-27 12:35:26.052
c2 as char = 2014-03-27 12:35:26.052000 +09:00
c1 = 12:35:26
c1 as char = 12:35:26.052000 +09:00           
c2 = 2014-03-27 12:35:26.052
c2 as char = 2014-03-27 12:35:26.052000 +09:00
c1 = 12:35:26
c1 as char = 19:35:26.052000 -08:00           
c2 = 2014-03-27 12:35:26.052
c2 as char = 2014-03-26 19:35:26.052000 -08:00

Logging

Logging Types

When developing a project by using JDBC, it is helpful in many ways for JDBC driver to leave various logs. GOLDILOCKS provides the facility to log the useful information even during operation, as well as the project development.
There are three types of log, which are trace log, protocol log and query log.

Trace log leaves information every time when JDBC API is called. It can be known which JDBC API is called. Protocol log shows the situation to send and receive communication packets between JDBC driver and GOLDILOCKS server. Query log records the SQL statement to be executed, when PreparedStatement or Statement is executed.

Logging by Using DriverManager

First, the logging is left by using DriverManager. The logging media can be determined by using setLogWriter() method in DriverManager, and the type of logging to be left can be specified in connection url.

DriverManager.setLogWriter(new PrintWriter(System.out));
String url = "jdbc:goldilocks://localhost:22581/test?trace_log=on&query_log=on";
Connection con = DriverManager.getConnection(url, "TEST", "test");

Line 1 defines the logging media. All logging is output to the console. Line 2 defines the connection url, and the property can be defined after ? character. It means to using trace_log, query_log.

Likewise, these properties can be specified in URL, or they can be defined with properties object.

Properties prop = new Properties();
prop.put("trace_log", "on");
prop.put("query_log", "on");
prop.put("protocol_log", "on");
prop.put("user", "TEST");
prop.put("password", test");
Connection con = DriverManager.getConnection(url, prop);

The connection properties which can be used in GOLDILOCKS are defined in Connection property.

Sometimes it is difficult to call setLogWriter() of DriverManager. When using the middleware, the code like that can not be added. For such a case, GOLDILOCKS JDBC provides a global property called global_logger. Other general properties are limited to a single connection, but this property is global. In other words, if the property is set, it does not have to call DriverManager.setLogWriter ().

String url = "jdbc:goldilocks://localhost:22581/test?" +            
             "global_logger=console&trace_log=on&query_log=on";
Connection con = DriverManager.getConnection(url, "TEST", "test");

global_logger property is applied only once initially, and it is ignored if log writer is already set in DriverManager. Only the current console is applicable as the property value. Other value does not cause any operation.

Logging by Using DataSource

Unlike DriverManager, DataSource can set the log writer by each object. If the log writer is set for a DataSource object, all connections which are generated from the DataSource are logged by the log writer. The following describes how to set the logging in the DataSource.

import sunje.goldilocks.jdbc.GoldilocksDataSource;
...
GoldilocksDataSource ds = new sunje.goldilocks.jdbc.GoldilocksDataSource();
ds.setServerName("localhost");
ds.setDatabaseName("test");
ds.setUser("TEST");
ds.setPassword("test");
ds.setPortNumber(22581);
ds.setLogTarget("console");
ds.setTraceLog("on");
ds.setQueryLog("on");
ds.setProtocolLog("on");
Connection con = ds.getConnection();

Likewise, the logging feature is set by using setLogTarget(), setTraceLog(), setQueryLog() and setProtocolLog() methods. setLogWriter() of DataSource can be called instead of setLogTarget(). When using the middleware, the method such as setLogWriter() can not be directly called, so it should be controlled with the property. In this case, if logTarget, traceLog, queryLog and protocolLog properties are defined, the middleware automatically calls the methods.

Viewing Plan Text

Usage

The plan text can be obtained by using GOLDILOCKS JDBC like as the plan text of the executed statement is obtained by using GOLDILOCKS ODBC. It can be configured to generate a plan text by using non-standard API method in GoldilocksStatement class, or obtain the plan text which is already generated.

Connection con = ...
GoldilocksStatement stmt = (GoldilocksStatement)con.createStatement();
stmt.setExplainPlanOption(GoldilocksStatement.EXPLAIN_PLAN_OPTION_ON);
ResultSet rs = stmt.executeQuery("select * from t1");
System.out.println(stmt.getExplainPlan());

For example, when querying a simple table, the plan text is output as follows.

< Execution Plan >
==========================================================================
|  IDX  |  NODE DESCRIPTION                                |       ROWS |
--------------------------------------------------------------------------
|    0  |  SELECT STATEMENT                                |            |
|    1  |    TABLE ACCESS ("T1")                           |          0 |
==========================================================================
     1  -  READ COLUMNS : A

Option Types

GOLDILOCKS provides the following four properties about the plan text generation.

These properties are set by using GoldilocksStatement.setExplainPlanOption(int) method, and the property which is set once is continuously maintained. A constant value of the property is defined in GoldilocksStatement.

The plan text for non-SELECT DML statements or other SQL statements is generated at run-time, but the plan text for the SELECT statements is generated when the SELECT statement is fetched and the cursor is positioned at the end in the server. The plan text should be obtained after all rows are traversed with ResultSet for the SELECT statement. The plan text can be obtained when there are few rows in a table because the cursor can traverse until the end in the server without fetching all rows.

Connection Failover

GOLDILOCKS supports the connection failover of the client level (JDBC, ODBC). The application which accesses with client/ server mode by using the JDBC or ODBC to GOLDILOCKS, may perform connection to the alternative server automatically when the connection fails or disconnected. This allows a user to use high availability applications which utilize multiple servers. In particular, when a user registers the main server URL and the alternative server URL through the connection property under interworking web server environment, it can safely use the connection object obtained from the connection pool without worrying about the interruption. Failover is performed entirely automatically inside the driver and the user does not need to worry about the reconnection logics.

alternate_servers property should be given to use failover. IP and port of the alternative server are given for this property, and it may indicate the multiple alternative servers by using the comma (,).

Class.forName("sunje.goldilocks.jdbc.GoldilocksDriver");

String url = "jdbc:goldilocks://192.168.0.101:22581/test";
Property prop = new Properties();
prop.setProperty("user", "TEST");
prop.setProperty("password", "test");
prop.setProperty("alternate_servers", "192.168.0.201:22581");
Connection con = DriverManager.getConnection(url, prop);  1
Statement stmt = con.createStatement();
stmt.executeUpdate("insert into time_tab values (sysdate)");  2
...

For example, if 1 fails to connect to the main server (192.168.0.101), it will automatically connect to an alternative server (192.168.0.201) and returns a connection object. Any error is not returned to the user. If it can not communicate with the server because the connection is broken at 2 during executeUpdate() or before then, it automatically connects to the alternative server inside the driver and continues to use the existing connection object and returns SQLException. Users can continue to use the existing connection object after processing SQLException.

Whether failover or not can be viewed through getWarnings() of connection object.

A failover feature of GOLDILOCKS JDBC is that a user can continue to use statement object or PreparedStatement object created from connection object. (ResultSet can not continue to be used.)

In particular, a user can continue to use the object because PreparedStatements perform the prepare operations internally again in the alternative server if a failover occurs.

Connection con = DriverManager.getConnection(url, prop);
PreparedStatement pstmt = 
    con.prepareStatement("insert into t1 values (?,?)");
...
try
{
    pstmt.setInt(1, 100);
    pstmt.setString(2, "John");
    pstmt.executeUpdate();
}
catch (SQLException sException)
{
    if (sException.getErrorCode() == 21012)
    {
pstmt.executeUpdate(); 
    }
    else
    {
        ...
    }
}

GOLDILOCKS JDBC driver provides some properties related to failover. These can help a user to decide the failover type, connection order and simple policy used for failover.

failover_type

The property is used to select the failover type. In the example above, the failover at 1 is the connection failover and the failover at 2 is the session failover. If the property value is connection, only the connection failover is used, and if it is session, both of the connection failover and session failover can be used. The default value is session.

failover_granularity

When failover occurs, the prepare operation is performed after the PreparedStatement objects which are generated from the current connection object are connected to the alternative server. If the prepare operation fails in the alternative server (An error may occur due to the different server environment.), the property is used to determine whether to consider the failover failed or to ignore the prepare error. The property value is either 0 or 1. If the property value is 0, the prepare error is ignored and the failover continuously proceeds. If the property value is 1, the failover is failed. The default value is 0. If the value is 0 and the prepare operation is failed, PreparedStatement object can not continue to be used and the user should directly create the PreparedStatement object again.

Connecting in Direct Attach Mode

Since JDBC 1.1, Goldilocks provides the connection in direct attach mode (D/A mode) besides the existing connection in Client/ Server mode (C/S mode) based on TCP/ IP. Like as ODBC D/A connection mode, this is operated directly interworking with the server process. so the server module interworks within a single process (in a process same as jvm). Therefore, the remote host can not connect in D/A mode.

D/A mode is designed to utilize the merit of an in-memory DB GOLDILOCKS, which is a fast processing. TCP/ IP based connection offsets the fast processing of GOLDILOCKS by expensive cost, so an alternative method is required when a fast processing is required. Though it is restricted to be operated within the host which is same as the host of GOLDILOCKS server, this D/A mode connection is a good solution.

JDBC program connecting in D/A mode can directly call the server feature by loading GOLDILOCKS jni library when DB connection is created first within jvm. A server module can be directly called through native interface in jvm without network cost, it enables faster processing than the existing C/S mode.

Connecting Method

Use 0.0.0.0:0 instead of existing ip:port in the connection URL to connect in D/A mode. The existing URL can be literaly used and using a special ip:port address (0.0.0.0:0) can minimize changing exisiting applications. Or, use a special protocol (da) to connect in D/A mode.

Connection con =
 DriverManager.getConnection("jdbc:goldilocks://0.0.0.0:0/test","TEST","test");

or,

Connection con =
 DriverManager.getConnection("jdbc:goldilocks:da/test", "TEST", "test");

Features of D/A Connection

GOLDILOCKS server module can be directly called in jvm when connecting in D/A mode. It is called through JNI (Java Native Interface) between JDBC program and GOLDILOCKS server module. It uses the server module with minimum call cost considering that it is expensive to call JNI, so it is faster double than the JDBC based on existing TCP/ IP.

When using the connection based on the existing TCP/ IP, it uses only goldilocks6.jar file. However, when using the connection based on D/A mode, it uses libgoldilocksjni.so file and libgoldilocksas.so file in $GOLDILOCKS_HOME/lib by dynamically loading them. Therefore, an error occurs when connecting if those two library files do not exist. However, the location of the library files need not to be separately specified when operating java program. Because it searches for those two library files and loads them as long as it is in the directory as same as the directory of goldilocks6.jar file.

Global Connection

It support the global connection feature. When using the global connection, an application selects a node appropriate for a query process and performs it in the cluster environment.

Settings

locator_file or locator_host, locator_port should be set together with locality_aware_transaction property value to use the global connection. use_global_session property value should be set to 1 to use the global connection.

Properties prop = new Properties();
prop.put("locality_aware_transaction", "1");
prop.put("locator_file", "/home/goldilocks/.location.ini");
prop.put("user", "TEST");
prop.put("password", test");
Connection con = DriverManager.getConnection(url, prop);
String url = "jdbc:goldilocks://192.168.0.1:22581/test?" +            
             "locality_aware_transaction=1&locator_host=192.168.0.2&locator_port=42581";
Connection con = DriverManager.getConnection(url, "TEST", "test");

Procedure

  1. Connect to the database.

After connecting to the server input by a user and receiving the information of the cluster system, the cluster system information is built through the locator file or glocator, then it connects to all nodes in the cluster system.

  1. Execute the statement.

If the cluster system information is not built, then the cluster system information is built through the locator file or glocator, then it connects to all nodes in the cluster system.

When connecting to a new server by adding a node to the cluster, then it creates all statements of another node on the node, and is ready to execute SQL.

The statement class does not have the information about the sharding key, so the node is selected according to locality_group_policy or locality_member_policy property and the statement is executed.

If PreparedStatement or CallableStatement class does not have the information about the sharding key, then it builds the information about the sharding key of the SQL from an arbitrary server. If the information about the sharding key is built, then an appropriate node is selected by using the information about the sharding key or locality_group_policy, locality_member_policy, and the query is executed.

If an error occurs on the selected node, then it selects an appropriate node again except for that node, and executes the query.

If the sharding information is updated after executing the statement, then the built sharding key information is dropped.

If the cluster system information is updated by adding/ dropping the cluster node after executing the statement, then the built cluster system information is dropped.

  1. Receive ResultSet data.

It receives the data from the node where SQL was executed.

  1. Close ResultSet.

It closes a cursor on the node where SQL was executed.

  1. Close the statement.

It releases the statement from all connected node.

  1. Close the database.

It releases connection to all nodes.

Exception Handling for High Availability

When using GLOBAL CONNECTION, if an error occurs on the selected node during the operation, then it is operated as follows according to the transaction occurrence and SELECT progress.

If an error occurs on the selected node when a transaction did not occur, then it selects another node within JDBC and executes the query. Though an error occurred on the selected node, the query was normally executed on another node, so it does not transfer an error to a user.

If an error occurs on the selected node when a transaction occurred or ResultSet.next() is in progress, then JDBC can not proceeds the current operation any more so it transfers 21047(Retry the transactional operations again). If 21047 error occurs, then a user should perform the transaction or SELECT again.

PreparedStatement pstmt = con.prepareStatement("INSERT INTO T1 VALUES (?)");

boolean retry;

do
{
    retry = false;

    try
    {
        pstmt.setInt(1, 1);
        pstmt.executeUpdate();
    }
    catch (SQLException e)
    {
        if (e.getErrorCode() == 21047)
        {
            retry = true;
        }
        else
        {
            throw e;
        }       
    }
} while (retry == true);
PreparedStatement pstmt = con.prepareStatement("SELECT * FROM T1 WHERE C1 = ?");

boolean retry;

do
{
    retry = false;

    try
    {
        pstmt.setInt(1, 1);
        ResultSet rs = pstmt.executeQuery();
        while (rs.next())
        {
            ...
        }
        rs.close();
    }
    catch (SQLException e)
    {
        if (e.getErrorCode() == 21047)
        {
            retry = true;
        }
        else
        {
            throw e;
        }       
    }
} while (retry == true);

If an error occurs on the selected node when committing a transaction, then JDBC checks whether the transaction has been committed before the error occurred through another node. Though an error occurred on the selected node, if the transaction was normally committed, then it does not transfer an error. Also, if an error occurred on the selected node when a transaction has not been committed, then it transfers 21047(Retry the transactional operations again) error. If 21047error occurs, then a user should perform the transaction again.

If an error occurs on the selected node when rolling back a transaction, then JDBC does not transfer an error. It is because the transaction already has been rolled back due to the node error.

con.setAutoCommit(false);

PreparedStatement pstmt = con.prepareStatement("INSERT INTO T1 VALUES (?)");

boolean retry;

do
{
    retry = false;

    try
    {
        pstmt.setInt(1, 1);
        pstmt.executeUpdate();
        con.commit();
    }
    catch (SQLException e)
    {
        if (e.getErrorCode() == 21047)
        {
            retry = true;
        }
        else
        {
            throw e;
        }       
    }
} while (retry == true);

Constraints

The statement class does not have the information required to select the node appropriate for the query, so the node is selected according to locality_group_policy or locality_member_policy property.

If committing or rolling back with SQL statement when using GLOBAL CONNECTION, then the status change of the transaction is not detected. It is mandatory to use Connection.commit(). Connection.rollback() to commit or rollback the transaction.

Statement Pooling

GOLDILOCKS supports the statement pooling feature. Statement pooling improves the performance by pooling statements which are repeatedly used such as a repetitive statement and a repeatedly called method. The interface for the statement pooling is defined in JDBC 3.0.

An application pools the statement related to a specific connection by using the statement pool. Each connection object has its own pool. GoldilocksConnection includes a method which enables the statement pool. If the statement pool is used, then the statement object is pooled when the close method is called.

Description

If the statement pool is enabled and the close method of the statement object is called, then GOLDILOCKS JDBC driver automatically pools the statement, PreparedStatement and CallableStatement. PreparedStatement and CallableStatement objects perform pooling by using SQL string as a key value. JDBC driver automatically compares/ retrieves PreparedStatement or CallableStatement when creating them.

It is compared based on the following basis.

SQL string of the statement object is subject to change, so SQL string is not used for the pooling, but JDBC driver automatically processes it.

If the matching statement is retrieved while searching in the pool, then it is returned, and if it is not found, then a new statement is created. The statement, the cursor and the status are pooled in both cases if the close method of the object is called. However, the statement becomes closed. Create the statement whose SQL string, the statement type and the result set property are same to use the closed statement again.

If pooled PreparedStatement and CallableStatement objects are retrieved, then the status and the data information are automatically initialized again, and reset to the default value. When the statement pool is full, then it is dropped from the pool by LRU algorithm. Statements stored in the statement pool can be cleared when the close method of the connection object is called.

Usage

Enabling Statement Pool

STATEMENT_POOL_ON and STATEMENT_POOL_SIZE properties should be set to use the statement pool of the connection object. Even when STATEMENT_POOL_ON property is enabled, the default value of STATEMENT_POOL_SIZE is 0, so use the figure bigger than 0.

The statement pool feature is enabled by adding STATEMENT_POOL_ON and STATEMENT_POOL_SIZE properties to the properties object. The statement pool feature is also enabled through GoldilocksDataSource API and GoldilocksConnection API.

Enabling through GoldilocksDataSource

If GoldilocksDataSource class is used, then all connection objects gets statement pools with the identical STATEMENT_POOL_SIZE.

GoldilocksDataSource sDataSource = new GoldilocksDataSource();

sDataSource.setStatementPoolOn( true );
sDataSource.setStatementPoolSize( 10 );

The property setting values can be viewed as follows.

System.out.println("Statement Pool on:" + sDataSource.getStatementPoolOn());
System.out.println("Statement Pool size:" + sDataSource.getStatementPoolSize());
Enabling through GoldilocksConnection

If GoldilocksConnection class is used, then the statement pool is enabled aside from other objects.

GoldilocksConnection sCon = sDataSource.getConnection();

sCon.setStatementPoolOn( true );
sCon.setStatementPoolSize( 10 );

The property setting values can be viewed as follows.

System.out.println("Statement Pool on:" + sCon.getStatementPoolOn());
System.out.println("Statement Pool size:" + sCon.getStatementPoolSize());

Disabling Statement Pool

Enabled statement pool can be disabled. If switching the enabled status to the disabled status, then statements stored in the statement pool are dropped and closed.

Disabling by using setStatementPoolOn method

sCon.setStatementPoolOn(false);

Disabling by using setStatementPoolSize method

sCon.setStatementPoolSize(0);

Creating Statement

The method to created the statement, PreparedStatement, and CallableStatement while the statement pool is enabled is as same as the general creating method.

The following is a code to create the new statement object.

PreparedStatement sPstmt = sCon.prepareStatement( "INSERT INTO EMP VALUES ( ?, ? )" );

Disabling Specific Statement

If the statement pool is enabled, then GOLDILOCKS JDBC driver automatically pools all statements. Using setPoolable method excludes a specific statement from the pooling.

The following is an example of checking whether it is pooled by using isPoolable method and setPoolable method.

PreparedStatement sPstmt = sCon.prepareStatement( "SELECT 1 FROM DUAL" );
System.out.println( "Is poolable: " + sPstmt.isPoolable() );
sPstmt.setPoolable( false );
System.out.println( "Is poolable: " + sPstmt.isPoolable() );

JDBC API References

Array

The class is not implemented.

free

void free() throws SQLException

getArray

Object getArray() throws SQLException
Object getArray(Map<String,Class<?>> map) throws SQLException
Object getArray(long index, int count) throws SQLException
Object getArray(long index, int count, Map<String,Class<?>> map) throws SQLException

getBaseType

int getBaseType() throws SQLException

getBaseTypeName

String getBaseTypeName() throws SQLException

getResultSet

ResultSet getResultSet() throws SQLException
ResultSet getResultSet(Map<String,Class<?>> map) throws SQLException
ResultSet getResultSet(long index, int count) throws SQLException
ResultSet getResultSet(long index, int count, Map<String,Class<?>> map) throws SQLException

Blob

free

void free() throws SQLException

getBinaryStream

InputStream getBinaryStream() throws SQLException
InputStream getBinaryStream(long pos, long length) throws SQLException

getBytes

byte[] getBytes(long pos, int length) throws SQLException

length

long length() throws SQLException

position

long position(byte[] pattern, long start) throws SQLException
long position(Blob pattern, long start) throws SQLException

setBinaryStream

OutputStream setBinaryStream(long pos) throws SQLException

setBytes

int setBytes(long pos, byte[] bytes) throws SQLException
int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException

truncate

void truncate(long len) throws SQLException

CallableStatement

getArray

Array getArray(int parameterIndex) throws SQLException
Array getArray(String parameterName) throws SQLException

getBigDecimal

BigDecimal getBigDecimal(int parameterIndex) throws SQLException
BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException
BigDecimal getBigDecimal(String parameterName) throws SQLException

getBlob

Blob getBlob(int parameterIndex) throws SQLException
Blob getBlob(String parameterName) throws SQLException

getBoolean

boolean getBoolean(int parameterIndex) throws SQLException
boolean getBoolean(String parameterName) throws SQLException

getByte

byte getByte(int parameterIndex) throws SQLException
byte getByte(String parameterName) throws SQLException

getBytes

byte[] getBytes(int parameterIndex) throws SQLException
byte[] getBytes(String parameterName) throws SQLException

getCharacterStream

Reader getCharacterStream(int parameterIndex) throws SQLException
Reader getCharacterStream(String parameterName) throws SQLException

getClob

Clob getClob(int parameterIndex) throws SQLException
Clob getClob(String parameterName) throws SQLException

getDate

Date getDate(int parameterIndex) throws SQLException
Date getDate(int parameterIndex, Calendar cal) throws SQLException
Date getDate(String parameterName) throws SQLException
Date getDate(String parameterName, Calendar cal) throws SQLException

getDouble

double getDouble(int parameterIndex) throws SQLException
double getDouble(String parameterName) throws SQLException

getFloat

float getFloat(int parameterIndex) throws SQLException
float getFloat(String parameterName) throws SQLException

getInt

int getInt(int parameterIndex) throws SQLException
int getInt(String parameterName) throws SQLException

getLong

long getLong(int parameterIndex) throws SQLException
long getLong(String parameterName) throws SQLException

getNCharacterStream

Reader getNCharacterStream(int parameterIndex) throws SQLException
Reader getNCharacterStream(String parameterName) throws SQLException

getNClob

NClob getNClob(int parameterIndex) throws SQLException
NClob getNClob(String parameterName) throws SQLException

getNString

String getNString(int parameterIndex) throws SQLException
String getNString(String parameterName) throws SQLException

getObject

Object getObject(int parameterIndex) throws SQLException
Object getObject(int parameterIndex, Map<String,Class<?>> map) throws SQLException
Object getObject(String parameterName) throws SQLException
Object getObject(String parameterName, Map<String,Class<?>> map) throws SQLException

getRef

Ref getRef(int parameterIndex) throws SQLException
Ref getRef(String parameterName) throws SQLException

getRowId

RowId getRowId(int parameterIndex) throws SQLException
RowId getRowId(String parameterName) throws SQLException

getShort

short getShort(int parameterIndex) throws SQLException
short getShort(String parameterName) throws SQLException

getSQLXML

SQLXML getSQLXML(int parameterIndex) throws SQLException
SQLXML getSQLXML(String parameterName) throws SQLException

getString

String getString(int parameterIndex) throws SQLException
String getString(String parameterName) throws SQLException

getTime

Time getTime(int parameterIndex) throws SQLException
Time getTime(int parameterIndex, Calendar cal) throws SQLException
Time getTime(String parameterName) throws SQLException
Time getTime(String parameterName, Calendar cal) throws SQLException

getTimestamp

Timestamp getTimestamp(int parameterIndex) throws SQLException
Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException
Timestamp getTimestamp(String parameterName) throws SQLException
Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException

getURL

URL getURL(int parameterIndex) throws SQLException
URL getURL(String parameterName) throws SQLException

registerOutParameter

void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException
void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException
void registerOutParameter(String parameterName, int sqlType) throws SQLException
void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException
void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException

setAsciiStream

void setAsciiStream(String parameterName, InputStream x) throws SQLException
void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException
void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException

setBigDecimal

void setBigDecimal(String parameterName, BigDecimal x) throws SQLException

setBinaryStream

void setBinaryStream(String parameterName, InputStream x) throws SQLException
void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException
void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException

setBlob

void setBlob(String parameterName, Blob x) throws SQLException
void setBlob(String parameterName, InputStream inputStream) throws SQLException
void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException

setBoolean

void setBoolean(String parameterName, boolean x) throws SQLException

setByte

void setByte(String parameterName, byte x) throws SQLException

setBytes

void setBytes(String parameterName, byte[] x) throws SQLException

setCharacterStream

void setCharacterStream(String parameterName, Reader reader) throws SQLException
void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException
void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException

setClob

void setClob(String parameterName, Clob x) throws SQLException
void setClob(String parameterName, Reader reader) throws SQLException
void setClob(String parameterName, Reader reader, long length) throws SQLException

setDate

void setDate(String parameterName, Date x) throws SQLException
void setDate(String parameterName, Date x, Calendar cal) throws SQLException

setDouble

void setDouble(String parameterName, double x) throws SQLException

setFloat

void setFloat(String parameterName, float x) throws SQLException

setInt

void setInt(String parameterName, int x) throws SQLException

setLong

void setLong(String parameterName, long x) throws SQLException

setNCharacterStream

void setNCharacterStream(String parameterName, Reader value) throws SQLException
void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException

setNClob

void setNClob(String parameterName, NClob value) throws SQLException
void setNClob(String parameterName, Reader reader) throws SQLException
void setNClob(String parameterName, Reader reader, long length) throws SQLException

setNString

void setNString(String parameterName, String value) throws SQLException

setNull

void setNull(String parameterName, int sqlType) throws SQLException
void setNull(String parameterName, int sqlType, String typeName) throws SQLException

setObject

void setObject(String parameterName, Object x) throws SQLException
void setObject(String parameterName, Object x, int targetSqlType) throws SQLException
void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException

setRowId

void setRowId(String parameterName, RowId x) throws SQLException

setShort

void setShort(String parameterName, short x) throws SQLException

setSQLXML

void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException

setString

void setString(String parameterName, String x) throws SQLException

setTime

void setTime(String parameterName, Time x) throws SQLException
void setTime(String parameterName, Time x, Calendar cal) throws SQLException

setTimestamp

void setTimestamp(String parameterName, Timestamp x) throws SQLException
void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException

setURL

void setURL(String parameterName, URL val) throws SQLException

wasNull

boolean wasNull()

isWrapperFor

boolean isWrapperFor(Class<?> iface)

unwrap

boolean isWrapperFor(Class<?> iface)

Clob

free

void free() throws SQLException

getAsciiStream

InputStream getAsciiStream() throws SQLException

getCharacterStream

Reader getCharacterStream() throws SQLException
Reader getCharacterStream(long pos, long length) throws SQLException

getSubString

String getSubString(long pos, int length) throws SQLException

length

long length() throws SQLException

position

long position(Clob searchstr, long start) throws SQLException
long position(String searchstr, long start) throws SQLException

setAsciiStream

OutputStream setAsciiStream(long pos) throws SQLException

setCharacterStream

Writer setCharacterStream(long pos) throws SQLException

setString

int setString(long pos, String str) throws SQLException
int setString(long pos, String str, int offset, int len) throws SQLException

truncate

void truncate(long len) throws SQLException

CommonDataSource

getLoginTimeout

int getLoginTimeout() throws SQLException

getLogWriter

PrintWriter getLogWriter() throws SQLException

setLoginTimeout

void setLoginTimeout(int seconds) throws SQLException

setLogWriter

void setLogWriter(PrintWriter out) throws SQLException

setDataSourceName

void setDataSourceName(String aDataSourceName)

setServerName

void setServerName(String aServerName)

setDatabaseName

void setDatabaseName(String aDBName)

setNetworkProtocol

void setNetworkProtocol(String aProtocol)

setUser

void setUser(String aUser)

setPassword

void setPassword(String aPassword)

setPortNumber

void setPortNumber(int aPort)
void setPortNumber(String aPort)

setRoleName

void setRoleName(String aRoleName)

setDescription

void setDescription(String aDescription)

setConnectionProperties

void setConnectionProperties(Properties aProps)

setURL

void setURL(String aURL) throws SQLException
void setUrl(String aUrl) throws SQLException

It is as same as setURL (String aURL).

setLogTarget

void setLogTarget(String aTarget)

setTraceLog

void setTraceLog(String aMode)

setQueryLog

void setQueryLog(String aMode)

setProtocolLog

void setProtocolLog(String aMode)

Connection

clearWarnings

void clearWarnings() throws SQLException

close

void close() throws SQLException

commit

void commit() throws SQLException

createArrayOf

Array createArrayOf(String typeName, Object[] elements) throws SQLException

createBlob

Blob createBlob() throws SQLException

createClob

Clob createClob() throws SQLException

createNClob

NClob createNClob() throws SQLException

createSQLXML

SQLXML createSQLXML() throws SQLException

createStatement

Statement createStatement() throws SQLException
Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException

createStruct

Struct createStruct(String typeName, Object[] attributes) throws SQLException

getAutoCommit

boolean getAutoCommit() throws SQLException

getCatalog

String getCatalog() throws SQLException

getClientInfo

Properties getClientInfo() throws SQLException
String getClientInfo(String name) throws SQLException

getHoldability

int getHoldability() throws SQLException

getMetaData

DatabaseMetaData getMetaData() throws SQLException

getNetworkTimeout

int getNetworkTimeout() throws SQLException

getTransactionIsolation

int getTransactionIsolation() throws SQLException

getTypeMap

Map<String,Class<?>> getTypeMap() throws SQLException

getWarnings

SQLWarning getWarnings() throws SQLException

isClosed

boolean isClosed() throws SQLException

This method does not inform a user whether the connection to a physical server is broken. Even if the actual connection is broken it returns true when close () has never been called.

isReadOnly

boolean isReadOnly() throws SQLException

isValid

boolean isValid(int timeout) throws SQLException

nativeSQL

String nativeSQL(String sql) throws SQLException

prepareCall

CallableStatement prepareCall(String sql) throws SQLException
CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException

prepareStatement

PreparedStatement prepareStatement(String sql) throws SQLException
PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException

releaseSavepoint

void releaseSavepoint(Savepoint savepoint) throws SQLException

rollback

void rollback() throws SQLException
void rollback(Savepoint savepoint) throws SQLException

setAutoCommit

void setAutoCommit(boolean autoCommit) throws SQLException

setCatalog

void setCatalog(String catalog) throws SQLException

setClientInfo

void setClientInfo(Properties properties) throws SQLException
void setClientInfo(String name, String value) throws SQLException

setHoldability

void setHoldability(int holdability) throws SQLException

setNetworkTimeout

void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException

setReadOnly

void setReadOnly(boolean readOnly) throws SQLException

setSavepoint

Savepoint setSavepoint() throws SQLException
Savepoint setSavepoint(String name) throws SQLException

setTransactionIsolation

void setTransactionIsolation(int level) throws SQLException

setTypeMap

void setTypeMap(Map<String,Class<?>> map) throws SQLException

isWrapperFor

void isWrapperFor(Class<?> iface) throws SQLException

unwrap

<T> T unwrap(Class<T> iface) throws SQLException

ConnectionPoolDataSource

getPooledConnection

PooledConnection getPooledConnection() throws SQLException
PooledConnection getPooledConnection(String user, String password) throws SQLException

DatabaseMetaData

allProceduresAreCallable

boolean allProceduresAreCallable() throws SQLException

allTablesAreSelectable

boolean allTablesAreSelectable() throws SQLException

autoCommitFailureClosesAllResultSets

boolean autoCommitFailureClosesAllResultSets() throws SQLException

dataDefinitionCausesTransactionCommit

boolean dataDefinitionCausesTransactionCommit() throws SQLException

dataDefinitionIgnoredInTransactions

boolean dataDefinitionIgnoredInTransactions() throws SQLException

deletesAreDetected

boolean deletesAreDetected(int type) throws SQLException

doesMaxRowSizeIncludeBlobs

boolean doesMaxRowSizeIncludeBlobs() throws SQLException

getAttributes

ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException

getBestRowIdentifier

ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException

getCatalogs

ResultSet getCatalogs() throws SQLException

getCatalogSeparator

String getCatalogSeparator() throws SQLException

getCatalogTerm

String getCatalogTerm() throws SQLException

getClientInfoProperties

ResultSet getClientInfoProperties() throws SQLException

getColumnPrivileges

ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException

getColumns

ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException

getConnection

Connection getConnection() throws SQLException

getCrossReference

ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException

getDatabaseMajorVersion

int getDatabaseMajorVersion() throws SQLException

getDatabaseMinorVersion

int getDatabaseMinorVersion() throws SQLException

getDatabaseProductName

String getDatabaseProductName() throws SQLException

getDatabaseProductVersion

String getDatabaseProductVersion() throws SQLException

getDefaultTransactionIsolation

int getDefaultTransactionIsolation() throws SQLException

getDriverMajorVersion

int getDriverMajorVersion() throws SQLException

getDriverMinorVersion

int getDriverMinorVersion() throws SQLException

getDriverName

String getDriverName() throws SQLException

getDriverVersion

String getDriverVersion() throws SQLException

getExportedKeys

ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException

getExtraNameCharacters

String getExtraNameCharacters() throws SQLException

getFunctionColumns

ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException

getFunctions

ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException

getIdentifierQuoteString

String getIdentifierQuoteString() throws SQLException

getImportedKeys

ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException

getIndexInfo

ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException

getJDBCMajorVersion

int getJDBCMajorVersion() throws SQLException

getJDBCMinorVersion

int getJDBCMinorVersion() throws SQLException

getMaxBinaryLiteralLength

int getMaxBinaryLiteralLength() throws SQLException

getMaxCatalogNameLength

int getMaxCatalogNameLength() throws SQLException

getMaxCharLiteralLength

int getMaxCharLiteralLength() throws SQLException

getMaxColumnNameLength

int getMaxColumnNameLength() throws SQLException

getMaxColumnsInGroupBy

int getMaxColumnsInGroupBy() throws SQLException

getMaxColumnsInIndex

int getMaxColumnsInIndex() throws SQLException

getMaxColumnsInOrderBy

int getMaxColumnsInOrderBy() throws SQLException

getMaxColumnsInSelect

int getMaxColumnsInSelect() throws SQLException

getMaxColumnsInTable

int getMaxColumnsInTable() throws SQLException

getMaxConnections

int getMaxConnections() throws SQLException

getMaxCursorNameLength

int getMaxCursorNameLength() throws SQLException

getMaxIndexLength

int getMaxIndexLength() throws SQLException

The JDBC specification defines that the available maximum size of a single index is returned in bytes, but its value is meaningless, because index size does not have limit. It operates in this way for it to have the same meaning as ODBC.

getMaxProcedureNameLength

int getMaxProcedureNameLength() throws SQLException

getMaxRowSize

int getMaxRowSize() throws SQLException

getMaxSchemaNameLength

int getMaxSchemaNameLength() throws SQLException

getMaxStatementLength

int getMaxStatementLength() throws SQLException

getMaxStatements

int getMaxStatements() throws SQLException

getMaxTableNameLength

int getMaxTableNameLength() throws SQLException

getMaxTablesInSelect

int getMaxTablesInSelect() throws SQLException

getMaxUserNameLength

int getMaxUserNameLength() throws SQLException

getNumericFunctions

String getNumericFunctions() throws SQLException

getPrimaryKeys

ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException

getProcedureColumns

ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException

getProcedures

ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException

getProcedureTerm

String getProcedureTerm() throws SQLException

getResultSetHoldability

int getResultSetHoldability() throws SQLException

getRowIdLifetime

RowIdLifetime getRowIdLifetime() throws SQLException

getSchemas

ResultSet getSchemas() throws SQLException
ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException

getSchemaTerm

String getSchemaTerm() throws SQLException

getSearchStringEscape

String getSearchStringEscape() throws SQLException

getSQLKeywords

String getSQLKeywords() throws SQLException

getSQLStateType

int getSQLStateType() throws SQLException

getStringFunctions

String getStringFunctions() throws SQLException

getSuperTables

ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException

getSuperTypes

ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException

getSystemFunctions

String getSystemFunctions() throws SQLException

getTablePrivileges

ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException

getTables

ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException

getTableTypes

ResultSet getTableTypes() throws SQLException

getTimeDateFunctions

String getTimeDateFunctions() throws SQLException

getTypeInfo

ResultSet getTypeInfo() throws SQLException

getUDTs

ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException

getURL

String getURL() throws SQLException

getUserName

String getUserName() throws SQLException

A user name may be different from the user name used to connect firstly because the user can be changed during a session.

getVersionColumns

ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException

insertsAreDetected

boolean insertsAreDetected(int type) throws SQLException

isCatalogAtStart

boolean isCatalogAtStart() throws SQLException

isReadOnly

boolean isReadOnly() throws SQLException

locatorsUpdateCopy

boolean locatorsUpdateCopy() throws SQLException

nullPlusNonNullIsNull

boolean nullPlusNonNullIsNull() throws SQLException

nullsAreSortedAtEnd

boolean nullsAreSortedAtEnd() throws SQLException

nullsAreSortedAtStart

boolean nullsAreSortedAtStart() throws SQLException

nullsAreSortedHigh

boolean nullsAreSortedHigh() throws SQLException

nullsAreSortedLow

boolean nullsAreSortedLow() throws SQLException

othersDeletesAreVisible

boolean othersDeletesAreVisible(int type) throws SQLException

othersInsertsAreVisible

boolean othersInsertsAreVisible(int type) throws SQLException

othersUpdatesAreVisible

boolean othersUpdatesAreVisible(int type) throws SQLException

ownDeletesAreVisible

boolean ownDeletesAreVisible(int type) throws SQLException

ownInsertsAreVisible

boolean ownInsertsAreVisible(int type) throws SQLException

ownUpdatesAreVisible

boolean ownUpdatesAreVisible(int type) throws SQLException

storesLowerCaseIdentifiers

boolean storesLowerCaseIdentifiers() throws SQLException

storesLowerCaseQuotedIdentifiers

boolean storesLowerCaseQuotedIdentifiers() throws SQLException

storesMixedCaseIdentifiers

boolean storesMixedCaseIdentifiers() throws SQLException

storesMixedCaseQuotedIdentifiers

boolean storesMixedCaseQuotedIdentifiers() throws SQLException

storesUpperCaseIdentifiers

boolean storesUpperCaseIdentifiers() throws SQLException

storesUpperCaseQuotedIdentifiers

boolean storesUpperCaseQuotedIdentifiers() throws SQLException

supportsAlterTableWithAddColumn

boolean supportsAlterTableWithAddColumn() throws SQLException

supportsAlterTableWithDropColumn

boolean supportsAlterTableWithDropColumn() throws SQLException

supportsANSI92EntryLevelSQL

boolean supportsANSI92EntryLevelSQL() throws SQLException

supportsANSI92FullSQL

boolean supportsANSI92FullSQL() throws SQLException

supportsANSI92IntermediateSQL

boolean supportsANSI92IntermediateSQL() throws SQLException

supportsBatchUpdates

boolean supportsBatchUpdates() throws SQLException

supportsCatalogsInDataManipulation

boolean supportsCatalogsInDataManipulation() throws SQLException

supportsCatalogsInIndexDefinitions

boolean supportsCatalogsInIndexDefinitions() throws SQLException

supportsCatalogsInPrivilegeDefinitions

boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException

supportsCatalogsInProcedureCalls

boolean supportsCatalogsInProcedureCalls() throws SQLException

supportsCatalogsInTableDefinitions

boolean supportsCatalogsInTableDefinitions() throws SQLException

supportsColumnAliasing

boolean supportsColumnAliasing() throws SQLException

supportsConvert

boolean supportsConvert() throws SQLException

supportsConvert

boolean supportsConvert(int fromType, int toType) throws SQLException

supportsCoreSQLGrammar

boolean supportsCoreSQLGrammar() throws SQLException

supportsCorrelatedSubqueries

boolean supportsCorrelatedSubqueries() throws SQLException

supportsDataDefinitionAndDataManipulationTransactions

boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException

supportsDataManipulationTransactionsOnly

boolean supportsDataManipulationTransactionsOnly() throws SQLException

supportsDifferentTableCorrelationNames

boolean supportsDifferentTableCorrelationNames() throws SQLException

supportsExpressionsInOrderBy

boolean supportsExpressionsInOrderBy() throws SQLException

supportsExtendedSQLGrammar

boolean supportsExtendedSQLGrammar() throws SQLException

supportsFullOuterJoins

boolean supportsFullOuterJoins() throws SQLException

supportsGetGeneratedKeys

boolean supportsGetGeneratedKeys() throws SQLException

supportsGroupBy

boolean supportsGroupBy() throws SQLException

supportsGroupByBeyondSelect

boolean supportsGroupByBeyondSelect() throws SQLException

supportsGroupByUnrelated

boolean supportsGroupByUnrelated() throws SQLException

supportsIntegrityEnhancementFacility

boolean supportsIntegrityEnhancementFacility() throws SQLException

supportsLikeEscapeClause

boolean supportsLikeEscapeClause() throws SQLException

supportsLimitedOuterJoins

boolean supportsLimitedOuterJoins() throws SQLException

supportsMinimumSQLGrammar

boolean supportsMinimumSQLGrammar() throws SQLException

supportsMixedCaseIdentifiers

boolean supportsMixedCaseIdentifiers() throws SQLException

supportsMixedCaseQuotedIdentifiers

boolean supportsMixedCaseQuotedIdentifiers() throws SQLException

supportsMultipleOpenResults

boolean supportsMultipleOpenResults() throws SQLException

supportsMultipleResultSets

boolean supportsMultipleResultSets() throws SQLException

supportsMultipleTransactions

boolean supportsMultipleTransactions() throws SQLException

supportsNamedParameters

boolean supportsNamedParameters() throws SQLException

supportsNonNullableColumns

boolean supportsNonNullableColumns() throws SQLException

supportsOpenCursorsAcrossCommit

boolean supportsOpenCursorsAcrossCommit() throws SQLException

supportsOpenCursorsAcrossRollback

boolean supportsOpenCursorsAcrossRollback() throws SQLException

supportsOpenStatementsAcrossCommit

boolean supportsOpenStatementsAcrossCommit() throws SQLException

supportsOpenStatementsAcrossRollback

boolean supportsOpenStatementsAcrossRollback() throws SQLException

supportsOrderByUnrelated

boolean supportsOrderByUnrelated() throws SQLException

supportsOuterJoins

boolean supportsOuterJoins() throws SQLException

supportsPositionedDelete

boolean supportsPositionedDelete() throws SQLException

supportsPositionedUpdate

boolean supportsPositionedUpdate() throws SQLException

supportsResultSetConcurrency

boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException

supportsResultSetHoldability

boolean supportsResultSetHoldability(int holdability) throws SQLException

supportsResultSetType

boolean supportsResultSetType(int type) throws SQLException

supportsSavepoints

boolean supportsSavepoints() throws SQLException

supportsSchemasInDataManipulation

boolean supportsSchemasInDataManipulation() throws SQLException

supportsSchemasInIndexDefinitions

boolean supportsSchemasInIndexDefinitions() throws SQLException

supportsSchemasInPrivilegeDefinitions

boolean supportsSchemasInPrivilegeDefinitions() throws SQLException

supportsSchemasInProcedureCalls

boolean supportsSchemasInProcedureCalls() throws SQLException

supportsSchemasInTableDefinitions

boolean supportsSchemasInTableDefinitions() throws SQLException

supportsSelectForUpdate

boolean supportsSelectForUpdate() throws SQLException

supportsStatementPooling

boolean supportsStatementPooling() throws SQLException

supportsStoredFunctionsUsingCallSyntax

boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException

supportsStoredProcedures

boolean supportsStoredProcedures() throws SQLException

supportsSubqueriesInComparisons

boolean supportsSubqueriesInComparisons() throws SQLException

supportsSubqueriesInExists

boolean supportsSubqueriesInExists() throws SQLException

supportsSubqueriesInIns

boolean supportsSubqueriesInIns() throws SQLException

supportsSubqueriesInQuantifieds

boolean supportsSubqueriesInQuantifieds() throws SQLException

supportsTableCorrelationNames

boolean supportsTableCorrelationNames() throws SQLException

supportsTransactionIsolationLevel

boolean supportsTransactionIsolationLevel(int level) throws SQLException

supportsTransactions

boolean supportsTransactions() throws SQLException

supportsUnion

boolean supportsUnion() throws SQLException

supportsUnionAll

boolean supportsUnionAll() throws SQLException

updatesAreDetected

boolean updatesAreDetected(int type) throws SQLException

usesLocalFilePerTable

boolean usesLocalFilePerTable() throws SQLException

usesLocalFiles

boolean usesLocalFiles() throws SQLException

DataSource

getConnection

Connection getConnection() throws SQLException
Connection getConnection(String username, String password) throws SQLException

isWrapperFor

boolean isWrapperFor(Class<?> iface) throws SQLException

unwrap

<T> T unwrap(Class<T> iface) throws SQLException

Driver

acceptsURL

boolean acceptsURL(String url) throws SQLException

connect

Connection connect(String url, Properties info) throws SQLException

getMajorVersion

int getMajorVersion() throws SQLException

getMinorVersion

int getMinorVersion() throws SQLException

getPropertyInfo

DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException

jdbcCompliant

boolean jdbcCompliant() throws SQLException

NClob

This class is not implemented.

free

void free() throws SQLException

getAsciiStream

InputStream getAsciiStream() throws SQLException

getCharacterStream

Reader getCharacterStream() throws SQLException
Reader getCharacterStream(long pos, long length) throws SQLException

getSubString

String getSubString(long pos, int length) throws SQLException

length

long length() throws SQLException

position

long position(Clob searchstr, long start) throws SQLException
long position(String searchstr, long start) throws SQLException

setAsciiStream

OutputStream setAsciiStream(long pos) throws SQLException

setCharacterStream

Writer setCharacterStream(long pos) throws SQLException

setString

int setString(long pos, String str) throws SQLException
int setString(long pos, String str, int offset, int len) throws SQLException

truncate

void truncate(long len) throws SQLException

ParameterMetaData

ParameterMetaData object is returned by PreparedStatement.getParameterMetaData(). The parameterMetaData of the GOLDILOCKS JDBC does not use the actual DB information but it is based on the basic type varchar for other information (such as type, etc.) except for in/out. It is because in/out is the only information got from the server on the parameter after prepared. For example, if it is prepared with the query statement which is "Select * from t1 where a =?", the parameter type used in the condition clause is not determined. The server generally assumes it a varchar type.

getParameterClassName

String getParameterClassName(int param) throws SQLException

getParameterCount

int getParameterCount() throws SQLException

getParameterMode

int getParameterMode(int param) throws SQLException

getParameterType

int getParameterType(int param) throws SQLException

getParameterTypeName

String getParameterTypeName(int param) throws SQLException

getPrecision

int getPrecision(int param) throws SQLException

getScale

int getScale(int param) throws SQLException

isNullable

int isNullable(int param) throws SQLException

isSigned

boolean isSigned(int param) throws SQLException

isWrapperFor

boolean isWrapperFor(Class<?> iface) throws SQLException

unwrap

<T> T unwrap(Class<T> iface) throws SQLException

PooledConnection

addConnectionEventListener

void addConnectionEventListener(ConnectionEventListener listener) throws SQLException

addStatementEventListener

void addStatementEventListener(StatementEventListener listener) throws SQLException

close

void close() throws SQLException

getConnection

Connection getConnection() throws SQLException

removeConnectionEventListener

void removeConnectionEventListener(ConnectionEventListener listener) throws SQLException

removeStatementEventListener

void removeStatementEventListener(StatementEventListener listener) throws SQLException

PreparedStatement

addBatch

void addBatch() throws SQLException

clearParameters

void clearParameters() throws SQLException

execute

boolean execute() throws SQLException

executeQuery

ResultSet executeQuery() throws SQLException

executeUpdate

int executeUpdate() throws SQLException

getMetaData

ResultSetMetaData getMetaData() throws SQLException

getParameterMetaData

ParameterMetaData getParameterMetaData() throws SQLException

setArray

void setArray(int parameterIndex, Array x) throws SQLException

setAsciiStream

void setAsciiStream(int parameterIndex, InputStream x) throws SQLException

The cost of conversion to VARCHAR occurs in the server because it is bound to LONG VARCHAR. If the length can be known, it is recommended to use void setAsciiStream(int parameterIndex, InputStream x, int length).

void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException

setBigDecimal

void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException

setBinaryStream

void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException

setBlob

void setBlob(int parameterIndex, Blob x) throws SQLException
void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException

setBoolean

void setBoolean(int parameterIndex, boolean x) throws SQLException

setByte

void setByte(int parameterIndex, byte x) throws SQLException

setBytes

void setBytes(int parameterIndex, byte[] x) throws SQLException

setCharacterStream

void setCharacterStream(int parameterIndex, Reader reader) throws SQLException
void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException
void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException

setClob

void setClob(int parameterIndex, Clob x) throws SQLException
void setClob(int parameterIndex, Reader reader) throws SQLException
void setClob(int parameterIndex, Reader reader, long length) throws SQLException

setDate

void setDate(int parameterIndex, Date x) throws SQLException
void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException

setDouble

void setDouble(int parameterIndex, double x) throws SQLException

setFloat

void setFloat(int parameterIndex, float x) throws SQLException

setInt

void setInt(int parameterIndex, int x) throws SQLException

setLong

void setLong(int parameterIndex, long x) throws SQLException

setNCharacterStream

void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException

setNClob

void setNClob(int parameterIndex, NClob value) throws SQLException
void setNClob(int parameterIndex, Reader reader) throws SQLException
void setNClob(int parameterIndex, Reader reader, long length) throws SQLException

setNString

void setNString(int parameterIndex, String value) throws SQLException

setNull

void setNull(int parameterIndex, int sqlType) throws SQLException
void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException

setObject

void setObject(int parameterIndex, Object x) throws SQLException
Java objects → GOLDILOCKS types

Java class

GOLDILOCKS type

null

VARCHAR

Boolean

BOOLEAN

Byte

NATIVE_SMALLINT

Short

NATIVE_SMALLINT

Integer

NATIVE_INTEGER

Long

NATIVE_BIGINT

Float

NATIVE_REAL

Double

NATIVE_DOUBLE

BigInteger

NATIVE_BIGINT

BigDecimal

NUMBER

String

VARCHAR or LONG VARCHAR

byte[]

VARBINARY or LONG VARBINARY

Date

DATE

Time

TIME

Timestamp

TIMESTAMP

Blob

N/A

Clob

N/A

InputStream

LONG VARBINARY

Reader

LONG VARCHAR

GoldilocksInterval

Corresponding INTERVAL type

RowId

ROWID

Others

N/A

void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException

setRef

void setRef(int parameterIndex, Ref x) throws SQLException

setRowId

void setRowId(int parameterIndex, RowId x) throws SQLException

setShort

void setShort(int parameterIndex, short x) throws SQLException

setSQLXML

void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException

setString

void setString(int parameterIndex, String x) throws SQLException

setTime

void setTime(int parameterIndex, Time x) throws SQLException
void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException

setTimestamp

void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException

setUnicodeStream

void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException

setURL

void setURL(int parameterIndex, URL x) throws SQLException

isWrapperFor

boolean isWrapperFor(Class<?> iface) throws SQLException

unwrap

<T> T unwrap(Class<T> iface) throws SQLException

executeBatchAtomic

boolean executeBatchAtomic() throws SQLException

It is GOLDILOCKS JDBC-specific feature, and PreparedStatement object can be used after it is casted as GoldilocksPreparedStatement.

e.g. ((GoldilocksPreparedStatement)pstmt).executeBatchAtomic();

setTimeTimeZone

void setTimeTimeZone(int parameterIndex, Time x, Calendar cal) throws SQLException

It is GOLDILOCKS JDBC-specific feature, and PreparedStatement object can be used after it is casted as GoldilocksPreparedStatement.

e.g. ((GoldilocksPreparedStatement)pstmt).setTimeTimeZone(1, aTime, aCalendar);

setTimestampTimeZone

void setTimestampTimeZone(int parameterIndex, Timestamp x, Calendar cal) throws SQLException

It is GOLDILOCKS JDBC-specific feature, and PreparedStatement object can be used after it is casted as GoldilocksPreparedStatement.

e.g. ((GoldilocksPreparedStatement)pstmt).setTimestampTimeZone(1, aTimestamp, aCalendar);

Ref

The class is not implemented.

getBaseTypeName

String getBaseTypeName() throws SQLException

getObject

Object getObject() throws SQLException
Object getObject(Map<String,Class<?>> map) throws SQLException

setObject

void setObject(Object value) throws SQLException

ResultSet

absolute

boolean absolute(int row) throws SQLException

If it is not in the cache, it should be fetched again. If the row is behind the current position, the number of rows(n) from row position are fetched from the server in favor of next(). If the row is prior to the current position, the number of n rows from the position(row-n+1) are fetched from the server in favor of previous().

afterLast

void afterLast() throws SQLException

beforeFirst

void beforeFirst() throws SQLException

cancelRowUpdates

void cancelRowUpdates() throws SQLException

clearWarnings

void clearWarnings() throws SQLException

close

void close() throws SQLException

deleteRow

void deleteRow() throws SQLException

findColumn

int findColumn(String columnLabel) throws SQLException

first

boolean first() throws SQLException

getArray

Array getArray(int columnIndex) throws SQLException
Array getArray(String columnLabel) throws SQLException

getAsciiStream

InputStream getAsciiStream(int columnIndex) throws SQLException
InputStream getAsciiStream(String columnLabel) throws SQLException

getBigDecimal

BigDecimal getBigDecimal(int columnIndex) throws SQLException
BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
BigDecimal getBigDecimal(String columnLabel) throws SQLException
BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException

getBinaryStream

InputStream getBinaryStream(int columnIndex) throws SQLException
InputStream getBinaryStream(String columnLabel) throws SQLException

getBlob

Blob getBlob(int columnIndex) throws SQLException
Blob getBlob(String columnLabel) throws SQLException

getBoolean

boolean getBoolean(int columnIndex) throws SQLException
boolean getBoolean(String columnLabel) throws SQLException

getByte

byte getByte(int columnIndex) throws SQLException
byte getByte(String columnLabel) throws SQLException

getBytes

byte[] getBytes(int columnIndex) throws SQLException

If getBytes is performed for all GOLDILOCKS data types, it gets the binary form stored in DB.

byte[] getBytes(String columnLabel) throws SQLException

If getBytes is performed for all GOLDILOCKS data types, it gets the binary form stored in DB.

getCharacterStream

Reader getCharacterStream(int columnIndex) throws SQLException
Reader getCharacterStream(String columnLabel) throws SQLException

getClob

Clob getClob(int columnIndex) throws SQLException
Clob getClob(String columnLabel) throws SQLException

getConcurrency

int getConcurrency() throws SQLException

getCursorName

String getCursorName() throws SQLException

getDate

Date getDate(int columnIndex) throws SQLException
Date getDate(int columnIndex, Calendar cal) throws SQLException
Date getDate(String columnLabel) throws SQLException
Date getDate(String columnLabel, Calendar cal) throws SQLException

getDouble

double getDouble(int columnIndex) throws SQLException
double getDouble(String columnLabel) throws SQLException

getFetchDirection

int getFetchDirection() throws SQLException

getFetchSize

int getFetchSize() throws SQLException

getFloat

float getFloat(int columnIndex) throws SQLException
float getFloat(String columnLabel) throws SQLException

getHoldability

int getHoldability() throws SQLException

getInt

int getInt(int columnIndex) throws SQLException
int getInt(String columnLabel) throws SQLException

getLong

long getLong(int columnIndex) throws SQLException
long getLong(String columnLabel) throws SQLException

getMetaData

ResultSetMetaData getMetaData() throws SQLException

getNCharacterStream

Reader getNCharacterStream(int columnIndex) throws SQLException
Reader getNCharacterStream(String columnLabel) throws SQLException

getNClob

NClob getNClob(int columnIndex) throws SQLException
NClob getNClob(String columnLabel) throws SQLException

getNString

String getNString(int columnIndex) throws SQLException
String getNString(String columnLabel) throws SQLException

getObject

Object getObject(int columnIndex) throws SQLException
Object getObject(int columnIndex, Map<String,Class<?>> map) throws SQLException
Object getObject(String columnLabel) throws SQLException
Object getObject(String columnLabel, Map<String,Class<?>> map) throws SQLException

getRef

Ref getRef(int columnIndex) throws SQLException
Ref getRef(String columnLabel) throws SQLException

getRow

int getRow() throws SQLException

getRowId

RowId getRowId(int columnIndex) throws SQLException
RowId getRowId(String columnLabel) throws SQLException

getShort

short getShort(int columnIndex) throws SQLException
short getShort(String columnLabel) throws SQLException

getSQLXML

SQLXML getSQLXML(int columnIndex) throws SQLException
SQLXML getSQLXML(String columnLabel) throws SQLException

getStatement

Statement getStatement() throws SQLException

getString

String getString(int columnIndex) throws SQLException
String getString(String columnLabel) throws SQLException

getTime

Time getTime(int columnIndex) throws SQLException
Time getTime(int columnIndex, Calendar cal) throws SQLException
Time getTime(String columnLabel) throws SQLException
Time getTime(String columnLabel, Calendar cal) throws SQLException

getTimestamp

Timestamp getTimestamp(int columnIndex) throws SQLException
Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException
Timestamp getTimestamp(String columnLabel) throws SQLException
Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException

getType

int getType() throws SQLException

getUnicodeStream

InputStream getUnicodeStream(int columnIndex) throws SQLException
InputStream getUnicodeStream(String columnLabel) throws SQLException

getURL

URL getURL(int columnIndex) throws SQLException
URL getURL(String columnLabel) throws SQLException

getWarnings

SQLWarning getWarnings() throws SQLException

insertRow

void insertRow() throws SQLException

isAfterLast

boolean isAfterLast() throws SQLException

isBeforeFirst

boolean isBeforeFirst() throws SQLException

isClosed

boolean isClosed() throws SQLException

isFirst

boolean isFirst() throws SQLException

isLast

boolean isLast() throws SQLException

last

boolean last() throws SQLException

moveToCurrentRow

void moveToCurrentRow() throws SQLException

moveToInsertRow

void moveToInsertRow() throws SQLException

next

boolean next() throws SQLException

previous

boolean previous() throws SQLException

refreshRow

void refreshRow() throws SQLException

relative

boolean relative(int rows) throws SQLException

rowDeleted

boolean rowDeleted() throws SQLException

rowInserted

boolean rowInserted() throws SQLException

rowUpdated

boolean rowUpdated() throws SQLException

setFetchDirection

void setFetchDirection(int direction) throws SQLException

setFetchSize

void setFetchSize(int rows) throws SQLException

updateArray

void updateArray(int columnIndex, Array x) throws SQLException
void updateArray(String columnLabel, Array x) throws SQLException

updateAsciiStream

void updateAsciiStream(int columnIndex, InputStream x) throws SQLException
void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException
void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException
void updateAsciiStream(String columnLabel, InputStream x) throws SQLException
void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException
void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException

updateBigDecimal

void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException
void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException

updateBinaryStream

void updateBinaryStream(int columnIndex, InputStream x) throws SQLException
void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException
void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException
void updateBinaryStream(String columnLabel, InputStream x) throws SQLException
void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException
void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException

updateBlob

void updateBlob(int columnIndex, Blob x) throws SQLException
void updateBlob(int columnIndex, InputStream inputStream) throws SQLException
void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException
void updateBlob(String columnLabel, Blob x) throws SQLException
void updateBlob(String columnLabel, InputStream inputStream) throws SQLException
void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException

updateBoolean

void updateBoolean(int columnIndex, boolean x) throws SQLException
void updateBoolean(String columnLabel, boolean x) throws SQLException

updateByte

void updateByte(int columnIndex, byte x) throws SQLException
void updateByte(String columnLabel, byte x) throws SQLException

updateBytes

void updateBytes(int columnIndex, byte[] x) throws SQLException
void updateBytes(String columnLabel, byte[] x) throws SQLException

updateCharacterStream

void updateCharacterStream(int columnIndex, Reader x) throws SQLException
void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException
void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException
void updateCharacterStream(String columnLabel, Reader reader) throws SQLException
void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException
void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException

updateClob

void updateClob(int columnIndex, Clob x) throws SQLException
void updateClob(int columnIndex, Reader reader) throws SQLException
void updateClob(int columnIndex, Reader reader, long length) throws SQLException
void updateClob(String columnLabel, Clob x) throws SQLException
void updateClob(String columnLabel, Reader reader) throws SQLException
void updateClob(String columnLabel, Reader reader, long length) throws SQLException

updateDate

void updateDate(int columnIndex, Date x) throws SQLException
void updateDate(String columnLabel, Date x) throws SQLException

updateDouble

void updateDouble(int columnIndex, double x) throws SQLException
void updateDouble(String columnLabel, double x) throws SQLException

updateFloat

void updateFloat(int columnIndex, float x) throws SQLException
void updateFloat(String columnLabel, float x) throws SQLException

updateInt

void updateInt(int columnIndex, int x) throws SQLException
void updateInt(String columnLabel, int x) throws SQLException

updateLong

void updateLong(int columnIndex, long x) throws SQLException
void updateLong(String columnLabel, long x) throws SQLException

updateNCharacterStream

void updateNCharacterStream(int columnIndex, Reader x) throws SQLException
void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException
void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException
void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException

updateNClob

void updateNClob(int columnIndex, NClob nClob) throws SQLException
void updateNClob(int columnIndex, Reader reader) throws SQLException
void updateNClob(int columnIndex, Reader reader, long length) throws SQLException
void updateNClob(String columnLabel, NClob nClob) throws SQLException
void updateNClob(String columnLabel, Reader reader) throws SQLException
void updateNClob(String columnLabel, Reader reader, long length) throws SQLException

updateNString

void updateNString(int columnIndex, String nString) throws SQLException
void updateNString(String columnLabel, String nString) throws SQLException

updateNull

void updateNull(int columnIndex) throws SQLException
void updateNull(String columnLabel) throws SQLException

updateObject

void updateObject(int columnIndex, Object x) throws SQLException
void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException
void updateObject(String columnLabel, Object x) throws SQLException
void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException

updateRef

void updateRef(int columnIndex, Ref x) throws SQLException
void updateRef(String columnLabel, Ref x) throws SQLException

updateRow

void updateRow() throws SQLException

updateRowId

void updateRowId(int columnIndex, RowId x) throws SQLException
void updateRowId(String columnLabel, RowId x) throws SQLException

updateShort

void updateShort(int columnIndex, short x) throws SQLException
void updateShort(String columnLabel, short x) throws SQLException

updateSQLXML

void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException
void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException

updateString

void updateString(int columnIndex, String x) throws SQLException
void updateString(String columnLabel, String x) throws SQLException

updateTime

void updateTime(int columnIndex, Time x) throws SQLException
void updateTime(String columnLabel, Time x) throws SQLException

updateTimestamp

void updateTimestamp(int columnIndex, Timestamp x) throws SQLException
void updateTimestamp(String columnLabel, Timestamp x) throws SQLException

wasNull

boolean wasNull() throws SQLException

isWrapperFor

boolean isWrapperFor(Class<?> iface)

unwrap

<T> T unwrap(Class<T> iface)

ResultSetMetaData

getCatalogName

String getCatalogName(int column) throws SQLException

getColumnClassName

String getColumnClassName(int column) throws SQLException

getColumnCount

int getColumnCount() throws SQLException

getColumnDisplaySize

int getColumnDisplaySize(int column) throws SQLException

getColumnLabel

String getColumnLabel(int column) throws SQLException

getColumnName

String getColumnName(int column) throws SQLException

getColumnType

int getColumnType(int column) throws SQLException

getColumnTypeName

String getColumnTypeName(int column) throws SQLException

getPrecision

int getPrecision(int column) throws SQLException

getScale

int getScale(int column) throws SQLException

getSchemaName

String getSchemaName(int column) throws SQLException

getTableName

String getTableName(int column) throws SQLException

isAutoIncrement

boolean isAutoIncrement(int column) throws SQLException

isCaseSensitive

boolean isCaseSensitive(int column) throws SQLException

isCurrency

boolean isCurrency(int column) throws SQLException

isDefinitelyWritable

boolean isDefinitelyWritable(int column) throws SQLException

isNullable

int isNullable(int column) throws SQLException

isReadOnly

boolean isReadOnly(int column) throws SQLException

isSearchable

boolean isSearchable(int column) throws SQLException

isSigned

boolean isSigned(int column) throws SQLException

isWritable

boolean isWritable(int column) throws SQLException

isWrapperFor

boolean isWrapperFor(Class<?> iface)

unwrap

<T> T unwrap(Class<T> iface)

RowId

equals

boolean equals(Object obj) throws SQLException

getBytes

byte[] getBytes() throws SQLException

hashCode

int hashCode() throws SQLException

toString

String toString() throws SQLException

RowSet

The class is not implemented

addRowSetListener

void addRowSetListener(RowSetListener listener) throws SQLException

clearParameters

void clearParameters() throws SQLException

execute

void execute() throws SQLException

getCommand

String getCommand() throws SQLException

getDataSourceName

String getDataSourceName() throws SQLException

getEscapeProcessing

boolean getEscapeProcessing() throws SQLException

getMaxFieldSize

int getMaxFieldSize() throws SQLException

getMaxRows

int getMaxRows() throws SQLException

getPassword

String getPassword() throws SQLException

getQueryTimeout

int getQueryTimeout() throws SQLException

getTransactionIsolation

int getTransactionIsolation() throws SQLException

getTypeMap

Map<String,Class<?>> getTypeMap() throws SQLException

getUrl

String getUrl() throws SQLException

getUsername

String getUsername() throws SQLException

isReadOnly

boolean isReadOnly() throws SQLException

removeRowSetListener

void removeRowSetListener(RowSetListener listener) throws SQLException

setArray

void setArray(int i, Array x) throws SQLException

setAsciiStream

void setAsciiStream(int parameterIndex, InputStream x) throws SQLException
void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
void setAsciiStream(String parameterName, InputStream x) throws SQLException
void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException

setBigDecimal

void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
void setBigDecimal(String parameterName, BigDecimal x) throws SQLException

setBinaryStream

void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
void setBinaryStream(String parameterName, InputStream x) throws SQLException
void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException

setBlob

void setBlob(int i, Blob x) throws SQLException
void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException
void setBlob(String parameterName, Blob x) throws SQLException
void setBlob(String parameterName, InputStream inputStream) throws SQLException
void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException

setBoolean

void setBoolean(int parameterIndex, boolean x) throws SQLException
void setBoolean(String parameterName, boolean x) throws SQLException

setByte

void setByte(int parameterIndex, byte x) throws SQLException
void setByte(String parameterName, byte x) throws SQLException

setBytes

void setBytes(int parameterIndex, byte[] x) throws SQLException
void setBytes(String parameterName, byte[] x) throws SQLException

setCharacterStream

void setCharacterStream(int parameterIndex, Reader reader) throws SQLException
void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException
void setCharacterStream(String parameterName, Reader reader) throws SQLException
void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException

setClob

void setClob(int i, Clob x) throws SQLException
void setClob(int parameterIndex, Reader reader) throws SQLException
void setClob(int parameterIndex, Reader reader, long length) throws SQLException
void setClob(String parameterName, Clob x) throws SQLException
void setClob(String parameterName, Reader reader) throws SQLException
void setClob(String parameterName, Reader reader, long length) throws SQLException

setCommand

void setCommand(String cmd) throws SQLException

setConcurrency

void setConcurrency(int concurrency) throws SQLException

setDataSourceName

void setDataSourceName(String name) throws SQLException

setDate

void setDate(int parameterIndex, Date x) throws SQLException
void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException
void setDate(String parameterName, Date x) throws SQLException
void setDate(String parameterName, Date x, Calendar cal) throws SQLException

setDouble

void setDouble(int parameterIndex, double x) throws SQLException
void setDouble(String parameterName, double x) throws SQLException

setEscapeProcessing

void setEscapeProcessing(boolean enable) throws SQLException

setFloat

void setFloat(int parameterIndex, float x) throws SQLException
void setFloat(String parameterName, float x) throws SQLException

setInt

void setInt(int parameterIndex, int x) throws SQLException
void setInt(String parameterName, int x) throws SQLException

setLong

void setLong(int parameterIndex, long x) throws SQLException
void setLong(String parameterName, long x) throws SQLException

setMaxFieldSize

void setMaxFieldSize(int max) throws SQLException

setMaxRows

void setMaxRows(int max) throws SQLException

setNCharacterStream

void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException
void setNCharacterStream(String parameterName, Reader value) throws SQLException
void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException

setNClob

void setNClob(int parameterIndex, NClob value) throws SQLException
void setNClob(int parameterIndex, Reader reader) throws SQLException
void setNClob(int parameterIndex, Reader reader, long length) throws SQLException
void setNClob(String parameterName, NClob value) throws SQLException
void setNClob(String parameterName, Reader reader) throws SQLException
void setNClob(String parameterName, Reader reader, long length) throws SQLException

setNString

void setNString(int parameterIndex, String value) throws SQLException
void setNString(String parameterName, String value) throws SQLException

setNull

void setNull(int parameterIndex, int sqlType) throws SQLException
void setNull(int paramIndex, int sqlType, String typeName) throws SQLException
void setNull(String parameterName, int sqlType) throws SQLException
void setNull(String parameterName, int sqlType, String typeName) throws SQLException

setObject

void setObject(int parameterIndex, Object x) throws SQLException
void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException
void setObject(String parameterName, Object x) throws SQLException
void setObject(String parameterName, Object x, int targetSqlType) throws SQLException
void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException

setPassword

void setPassword(String password) throws SQLException

setQueryTimeout

void setQueryTimeout(int seconds) throws SQLException

setReadOnly

void setReadOnly(boolean value) throws SQLException

setRef

void setRef(int i, Ref x) throws SQLException

setRowId

void setRowId(int parameterIndex, RowId x) throws SQLException
void setRowId(String parameterName, RowId x) throws SQLException

setShort

void setShort(int parameterIndex, short x) throws SQLException
void setShort(String parameterName, short x) throws SQLException

setSQLXML

void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException

setString

void setString(int parameterIndex, String x) throws SQLException
void setString(String parameterName, String x) throws SQLException

setTime

void setTime(int parameterIndex, Time x) throws SQLException
void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException
void setTime(String parameterName, Time x) throws SQLException
void setTime(String parameterName, Time x, Calendar cal) throws SQLException

setTimestamp

void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException
void setTimestamp(String parameterName, Timestamp x) throws SQLException
void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException

setTransactionIsolation

void setTransactionIsolation(int level) throws SQLException

setType

void setType(int type) throws SQLException

setTypeMap

void setTypeMap(Map<String,Class<?>> map) throws SQLException

setURL

void setURL(int parameterIndex, URL x) throws SQLException

setUrl

void setUrl(String url) throws SQLException

setUsername

void setUsername(String name) throws SQLException

RowSetMetaData

The class is not implemented

setAutoIncrement

void setAutoIncrement(int columnIndex, boolean property) throws SQLException

setCaseSensitive

void setCaseSensitive(int columnIndex, boolean property) throws SQLException

setCatalogName

void setCatalogName(int columnIndex, String catalogName) throws SQLException

setColumnCount

void setColumnCount(int columnCount) throws SQLException

setColumnDisplaySize

void setColumnDisplaySize(int columnIndex, int size) throws SQLException

setColumnLabel

void setColumnLabel(int columnIndex, String label) throws SQLException

setColumnName

void setColumnName(int columnIndex, String columnName) throws SQLException

setColumnType

void setColumnType(int columnIndex, int SQLType) throws SQLException

setColumnTypeName

void setColumnTypeName(int columnIndex, String typeName) throws SQLException

setCurrency

void setCurrency(int columnIndex, boolean property) throws SQLException

setNullable

void setNullable(int columnIndex, int property) throws SQLException

setPrecision

void setPrecision(int columnIndex, int precision) throws SQLException

setScale

void setScale(int columnIndex, int scale) throws SQLException

setSchemaName

void setSchemaName(int columnIndex, String schemaName) throws SQLException

setSearchable

void setSearchable(int columnIndex, boolean property) throws SQLException

setSigned

void setSigned(int columnIndex, boolean property) throws SQLException

setTableName

void setTableName(int columnIndex, String tableName) throws SQLException

Savepoint

getSavepointId

int getSavepointId() throws SQLException

getSavepointName

String getSavepointName() throws SQLException

SQLData

The class is not implemented.

getSQLTypeName

String getSQLTypeName() throws SQLException

readSQL

void readSQL(SQLInput stream, String typeName) throws SQLException

writeSQL

void writeSQL(SQLOutput stream) throws SQLException

SQLXML

The class is not implemented.

free

void free() throws SQLException

getBinaryStream

InputStream getBinaryStream() throws SQLException

getCharacterStream

Reader getCharacterStream() throws SQLException

getSource

<T extends Source> T getSource(Class<T> sourceClass) throws SQLException

getString

String getString() throws SQLException

setBinaryStream

OutputStream setBinaryStream() throws SQLException

setCharacterStream

Writer setCharacterStream() throws SQLException

setResult

<T extends Result> T setResult(Class<T> resultClass) throws SQLException

setString

void setString(String value) throws SQLException

Statement

addBatch

void addBatch(String sql) throws SQLException

cancel

void cancel() throws SQLException

clearBatch

void clearBatch() throws SQLException

clearWarnings

void clearWarnings() throws SQLException

close

void close() throws SQLException

execute

boolean execute(String sql) throws SQLException
boolean execute(String sql, int autoGeneratedKeys) throws SQLException
boolean execute(String sql, int[] columnIndexes) throws SQLException
boolean execute(String sql, String[] columnNames) throws SQLException

executeBatch

int[] executeBatch() throws SQLException

It does not have definite advantage over the normal execute() because the batch jobs are not transmitted and executed at once. Use a batch execution of the PreparedStatement for fast processing.

executeQuery

ResultSet executeQuery(String sql) throws SQLException

Its operation is a bit different from execute(). The communicate with the server occurs twice if getResultSet() is performed for the same SQL statement after performing execute(). The execution command is performed when performing execute(), and the fetch related command is performed when performing getResultSet(). On the other hand, executeQuery() assumes that the SQL statement is the select statement, and it executes all with a single communication until fetch.

executeUpdate

int executeUpdate(String sql) throws SQLException
int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
int executeUpdate(String sql, int[] columnIndexes) throws SQLException
int executeUpdate(String sql, String[] columnNames) throws SQLException

getConnection

Connection getConnection() throws SQLException

getExplainPlan

String getExplainPlan() throws SQLException

getExplainPlanOption

int getExplainPlanOption() throws SQLException

getFetchDirection

int getFetchDirection() throws SQLException

getFetchSize

int getFetchSize() throws SQLException

getGeneratedKeys

ResultSet getGeneratedKeys() throws SQLException

getMaxFieldSize

int getMaxFieldSize() throws SQLException

getMaxRows

int getMaxRows() throws SQLException

getMoreResults

boolean getMoreResults() throws SQLException
boolean getMoreResults(int current) throws SQLException

getQueryTimeout

int getQueryTimeout() throws SQLException

getResultSet

ResultSet getResultSet() throws SQLException

getResultSetConcurrency

int getResultSetConcurrency() throws SQLException

getResultSetHoldability

int getResultSetHoldability() throws SQLException

getResultSetType

int getResultSetType() throws SQLException

getUpdateCount

int getUpdateCount() throws SQLException

getUpdateRowCount

long getUpdateRowCount() throws SQLException

getWarnings

SQLWarning getWarnings() throws SQLException

isClosed

boolean isClosed() throws SQLException

isPoolable

boolean isPoolable() throws SQLException

setCursorName

void setCursorName(String name) throws SQLException

setEscapeProcessing

void setEscapeProcessing(boolean enable) throws SQLException

setExplainPlanOption

void setExplainPlanOption(int option) throws SQLException

setFetchDirection

void setFetchDirection(int direction) throws SQLException

setFetchSize

void setFetchSize(int rows) throws SQLException

setMaxFieldSize

void setMaxFieldSize(int max) throws SQLException

setMaxRows

void setMaxRows(int max) throws SQLException

setPoolable

void setPoolable(boolean poolable) throws SQLException

setQueryTimeout

void setQueryTimeout(int seconds) throws SQLException

isWrapperFor

boolean isWrapperFor(Class<?> iface) throws SQLException

unwrap

<T> T unwrap(Class<T> iface) throws SQLException

Struct

The class is not implemented.

getAttributes

Object[] getAttributes() throws SQLException

getAttributes

Object[] getAttributes(Map<String,Class<?>> map) throws SQLException

getSQLTypeName

String getSQLTypeName() throws SQLException

XAConnection

getXAResource

XAResource getXAResource() throws SQLException

XADataSource

getXAConnection

XAConnection getXAConnection() throws SQLException
XAConnection getXAConnection(String user, String password) throws SQLException

XAResource

commit

void commit(Xid xid, boolean onePhase) throws XAException

end

void end(Xid xid, int flags) throws XAException

forget

void forget(Xid xid) throws XAException

getTransactionTimeout

int getTransactionTimeout() throws XAException

isSameRM

boolean isSameRM(XAResource xares) throws XAException

prepare

int prepare(Xid xid) throws XAException

recover

Xid[] recover(int flag) throws XAException

rollback

void rollback(Xid xid) throws XAException

setTransactionTimeout

boolean setTransactionTimeout(int seconds) throws XAException

start

void start(Xid xid, int flags) throws XAException

GoldilocksInterval

To give value to a column of GOLDILOCKS by using a GoldilocksInterval object, refer to Using Other Data Types.

createIntervalYear

public static GoldilocksInterval createIntervalYear(int yearPrecision, boolean sign, int year) throws SQLException
public static GoldilocksInterval createIntervalYear(int yearPrecision, String year) throws SQLException

createIntervalMonth

public static GoldilocksInterval createIntervalMonth(int monthPrecision, boolean sign, int month) throws SQLException
public static GoldilocksInterval createIntervalMonth(int monthPrecision, String month) throws SQLException

createIntervalYearToMonth

public static GoldilocksInterval createIntervalYearToMonth(int yearPrecision, boolean sign, int year, int month) throws SQLException
public static GoldilocksInterval createIntervalYearToMonth(int yearPrecision, String yearToMonth) throws SQLException

createIntervalDay

public static GoldilocksInterval createIntervalDay(int dayPrecision, boolean sign, int day) throws SQLException
public static GoldilocksInterval createIntervalDay(int dayPrecision, String day) throws SQLException

createIntervalHour

public static GoldilocksInterval createIntervalHour(int hourPrecision, boolean sign, int hour) throws SQLException
public static GoldilocksInterval createIntervalHour(int hourPrecision, String hour) throws SQLException

createIntervalMinute

public static GoldilocksInterval createIntervalMinute(int minutePrecision, boolean sign, int minute) throws SQLException
public static GoldilocksInterval createIntervalMinute(int minutePrecision, String minute) throws SQLException

createIntervalSecond

public static GoldilocksInterval createIntervalSecond(int secondPrecision, int fractionalPrecision, boolean sign, int second, int microsecond) throws SQLException
public static GoldilocksInterval createIntervalSecond(int secondPrecision, int fractionalPrecision, boolean sign, int day, int hour, int minute, int second, int microsecond) throws SQLException
public static GoldilocksInterval createIntervalSecond(int secondPrecision, int fractionalPrecision, String second) throws SQLException

createIntervalDayToHour

public static GoldilocksInterval createIntervalDayToHour(int dayPrecision, boolean sign, int day, int hour) throws SQLException
public static GoldilocksInterval createIntervalDayToHour(int dayPrecision, String dayToHour) throws SQLException

createIntervalDayToMinute

public static GoldilocksInterval createIntervalDayToMinute(int dayPrecision, boolean sign, int day, int hour, int minute) throws SQLException
public static GoldilocksInterval createIntervalDayToMinute(int dayPrecision, String dayToMinute) throws SQLException

createIntervalDayToSecond

public static GoldilocksInterval createIntervalDayToSecond(int dayPrecision, int fractionalPrecision, boolean sign, int day, int hour, int minute, int second, int microsecond) throws SQLException
public static GoldilocksInterval createIntervalDayToSecond(int dayPrecision, String dayToSecond) throws SQLException

createIntervalHourToMinute

public static GoldilocksInterval createIntervalHourToMinute(int hourPrecision, boolean sign, int hour, int minute) throws SQLException
public static GoldilocksInterval createIntervalHourToMinute(int hourPrecision, boolean sign, int day, int hour, int minute) throws SQLException
public static GoldilocksInterval createIntervalHourToMinute(int hourPrecision, String hourToMinute) throws SQLException

createIntervalHourToSecond

public static GoldilocksInterval createIntervalHourToSecond(int hourPrecision, int fractionalPrecision, boolean sign, int hour, int minute, int second, int microsecond) throws SQLException
public static GoldilocksInterval createIntervalHourToSecond(int hourPrecision, int fractionalPrecision, boolean sign, int day, int hour, int minute, int second, int microsecond) throws SQLException
public static GoldilocksInterval createIntervalHourToSecond(int hourPrecision, int fractionalPrecision, String hourToSecond) throws SQLException

createIntervalMinuteToSecond

public static GoldilocksInterval createIntervalMinuteToSecond(int minutePrecision, int fractionalPrecision, boolean sign, int minute, int second, int microsecond) throws SQLException
public static GoldilocksInterval createIntervalMinuteToSecond(int minutePrecision, int fractionalPrecision, boolean sign, int day, int hour, int minute, int second, int microsecond) throws SQLException
public static GoldilocksInterval createIntervalMinuteToSecond(int minutePrecision, int fractionalPrecision, String minuteToSecond) throws SQLException

getSign

public int getSign()

getYear

public int getYear()

getMonth

public int getMonth()

getAccumulatedMonth

public int getAccumulatedMonth()

getDay

public int getDay()

getHour

public int getHour()

getAccumulatedHour

public int getAccumulatedHour()

getMinute

public int getMinute()

getAccumulatedMinute

public int getAccumulatedMinute()

getSecond

public int getSecond()

getAccumulatedSecond

public int getAccumulatedSecond()

getMicroSecond

public int getMicroSecond()

getAccumulatedMicroSecond

public long getAccumulatedMicroSecond()

getTypeName

public String getTypeName()

getSqlType

public int getSqlType()

toString

public String toString()

GOLDILOCKS Type

Constant Definition

public static final int INTERVAL_YEAR;
public static final int INTERVAL_MONTH;
public static final int INTERVAL_DAY;
public static final int INTERVAL_HOUR;
public static final int INTERVAL_MINUTE;
public static final int INTERVAL_SECOND;
public static final int INTERVAL_YEAR_TO_MONTH;
public static final int INTERVAL_DAY_TO_HOUR;
public static final int INTERVAL_DAY_TO_MINUTE;
public static final int INTERVAL_DAY_TO_SECOND;
public static final int INTERVAL_HOUR_TO_MINUTE;
public static final int INTERVAL_HOUR_TO_SECOND;
public static final int INTERVAL_MINUTE_TO_SECOND;
public static final int TIME_WITH_TIME_ZONE;
public static final int TIMESTAMP_WITH_TIME_ZONE;

These constants are used as like the constants of java.sql.Types. In other words, they are used when specifying the types in setObject of PreparedStatement or the types in getObject of ResultSet. These types are separately provided by GoldilocksTypes because they are not defined in the JDBC standard.

Type Conversion

The following tables describe how to convert types.

SQL types → GOLDILOCKS types

SQL type

GOLDILOCKS type

Types.BIGINT

NATIVE_BIGINT

Types.BINARY

BINARY(2000)

Types.BIT

BOOLEAN

Types.BOOLEAN

BOOLEAN

Types.BLOB

LONG VARBINARY

Types.CHAR

CHAR(2000)

Types.CLOB

LONG VARCHAR

Types.DATE

DATE

Types.DECIMAL

DECIMAL

Types.DOUBLE

NATIVE_DOUBLE

Types.FLOAT

FLOAT

Types.NUMERIC

NUMBER

Types.INTEGER

NATIVE_INTEGER

Types.LONGVARBINARY

LONG VARBINARY

Types.LONGVARCHAR

LONG VARCHAR

Types.REAL

NATIVE_REAL

Types.ROWID

ROWID

Types.SMALLINT

NATIVE_SMALLINT

Types.TIME

TIME

Types.TIMESTAMP

TIMESTAMP

Types.VARBINARY

VARBINARY(4000)

Types.VARCHAR

VARCHAR(4000)

GoldilocksTypes.INTERVAL_YEAR

INTERVAL YEAR

GoldilocksTypes.INTERVAL_MONTH

INTERVAL MONTH

GoldilocksTypes.INTERVAL_YEAR_TO_MONTH

INTERVAL YEAR TO MONTH

GoldilocksTypes.INTERVAL_DAY

INTERVAL DAY

GoldilocksTypes.INTERVAL_HOUR

INTERVAL HOUR

GoldilocksTypes.INTERVAL_MINUTE

INTERVAL MINUTE

GoldilocksTypes.INTERVAL_SECOND

INTERVAL SECOND

GoldilocksTypes.INTERVAL_DAY_TO_HOUR

INTERVAL DAY TO HOUR

GoldilocksTypes.INTERVAL_DAY_TO_MINUTE

INTERVAL DAY TO MINUTE

GoldilocksTypes.INTERVAL_DAY_TO_SECOND

INTERVAL DAY TO SECOND

GoldilocksTypes.INTERVAL_HOUR_TO_MINUTE

INTERVAL HOUR TO MINUTE

GoldilocksTypes.INTERVAL_HOUR_TO_SECOND

INTERVAL HOUR TO SECOND

GoldilocksTypes.INTERVAL_MINUTE_TO_SECOND

INTERVAL MINUTE TO SECOND

Types.OTHER

N/A

Types.ARRAY

N/A

Types.DATALINK

N/A

Types.DISTINCT

N/A

Types.NCHAR

N/A

Types.NCLOB

N/A

Types.NVARCHAR

N/A

Types.JAVA_OBJECT

N/A

Types.REF

N/A

Types.SQLXML

N/A

Types.STRUCT

N/A

Whether supporting getter method for GOLDILOCKS type - 1


NATIVE_SMALLINT

NATIVE_INTEGER

NATIVE_BIGINT

NATIVE_REAL

NATIVE_DOUBLE

getByte

O

O

O

O

O

getShort

O

O

O

O

O

getInt

O

O

O

O

O

getLong

O

O

O

O

O

getFloat

O

O

O

O

O

getDouble

O

O

O

O

O

getBigDecimal

O

O

O

O

O

getBoolean

Avaliable only for 0,1

Avaliable only for 0,1

Avaliable only for 0,1

Avaliable only for 0,1

Avaliable only for 0,1

getString

O

O

O

O

O

getBytes

raw data

raw data

raw data

raw data

raw data

getDate

X

X

X

X

X

getTime

X

X

X

X

X

getTimestamp

X

X

X

X

X

getAsciiStream

raw data

raw data

raw data

raw data

raw data

getBinaryStream

raw data

raw data

raw data

raw data

raw data

getCharacterStream

X

X

X

X

X

getClob

O

O

O

O

O

getBlob

raw data

raw data

raw data

raw data

raw data

getArray

X

X

X

X

X

getRef

X

X

X

X

X

getURL

X

X

X

X

X

getObject

Short

Integer

Long

Float

Double

getRowId

X

X

X

X

X

Whether supporting getter method for GOLDILOCKS Type - 2


BOOLEAN

FLOAT/

NUMBER

CHAR/

VARCHAR/

LONG VARCHAR

BINARY/

VARBINARY/LONG VARBINARY

ROWID

getByte

0 or 1

O

Available only for numeric

X

X

getShort

0 or 1

O

Available only for numeric

X

X

getInt

0 or 1

O

Available only for numeric

X

X

getLong

0 or 1

O

Available only for numeric

X

X

getFloat

0 or 1

O

Available only for numeric

X

X

getDouble

0 or 1

O

Available only for numeric

X

X

getBigDecimal

0 or 1

O

Available only for numeric

X

X

getBoolean

O

Available only for 0,1

Available only for "t", "f", "true", "false", "y", "n", "yes", "no", "on", "off", "1", "0" (case-insensitive)

X

X

getString

"TRUE" or "FALSE"

O

O

O

O

getBytes

raw data

raw data

raw data

O

raw data

getDate

X

X

Available only for date format

X

X

getTime

X

X

Available only for time format

X

X

getTimestamp

X

X

Available only for timestamp format

X

X

getAsciiStream

raw data

raw data

raw data

O

raw data

getBinaryStream

raw data

raw data

raw data

O

raw data

getCharacterStream

X

X

O

X

X

getClob

"TRUE" or "FALSE"

O

O

O

O

getBlob

raw data

raw data

raw data

raw data

raw data

getArray

X

X

X

X

X

getRef

X

X

X

X

X

getURL

X

X

X

X

X

getObject

Boolean

BigDecimal

String

byte[]

RowId

getRowId

X

X

X

X

O

Whether supporting getter method for GOLDILOCKS Type - 3


DATE

TIME/

TIME WITH TIME ZONE

TIMESTAMP/

TIMESTAMP

WITH TIME ZONE

INTERVAL

getByte

X

X

X

Available only for a single item type

getShort

X

X

X

Available only for a single item type

getInt

X

X

X

Available only for a single item type

getLong

X

X

X

Available only for a single item type

getFloat

X

X

X

Available only for a single item type

getDouble

X

X

X

Available only for a single item type

getBigDecimal

X

X

X

Available only for a single item type

getBoolean

X

X

X

X

getString

O

O

O

O

getBytes

raw data

raw data

raw data

raw data

getDate

O

O

O

X

getTime

O

O

O

X

getTimestamp

O

O

O

X

getAsciiStream

raw data

raw data

raw data

raw data

getBinaryStream

raw data

raw data

raw data

raw data

getCharacterStream

X

X

X

X

getClob

O

O

O

O

getBlob

raw data

raw data

raw data

raw data

getArray

X

X

X

X

getRef

X

X

X

X

getURL

X

X

X

X

getObject

Date

Time

Timestamp

GoldilocksInterval

getRowId

X

X

X

X