jdbc

Application to query a database and send results as file via HTTPS

I've currently got a tool which allows me to configure a database connection (using JDBC) and specify a set of queries to run against the database. This is scheduled to run at a specific time of day (using cron or windows scheduler currently). The tool then exports the results to a file (xml) and sends this file to my server via HTTPS. T...

Which JDBC jar should I use with java 1.5.0_16 and PostgreSQL 8.3.5?

Title says it all: Which JDBC jar should I use with java 1.5.0_16 and PostgreSQL 8.3.5? ...

Oracle SQL DATE conversion problem using iBATIS via Java JDBC

I'm currently wrestling with an Oracle sql DATE conversion problem using iBATIS from Java. Am using the Oracle JDBC thin driver ojdbc14 version 10.2.0.4.0. iBATIS version 2.3.2. Java 1.6.0_10-rc2-b32. The problem revolves around a column of DATE type that is being returned by this snippet of SQL: SELECT * FROM TABLE(pk_invoice_qry...

How do I make a Java ResultSet available in my jsp?

I'd like to swap out an sql:query for some Java code that builds a complex query with several parameters. The current sql is a simple select. <sql:query var="result" dataSource="${dSource}" sql="select * from TABLE "> </sql:query> How do I take my Java ResultSet (ie. rs = stmt.executeQuery(sql);) and make the results availa...

How can I enlist an ODBC connection in an XA 2PC transaction?

Our application uses ODBC to communicate with a database (Both DB2 and Oracle, if it makes a difference), and delegates business logic to Java by way of JNI (So it uses Java and C). What I'd like to know is what tools / software / libraries are needed to allow the business logic (Java/JDBC) and the application framework (C/ODBC) to part...

Java Statement Object Reuse?

I would like to know if we can reuse the same Statement object for executing more than one query. Or, should we create a new statement for different queries. For example, Connection con = getDBConnection(); Statement st1 = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); int i = st1.executeUpdate("updat...

combine 2 resultset

is there a way to add the results of 2 different queries to a resultset? something like that: ResultSet rs ; i=0; while(i<=l) ResultSet rs1 = select * from tablei; rs = rs + rs1; i++; } I know that I can do it with union, but I have a lot queries and if I use UNION the query is too slow. Any idea? ...

Can RowSets be used with PreparedStatements?

I have just found RowSets for database querying with JDBC. They are stateless and cacheable, they look to be superior to ResultSets. Can PreparedStatements be used with them though? PreparedStatements are a performance booster for querying very large databases, and not something I would want to give up (before something is said, this is ...

assigning a specific record in a ResultSet to a variable

Hi I want to retrieve a set of records from a database, do a rs.next() and then assign the result of this to a variable to pass to a method that will use this record, in the same way that I would without assigning it to a variable and passing it to a method is there any way to do this? I'm using JAVA (1.5) ...

Even easier Java/SQL data transfer needed.

So, I'm using jdbc to talk to a MySQL DB. For many a table and for many queries/views, I have created one class which encapsulates one row of the table or the query/table result. Accesses to the DB return one object of such a class (when I know exactly that there's only one matching row) or a Vector of such objects. Each class featu...

When using the latest jdbc driver for SQL Server 2005/2008 how do prepared statements, views, and stored procedures compare regarding performance?

When using the latest Microsoft jdbc driver for SQL Server 2005/2008 how do prepared statements, views, and stored procedures compare regarding performance? If I have a plain old select statement with some dynamic where clauses will I see benefits from moving from straight SQL in a prepared statement to a view or even stored procedure?...

Informix JDBC timestamp string format

I have Informix database with timestamp field defined as YEAR TO SECOND. When I show this field using JDBC rs.getString(column) it uses format with miliseconds so this field looks like: 2008-12-18 13:58:14.0 I would like it to use only YEAR TO SECOND fields. I set environment variable: GL_DATETIME=%Y-%m-%D %H:%M:%S but even then I go...

What are my options to store and query huge amounts of data where a lot of it is repeating ?

I am evaluating options for efficient data storage in Java. The data set is time stamped data values with a named primary key. e.g. Name: A|B|C:D Value: 124 TimeStamp: 01/06/2009 08:24:39,223 Could be a stock price at a given point in time, so it is, I suppose, a classic time series data pattern. However, I really need a generic RDBMS...

Java Prepared Statement arguments!

I am planning to replace repeatedly executed Statement objects with PreparedStatement objects to improve performance. I am using arguments like the MySQL function now(), and string variables. Most of the PreparedStatement queries I have seen contained constant values (like 10, and strings like "New York") as arguments used for the "?" ...

To upload an excel file as a clob

Could some one give an idea about how to convert an excel file into a CLOB in oracle through JDBC. I would like to know how to covert excel file into a String using API available as part of JDK and the conversion from string to clob should be straight forward. Thanks in advance. If a similar question was already raised, kindly provide me...

Are there any illegal characters when using named parameters in JDBC?

I'm using named parameters in a query to match fields in a map-like data structure. The data structure can have fields, or another map-like data structure. This nested structure is repeatable ad nauseum. I would like to name the parameters in the query using an XPath like language, that can be parsed to indicate further nested lookups. ...

Best Way to get XML from a JDBC resultset

I'm looking for the best approach to getting an XML document from a JDBC resultset. The structure of the XML isn't awfully important, but it should be fairly speedy. For clearification, I would like the data from the resultset and only enough metadata to identify the data (field names essentially). I'm working with MySQL, DB2, SQL Serve...

SQL Server connection management in Tomcat 6

We are having trouble with a Java web application running within Tomcat 6 that uses JDBC to connect to a SQL Server database. After a few requests, the application server dies and the in the log files we find exceptions related to database connection failures. We are not using any connection pooling right now and we are using the stand...

Flushing JDBC connection pools

Does anyone know the best (or any) way to flush a JDBC connection pool? I can't find anything obvious in the documentation. It appears connection pools aren't meant to ever be deleted. My current thought is to delete all DataSources from the hash we store them in, which will trigger our code to make new ones. However, my first attemp...

Running a Java Thread in intervals

I have a thread that needs to be executed every 10 seconds. This thread contains several calls (12 - 15) to a database on another server. Additionally, it also accesses around 3 files. Consequently, there will be quite a lot of IO and network overhead. What is the best strategy to perform the above? One way would be to use the sleep ...