Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

savepoint not supported with oracle 8i

843859Sep 4 2006
when I am using the oracle thin driver I'm getting the following error
Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.supportsSavepoints()Z
at Svpt1.main(Svpt1.java:31)

but when odbc driver is used the

Checking savepoint support ...
Savepoint is not supported
Insert record(10, 'newregion1') ...
Establish savepoint 1 ...
Unexpected Exception null
java.lang.UnsupportedOperationException
at sun.jdbc.odbc.JdbcOdbcConnection.setSavepoint(JdbcOdbcConnection.java
:1713)
at Svpt1.main(Svpt1.java:49)

please tell me why this difference and how can I use savepoint with oracle 8i.

I'm using Oracle 8i and j2sdk1.5.0_06

import java.sql.*;
public class Svpt1
{
public static void main(String args[])
{
Connection conn = null;
Statement stmt = null;
int rows = 0;
try
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:gdn";
// Connect to the database
conn = DriverManager.getConnection (jdbcUrl, "srg", "srg");

// Create a Statement
stmt = conn.createStatement();

// Cleanup table to original state
stmt.execute("DELETE FROM employees WHERE ssn=10");

// Turn off the auto-commit mode
conn.setAutoCommit(false);

DatabaseMetaData dbmd = conn.getMetaData();

// Check whether Savepoint is supported
show("Checking savepoint support ...");
if (dbmd.supportsSavepoints())
show("Savepoint is supported");
else
show("Savepoint is not supported");

// Insert a new record into the "regions" table
show("Insert record(10, 'newregion1') ...");
rows = stmt.executeUpdate("insert into employees(ssn,name) values (10, 'newregion1')");
// Establish the first savepoint (named)
show("Establish savepoint 1 ...");
Savepoint svpt1 = conn.setSavepoint("svpt_1");

// Insert a second record into the "regions" table
show("Insert record(11, 'newregion2') ...");
rows = stmt.executeUpdate("insert into employees(ssn,name) values (11, 'newregion2')");

// Establish the second savepoint (named)
show("Establish savepoint 2 ...");
Savepoint svpt2 = conn.setSavepoint("svpt_2");

// Establish the third savepoint (unnamed)
show("Establish savepoint 3 ...");
Savepoint svpt3 = conn.setSavepoint();

// Insert a third record into the "regions" table
show("Insert record(12, 'newregion3') ...");
rows = stmt.executeUpdate("insert into employees(ssn,name) values (12, 'newregion3')");

// Check names and ids of established Savepoints
show("The name of txn savepoint 1 is: " + svpt1.getSavepointName());
show("The name of txn savepoint 2 is: " + svpt2.getSavepointName());
show("The id of txn savepoint 3 is: " + svpt3.getSavepointId());

// Rollback to the first savepoint
show("Rollback to savepoint 1 ...");
conn.rollback(svpt1);

// Commit the transaction
show("Commit the transaction ...");
conn.commit();

// Close the Statement
stmt.close();

// Close the Connection
conn.close();
}//try
catch(SQLException sqlexc)
{
show("Unexpected SQL Exception " + sqlexc.getMessage());
sqlexc.printStackTrace();
}
catch(Exception exc)
{
show("Unexpected Exception " + exc.getMessage());
exc.printStackTrace();
}
}//main
static void show(String mesg)
{
System.out.println(mesg);
}
}//class

thanks in advance.

Comments

Alex Grigor

We are using JDeveloper and ADF 12.1.3

Ashish Awasthi
Alex Grigor

I also found that approach, but I would like to know if there is more "classic" one. One provided by the Framework. I consider that one as being a bit of a "hack".

Thank you for the response.

Ashish Awasthi

if you expand all nodes then expand icon will not be visible on nodes that doesn't have any child

try setting initiallyExpanded property of tree to true


Ashish

Alex Grigor

Thank you Ashish,

Yes, I know that, but our requirements says that the tree must not be initially expanded.

Alex

Alex Grigor

I was thinking about a way to apply specific css classes for the each node and then using that class to override/remove the default icon. Something like this:

styleClass="#{node.childrenSize eq 0 ? 'ChildNode' : 'ParentNode'}" the problem is that i could only apply this classes to the <af:outputText /> and the icon is outside this component. Is there way to change the icon based on the css class?

Alex

1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 2 2006
Added on Sep 4 2006
0 comments
122 views