I have a Java application decoding a UTF-8 encoded String received over the wire and saving it to a varchar column in my database (SQL Server 2000). I am saving the record using JDBC's CallableStatement (calling the setString method to set the parameter for this column).
The problem I'm seeing is that a particular String has been writt...
Basically, I want a way to access sequence values in a database-neutral way.
The use case is that I have a field on an entity that I want to set based on an incrementing value (other than the id).
For instance, say I have a Shipment entity. At some point after the shipment gets created, it gets shipped. Once it gets shipped, a manife...
Hi,
I get the following exception at times:
com.ibm.db2.jcc.b.gm: [jcc][t4][2030][11211][3.50.152] A communication error occurred during operations on the connection's underlying socket, socket input stream,
or socket output stream. Error location: Reply.fill(). Message: Connection reset. ERRORCODE=-4499, SQLSTATE=08001
The proble...
The following pseudocode works, which is probably no surprise to anyone who's done any JDBC work:
ResultSet rs = foo.executeQuery();
boolean hasNext = rs.next();
while(hasNext) {
bar();
boolean hasNext = rs.next();
}
ResultSet (java.sql.ResultSet) is an interface, so there should be no implementation for next(), only a method ...
I'm using Oracle's JDBC thin driver (10.2.0.3) for connecting to an Oracle 10g database. I'd like to get information about the database columns, so I use ResultSetMetaData. The most important information I need is the type of the column and the length, so I use getColumnType, getPrecision, and getScale methods.
It works for a simple que...
I'm basically using a direct connection, no pooling.
thanks.
...
When I execute the following query on a database containing a table "comm_list" and a field "sr_no" of type "Int" in the table "comm_list", I get the correct resultset
SELECT MAX(sr_no) FROM comm_list;
The above query is to get the max. serial no. so that when I enter a new record, I enter the (serial no. + 1) in the "sr_no" coloum so ...
I have stored various records in the MySql database "orkut". Now I want to sort that database through a java program. I have connected to the database through the jdbc driver.
Now I want to sort that database in decreasing order of the field "number" of type "int" but don't know the commands. I have "con" reference variable which denotes...
Hi,
I'm looking for a way to open an Access MDB file inside a Java App (using JDBC).
A quick Google Search suggests that I need the JDBC-ODBC Bridge for this...
Does this mean that I need to configure every system I want to run my app on to provide a ODBC DSN for the MDB I want to open?
And one more question (since I've never used OD...
Need some help regarding jdbc metadata.
I am using ResultsetMetaData to get metadata of columns of a table on Oracle10g. I am using ojdbc14.jar. There is a field in table ID declared as Number . This field is being read with jdbc at runtime to get its metadata attributes. ResultSetMetaData.getColumnClassName() is returning java.math.BigD...
When I execute a query from my application (Java JDBC), it is returning the row with seq 83 first. But I want the row with seq 84.
seq | dtCreated |
84 | 2009-09-14 16:16:23 |
83 | 2009-09-14 16:16:23 |
82 | 2009-09-14 16:15:01 |
Is this query correct ? I'm interpreting this to mean that if there are ties in dtCre...
Moved a bunch of databases from sql server 2000 to 2008. One of the
applications is on JBoss 3.2.2 and is now failing to connect to the
database. The particular error is "The incoming tabular data stream
(TDS) remote procedure call (RPC) protocol stream is incorect.
Parameter 1 (""): Data type 0x38 is unknown."
I looked around google for...
I was researching some JDBC Oracle Connection Pooling items and came across a new(er) Oracle Pool implementation called Universal Connection Pool (UCP). Now this uses a new class, PoolDataSource, for connection pooling rather then the OracleDataSource [with the cache option enabled]. I am debating whether to switch to this new implemen...
I am doing a database migration work. I have to copy a database in MSSQL to MySql database. It was possible to come up with a small java utility to copy table stucture from MSSQL to MySql Database. Now i have to copy all data from MSSQL to MySql. I tried using resultset in java to obtain all data from a table but then it could only fetch...
I'm developing Java apps on Tomcat 5.5 using JNDI to connect to shared dbcp connection pools with JDBC 3.0 drivers and DB2 8 on zOS and also DB2 9 on LUW. In my app, I use org.springframework.jndi.JndiObjectFactoryBean to get the dataSource and feed it into an org.springframework.jdbc.core.simple.SimpleJdbcTemplate to run the queries. ...
We are using Spring SimpleJdbcCall to call stored procedures in Oracle that return cursors. It looks like SimpleJdbcCall isn't closing the cursors and after a while the max open cursors is exceeded.
ORA-01000: maximum open cursors exceeded ; nested exception is java.sql.SQLException: ORA-01000: maximum open cursors exceeded spring
The...
I've noticed that prepared statements containing ROW_NUMER() code often gets recompiled although their SQL-code hasn't changed.
(example from book Inside Microsoft SQL Server 2008: T-SQL Querying):
WITH SalesRN AS (
SELECT
ROW_NUMBER() OVER (ORDER BY qty, empid) AS rownum,
empid,
mgrid,
qty
FROM
dbo.SalesOrder
)
SELECT
r...
i have a java program that is calling a Mysql stored procedure that is rolling back when it gets an SQLException. When i added the rollback (exit handler) to the store procedure the java program stopped getting the sql exception. i need for the java program to get a sql exception and the error message from mysql.
does any one know how...
What is the difference between setting statement fetch size in JDBC or firing a SQL query with LIMIT clause?
...
I have a j2ee webapp that's being used internally by ~20-30 people.
There is no chance of significant growth in the number of users.
From what I understood there's a trade-off between opening a new DB connection for each request made to the webapp (expensive, but doesn't block other users when the DB is in use), to using the singleton ...