jdbc

How to store the data in a object array, which is collected from the Database.

Possible Duplicate: how to store the data in a object array, which collected from data base? The Below code will retrieve data from the database. i want to store the data in a pojo object. It will be appreciative if anyone demonstrate with the code or dont hesitate to edit my code. I want to know about the creation and implem...

Connection Pooling over New Connection instance per Thread (JDBC)

Hi, I am creating a multi-threaded application. However, I have experienced lots of unexpected behavior from my application when I have one connection object serving all threads. I am in a dilemma. Should I let every thread create, use and dispose its own connection object or should I use a connection pool? I have tried connection po...

oracle driver problems in WAS cluster env

I', using ojdbc14.jar to connect to Oracle 10g DB. While working on single machine i have to problem to connect to DB, but in cluster i got this exception: J2CA0036E: An exception occurred while invoking method setDataSourceProperties on com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl used by resource jdbc/OracleDSBS...

Can I have a mutex table in my database (Oracle) with just plain SQL?

I would like to have a table in my Oracle database whose rows act as locks. The table would have one column, a varchar, and my clients (Java processes over JDBC) would run statements to acquire and release locks. The acquire statement should check existence of a row with a given value and insert if not there. The statement should some...

Hibernate Cache and JdbcTemplate

Will the Hibernate caching(1st, 2nd, or Query) work when I use JdbcTemplate? I got to know that the caching is one of the advantage in using ORM instead of traditional JDBC. So, If I got to use Hibernate's JdbcTemplate, still can I enjoy the benefits of hibernate caching? ...

Access Chrome History through JDBC

Hi all, I'm trying to connect to the chrome history database (sqlite) via a java application and run some queries in read only mode. I'm using sqlite.jar but when I connect, I get the following error: org.tmatesoft.sqljet.core.SqlJetException: BUSY: error code is BUSY I know some applications can access the file without copying it first ...

Does the SQL Server JDBC driver support asynchronous operations?

From some googling, it appears that .NET supports asynchronous operations with SQL Server 2005+. Does the latest JDBC driver support this? I can't find a mention of it anywhere, so I'm thinking it probably doesn't. But I figured it couldn't hurt to ask. Thanks! Avi ...

Streaming ResultSet Error

I am trying to run multiple MySQL queries which build up on each other: i.e field value of one element in each row is used as input for another query. I end up getting the following error: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@174cc1f is still active. No statements may be issued when any streaming re...

PLSQL JDBC: How to get last row ID?

What's PLSQL (Oracle) equivalent of this SQL server snippet? BEGIN TRAN INSERT INTO mytable(content) VALUES ("test") -- assume there's an ID column that is autoincrement SELECT @@IDENTITY COMMIT TRAN In C#, you can call myCommand.ExecuteScalar() to retrieve the ID of the new row. How can I insert a new row in Oracle, and have JDBC g...

improving speed of query processing

hi, having major issues with my query processing time :( i think it is because the query is getting recompiled evrytime. but i dont see any way around it. the following is the query/snippet of code: private void readPerformance(String startTime, String endTime, String performanceTable, String interfaceInput) throws SQLException...

OracleCallableStatement registerOutParameter doesn't like named binding

this code gives "Incorrectly set or registered parameter" SQLException. Can anyone help please? OracleConnection conn = getAppConnection(); String q = "BEGIN INSERT INTO tb (id) values (claim_seq.nextval) returning id into :newId; end;" ; CallableStatement cs = (OracleCallableStatement) conn.prepareCall(q); cs.registerOutParameter("newI...

How do you LOAD TABLE in Sybase IQ from a client using Java?

Is it possible to load a file from a client computer into a table in Sybase IQ, using the LOAD TABLE ... USING CLIENT FILE statement? The data does not come from a database, but rather an external source. Can this be done using a JDBC driver in Java, and having the file only on the client computer? If so, how? ...

How can I limit memory usage when generating a CSV from a large resultset?

I have a web application in Spring that has a functional requirement for generating a CSV/Excel spreadsheet from a result set coming from a large Oracle database. The expected rows are in the 300,000 - 1,000,000 range. Time to process is not as large of an issue as keeping the application stable -- and right now, very large result sets c...

CallableStatement vs Statement

When calling a Stored Procedure with no arguments and no output is there any advantage to using a CallableStatement over a regular Statement or PreparedStatement? ...

Problem in connecting Oracle 11g through JDBC thin driver ( Domino Java )

Hi, I'm unable to connect Oracle 11 database remotely using following piece of code. However, same code works fine if I try to connect Oracle 9 database which is installed on my machine. What is missing ? ( I'm not getting any error, Lotus Notes hangs ) import lotus.domino.*; import java.sql.*; import oracle.jdbc.*; public class Jav...

Can someone help me with some beginners JDBC ?

Hi, As a C# developer new to Java, i thought it might be easiest if i simply show a bit of C# code so i can see what the equivalent Java JDBC calls are: String myConnectionString = "..."; String mySql = "select name from people where id = @myId"; int myId = 123456; List<Field> fields = new List<Field>(); using (SqlConnection conn = new...

Why do I get an ArrayIndexOutOfBoundsException in my JDBC connection?

I am new to Java and I am attempting to use JDBC to connect to an UniVerse database. I'm using Sun Java 6 JDK to using NetBeans to build the project. My simple test below builds however it gives the errors below: > run: driver loaded Exception in thread "main" java.lang.ExceptionInInitializerError Connecting... at com.ibm.u2.jdb...

JDBC & MySQL read performance

Hey, I really seem to have a big problem here. I'm using MySQL to store part-of-speech tagged sentences in a table. The Table looks like this: +------------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+------------------+------+-----+---------+-------+...

Beginner JDBC Result Set questions

New to using JDBC and I was wondering if all operations produce a result set. For example I am making statements to insert/update to a database via: StringBuffer query1 = new StringBuffer("UPDATE table SET col1 = value, WHERE some_col = some_val"); PreparedStatement pstmt1 = con.prepareStatment(query1.toString()); ResultSet rs1 = pstmt1...

Using SQL function in parameterized statement

Considering this query: insert (a, b, update_time) values (1, 1, now() - interval 10 second) Now, I need to convert it to a parameterized statement: insert (a, b, update_time) values (?, ?, ?) The problem is you cannot use SQL function in the parameter. How do I write this kind of code? ...