jdbc

Overcomplicated oracle jdbc BLOB handling

When I search the web for inserting BLOBs into Oracle database with jdbc thin driver, most of the webpages suggest a 3-step approach: insert empty_blob() value. select the row with for update. insert the real value. This works fine for me, here is an example: Connection oracleConnection = ... byte[] testArray = ... PreparedStateme...

Spring JDBCTemplate Table Locking with MySQL

Hi! I just migrating one of our applications from pure JDBC to Spring's JDBCTemplate. I was wondering how to create a write lock for a table. Do i just execute a "LOCK TABLE foo" Query or is there a generalisized way for doing this in JDBCTemplate? Thanks! ...

Java ResultSet how to check if there are any results

Resultset has no method for hasNext. I want to check if the resultSet has any value is this the correct way if (!resultSet.next() ) { System.out.println("no data"); } ...

Options to Replicate Microsoft SQL Server Database to MySQL/PostgreSQL on Linux

I need to replicate data from Microsoft SQL Server to MySQL or PostgreSQL. The data includes images stored in BLOB columns. Could you please comment on your experiences with the following strategies and suggest others I may have missing? custom script written in Java using JDBC linux odbc driver with perl script Setup my own windows ...

Crystal Report DB authentication in java

Dear All, I'm facing a problem in Crystal Report with Eclipse. I am using a servlet to render the crystal report viewer by writing the viewer object to the response like: public class ReportViewer extends HttpServlet { @SuppressWarnings("deprecation") public void doGet(HttpServletRequest request, HttpServletResponse response) ...

statements in jdbc

does statement object contain the session id the database returns for the current session? What does a resultset contain? ...

What is the Python equivalent to JDBC DatabaseMetaData?

What is the Python equivalent to DatabaseMetaData ...

Easy way to fill up ResultSet with data

Dear All, I want to mock a ResultSet. Seriously. I'm refactoring one big complicated piece of code which is parsing data from ResultSet, and I want my code to behave identically. So, I need to write a unit test for the piece being refactored to be able to test this. After googling I came up with 2 ideas: Use EasyMock, write looooong ...

Troubleshooting consistent "SQLException: Lock wait timeout exceeded"

I have an application running Quartz 1.6.1 w/persistent job store, with MySQL 5.1 as the DB. This application used to boot up okay in Tomcat6. At some point, it began throwing the following exception upon EVERY boot: - MisfireHandler: Error handling misfires: Failure obtaining db row lock: Lock wait timeout exceeded; try restarting tran...

JDBC Dates Deprecated in Java (java.sql package)

Hello, I am working with JDBC and MySQL. I have a date column that I need included in my result set. Unfortunately, I cannot find a class in Java to retrieve the date. The SQL Date class is deprecated. How do you get Date objects from a result set? ...

Connection attempt failed in postgreSQL server

hi all, In our project we are using postgresSql(8.3) as the database server, but we are rarely facing problem (once a while) . in the log file i am seeing error Like ****Connection attempt failed**** it means for me that , application is attempting to get connection object from the DB server but it was unsuccessfull. Strange t...

Help needed in java stored procedure with OUT parameter for MYSQL

I want to create a java program for connection with mysql database I want to use stored procedure with 1 out parameter and 1 in parameter How to retrieve result using java Is there any working example? Thanks, Deepak ...

Performance problem on Java DB Derby Blobs & Delete

Hi, I’ve been experiencing a performance problem with deleting blobs in derby, and was wondering if anyone could offer any advice. This is primarily with 10.4.2.0 under windows and solaris, although I’ve also tested with the new 10.5.1.1 release candidate (as it has many lob changes), but this makes no significant difference. The prob...

how to do hibernate mapping for table or view without a primary key

Anyone knows how to do hibernate mapping for table or view without a primary key? thanks. ...

Extracting time zone from Oracle JDBC TIMEZONETZ object

Is there a way to extract timezone information directly from an oracle.sql.TIMESTAMPTZ object (selected from a TIMESTAMP WITH TIME ZONE column)? Ideally, I'd like to be able to pull the time zone information directly out of the object without jumping through potentially expensive or fragile hoops (like converting things into strings and...

How to ignore all erroneous statements and execute all good ones in JDBC executeBatch?

I have java.sql.Statement with lots of batch statements added with addBatch. Executing executeBatch will throw BatchUpdateException after first statement which violates database constrains and won't execute all remaining statements in batch. Is there any way I can execute all statements in batch ignoring erroneous ones? ...

Strange problem with JDBC, select returns null

Hello everybody. I am trying to use JDBC and my query is working in some cases but not working in others. I would really appreciate any help. Some of my code: public Result getSpecificTopic() { String query = "Select msg_body, msg_author from lawers_topic_msg";// where msg_id=2 order by msg_id desc"; try { ...

How to use genxmlquery function of informix using JDBC?

I have the need to extract result of the database query in XML format. I have planned to use JDBC as my programming language. I came across the XML publishing function of IDS 11.0 and planned to use that. Have configured the database settings to perform XML publishing and am able to execute a query in command prompt (dbaccess databasenam...

How do I connect to an Access database over a LAN using Java?

Do you know of any good guides on how to access an Access database using Java? I know the basics and basic SQL, but I'm thinking more about access control. ...

Instantiating Oracle Driver results in InvocationTargetException

I have a simple web service that uses an oracle database. When I test the service internally it works fine, however, calling the web service through my client (on the same machine but in a different WAR) throws an invocationtargetexception. I've finally discovered it's an issue with instantiating the OracleDriver. It doesn't throw any...