use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method statement_closed_execute_08.
/**
* Tests error cases for trying to execute things on closed statements
*
* @throws SQLException
*/
@Test(expected = SQLException.class)
public void statement_closed_execute_08() throws SQLException {
JenaConnection conn = this.getConnection();
Statement stmt = conn.createStatement();
stmt.close();
try {
stmt.executeUpdate("DELETE WHERE { ?s ?p ?o }", 0);
} finally {
conn.close();
}
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method statement_fetch_direction_01.
/**
* Tests for fetch direction settings
*
* @throws SQLException
*/
@Test
public void statement_fetch_direction_01() throws SQLException {
JenaConnection conn = this.getConnection();
Statement stmt = conn.createStatement();
Assert.assertEquals(ResultSet.FETCH_FORWARD, stmt.getFetchDirection());
conn.close();
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_unsupported_setters_12.
/**
* Tests for unsupported setters on prepared statements
*
* @throws SQLException
*/
@Test(expected = SQLFeatureNotSupportedException.class)
public void prepared_statement_unsupported_setters_12() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");
try {
stmt.setCharacterStream(1, null);
} finally {
stmt.close();
conn.close();
}
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method prepared_statement_bad_setters_11.
/**
* Tests error cases for setters on prepared statements
*
* @throws SQLException
*/
@Test(expected = SQLException.class)
public void prepared_statement_bad_setters_11() throws SQLException {
JenaConnection conn = this.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");
try {
// Invalid cast
stmt.setObject(1, new Object(), Types.FLOAT);
} finally {
stmt.close();
conn.close();
}
}
use of org.apache.jena.jdbc.connections.JenaConnection in project jena by apache.
the class AbstractJenaStatementTests method statement_warnings_01.
/**
* Check warnings usage
*
* @throws SQLException
*/
@Test
public void statement_warnings_01() throws SQLException {
JenaConnection conn = this.getConnection();
Statement stmt = conn.createStatement();
Assert.assertNull(stmt.getWarnings());
stmt.close();
conn.close();
}
Aggregations