I would like to be able to package my jpa-ejb-web project as a standalone application, by using Glassfish embedded API.
To use the JPA layer, I need to deploy the sun-resource.xml configuration, which should be possible with the asadmin command add-resources path\to\sun-resources.xml. I've this code to do it:
String command = "add-...
I did look at this and this but I dont think they quite answer my question.
I have a routine spring web application which uses a connection pool and I use a oracle.jdbc.pool.OracleDataSource. My datasource actually says,
<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource"
destroy-method="close">
<property name="URL"...
This SQL statement works if I run it from my Oracle client (SQL Developer):
insert into Person (Name) select 'Bob' from dual
It also works if I issue it via Spring JDBC, without using a KeyHolder:
final PreparedStatementCreator psc = new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(...
Hi all, Currently I am using statement.executeQuery(qStr) in java to select a large amount of data from mysql. Unfortunatly, java keeps running out of memory at the statement.executeQuery(qStr) statement with exception java.lang.OutOfMemoryError: Java heap space. I am wondering if there is a method to stream load data from mysql. So that...
I have a JDBC query like
select * from table1 where col1 between x and y
union all
select * from table2 where col1 between x and y
union all
select * from table3 where col1 between x and y
I'm using a prepared-statement and am wondering if there is a cleverer way to set x and y without saying setDate(1, x);setDate(2, y);setDate(3, x);...
I am losing precision in my ResultSet.getDate(x) calls. Basically:
rs = ps.executeQuery();
rs.getDate("MODIFIED");
is returning dates truncated to the day where MODIFIED is an Oracle TIMESTAMP field of default precision. I think there may be some JDBC tweak I'm missing; usually TIMESTAMP is compatible with DATE, but I'm hoping I don...
Hi,
I am connecting to a 4D (fourth dimension brand) database with its crappy jdbc driver.
I have a CLOB on the database and when I fetch it either through getString or getClob, I don't get line returns, everything seems to come in one line.
But, if I do do a select on NetBeans database explorer and I copy and paste the value on the ...
The Prepared Statement is a slightly more powerful version of a Statement, and should always be at least as quick and easy to handle as a Statement.
The Prepared Statement may be parametrized
Most relational databases handles a JDBC / SQL query in four steps:
1.Parse the incoming SQL query
2. Compile the SQL query
3. Plan/optimize the ...
i used this code in a small demo project.
but really whats the different between Jconnection package from shine pattern and the JDBC
package mypackage;
import org.j2os.shine.jconnection.*;
import java.sql.ResultSet;
public class Class1{
public static void main(String[] args) throws Exception {
JDBC mydb = new...
Hi, I am using simpleJDBCTemplate to insert a value to a postgre database.
String sql "insert into testTable values(:bla, :blah, functionThatTakesAText(':blu'))"
BeanPropertySqlParameterSource namedParameters = new BeanPropertySqlParameterSource(lighting);
simpleJdbcTemplate.update(sql, namedParameters);
Now, the blu parameter is actu...
I am using JSP to access Oracle 10g. One of the table includes a field with clob data type.
When it is retrieved with getString API and be assigned to String type, it gives an error (java.sql.SQLException: Conversion to String failed)
I found that it only happens if the Statement is prepared with parameter ResultSet.CONCUR_UPDATABLE (...
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<HTML>
<HEAD>
<TITLE> Test Run </TITLE>
<script>
</script>
</...
i have a "TEXT" type column in a sql database. I queried it with
ResultSet rs=db.execSQL(query);
String s=rs.getString("text_field");
creates and error. how should i use this text column in my java?
...
In my application, I perform a costly query that takes minutes to produce a report. I am trying to make a generic class that transforms a ResultSet to and Excel spreadsheet, where a column is excluded from the spreadsheet if it only contains nulls. I can remove the columns from the Excel sheet after the fact easily, but it is difficult...
I'm using JDBC (through Spring's JDBCTemplate) to access a small number of tables in a database. Although I haven't had anything happen yet, I'm concerned about the possibility of deadlock.
I was under the impression there was a way to specify a lock order for queries that access multiple tables for deadlock avoidance, but I don't know...
I'm working on a Flex/BlazeDS/Spring/JPA/Hibernate web application hooked up to a Microsoft SQL Server database. It seems to be locking the tables too aggresively. From my research, it looks like using the snapshot isolation policy is the best bet.
I've set things up as such:
<bean id="entityManagerFactory"
class="org.springf...
I get this error or my jsp page every day:
java.net.SocketException
MESSAGE: Broken pipe
STACKTRACE:
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(Sock...
We have an application provided by a third party which takes a stream of market data (provided by said third party), and writes it into a JDBC compatible database.
The only configuration parameters it has are the JDBC connection string, plus settings allowing us to pick what pieces of data we'd like to be stored in this database.
This ...
I'd like to write to my Oracle DB the user ID and IP address of the logged in user (web app) whenever I perform SQL UPDATEs and INSERTs. Such as
public static int updateUser(STKUser user, STKUser loggedIn) throws DAOException {
Connection connection = null;
connection = DB.getConnFromCache();
PreparedStatement ps = null;
String ...
I have a prepared statement call in java that calls a procedure that commits or rolls back a sybase transaction. Is there anyway I can check from my java calls the result of that transaction, ie. success for commit or failure for rollback?
Alternatively, I want to check that the procedure completed without errors - whats the best way of ...