jdbc

How to connect WebLogic jdbc data source to Oracle Database over SSL (and authenticate using certificate)?

WL=WebLogic 10.3 database=Oracle Version 10.2.0.2.0 - Production I have the database and WL up. I can create a new WL JDBC data source that successfully authenticates to the database, but how to do this using SSL? I've followed the following documentations: How-To Configure and Use Oracle JDBC Driver SSL with Oracle WebLogic Server S...

WSAD to SQL Server Connectivity Problem

Hi All, I am facing issues connecting to SQL Server 2008 from WSAD 5.1.2 ( WAS version 1.5.1.1 ). I am using Microsoft SQL Server 2005 JDBC Driver Version 1.2 on JRE 1.4.2 for the same as Driver Version 2.0 for SQL Server 2008 is not compatible on JRE 1.4.2. The database connection is being established but while retrieving the data I ...

Microsoft Access with JDBC: how to get the "caption" property of a given field?

Hi, at work we have to deal with several legacy databases stored in the Microsoft Access format. One of the informations we need to extract is the "caption" property of the fields on a given table. If we are using VB Script, this is quite easy, as you can see on the code above: set dao = server.createobject("DAO.DBEngine.36") set ...

Connecting to Informix 3.30 with SimbaServer middleware

I have a client that I'm trying to do some data migration out of an old route-accounting system for. The system has an Informix 3.30 database with SimbaServer middleware sitting on top of it. From what I gather, ODBC and JDBC support was not added to Informix until version 5.x, so that's out. Also, I have been unable to find the Simba...

Switching users on a JDBC Connection

I am writing a Java JDBC database application that connects to an Oracle 11g database and am using a c3p0 connection pool. For the purposes of an example, I have 3 database users DEFAULT, TOM, and BILL. c3p0 opens all of the pooled Connections with the DEFAULT database user. I would like to retrieve one of the pooled Connections from c3p...

Enumerate Open JDBC Connections?

How do I enumerate/count all open JDBC connections? I've seen this thread, which doesn't answer my question. My interest is in writing test code in which the object being tested (call it ConnectionUser) maintains its own connection. In my tests, I want to do things like verify that instantiating ConnectionUser doesn't open a connection,...

Postgresql, JDBC, and streaming BLOBs

I am trying to retrieve a blob from a postgres database using the jdbc drivers. It is too big to have in memory so I want to stream it as a download. I tried using the getBinaryStream method on ResultSet, but it turns out that this method actually reads it all into memory, so doesn't work for large file. Apparently, one can use the ge...

Is MySQL JDBC driver compliant with the JDBC spec?

Hi, I am using Connector/J 5.1.10 as the JDBC driver for my Database application (which uses MySQL). I have found that although the default ResultSet returned by a Statement is of type TYPE_FORWARD_ONLY, I am still able to safely call the previous() method on the ResultSet. I also looked at the source code (com.mysql.jdbc.ResultSetImp...

How can I access the database native java.sql.Connection?

I'm using WASCE as application server and defined a data source to PosgreSQL. I get the DB Connection from JNDI. The problem is I want to access specific method in the PostgreSQL java.sql.Connection but WASCE wrapped this connection with their own Connection. Specifically, I want to do something like this: ((org.postgresql.Connection)...

Does JDBC ResultSet getString always return a String representation ?

I'm formatting a ResultSet to output to a CSV file. As such I really don't care about the Java types of the result set, beyond maybe knowing if it's text or numbers. Does JDBC guarantee getString will always give a string representation of the values,atleast for single values (I don't need to concern myself about java.sql.Types.ARRAY,ja...

Sybase Stored Procedure ResultSet streaming?

I am certain that this is documented somewhere, but I can't seem to find it. Does anybody know if JDBC stored procedure results are streamed in Sybase? In particular, if I use a CallableStatement to call a Sybase stored procedure, is it possible for the Java code start to read rows from the resulting ResultSet before the stored procedu...

Caching a resultset

My app will retrieve a countylist from MySql using a datasource bean. Since all pages will potentially use the same recordset every time I could store the countrylist as a List in some global bean, safe in this case. I could manage to refresh the list any time I want... but when things become more complex what is the best strategy for it...

Oracle Thin Driver and Transparent Failover of RAC DB

I know the oci driver can perform transparent failover of the database, but does the thin driver have the same capability? ...

Is it an error of PostgreSQL SQL engine and how to avoid (workaround) it?

I'm parsing text documents and inserting them into PostgreSQL DB. My code is written in Java and I use JDBC for DB connectivity. I have encountered very strange error when adding data to DB - it seems that at unpredictable moment (different number of iteration of main loop) Postgres does not see rows just added to tables and fails to per...

Behaviour of ResultSet.TYPE_SCROLL_SENSITIVE

Hi, I am confused about the behaviour of a ResultSet that is of type TYPE_SCROLL_SENSITIVE. My understanding of this is - 1.) I execute a select query that returns me a result set. I print out the value of a particular column in the first row. 2.) I then execute Thread.sleep(10000), which halts the program for 10 seconds. 3.) While th...

How to manage a large dataset using Spring MySQL and RowCallbackHandler

I'm trying to go over each row of a table in MySQL using Spring and a JdbcTemplate. If I'm not mistaken this should be as simple as: JdbcTemplate template = new JdbcTemplate(datasource); template.setFetchSize(1); // template.setFetchSize(Integer.MIN_VALUE) does not work either template.query("SELECT * FROM cdr", new RowCall...

SQLException in JDBC

Hi, I am getting a SQLException when I try to run the query in Informix DB using JDBC. The query is huge in size: select * table_name where tableid in (....) I get an exception because the 'in' part contain more than 5000 values and because of the length. Is there a way to avoid this or should I break it down and run two queries? ...

Spring JDBC: How to create the tables?

Hi I am using Spring JdbcTemplate with the DAO pattern to access a database. Instead of creating the database tables manually, I am looking for a way to generate the tables in the DAO layer. I understand that I can use the jdbcTemplate to execute statements, I am only looking for the right place to do it. Is there a best practice for...

Failing to connect to oracle database

I'm trying to write a jruby script that connects to an oracle database using jdbc. Thusfar I've got: require 'rubygems' require 'jdbc_adapter' require 'active_record' require 'active_record/version' ActiveRecord::Base.establish_connection( :adapter => 'jdbc', :driver => 'oracle.jdbc.driver.OracleDriver', :url => 'jdbc:oracle...

Scala: Exposing a JDBC ResultSet through a generator (iterable)

I've got a set of rows in a database, and I'd like to provide an interface to spin through them like this: def findAll: Iterable[MyObject] Where we don't require having all the instances in memory at once. In C# you can easily create generators like this using yield, the compiler takes care of converting code that loops through the r...