Hello here is what I want, I connect to a DB and retrieve the biggest element of the UniqueId column, and assign it to an integer variable named maxID, here is my approach:
int maxID = 0;
Statement s2 = con.createStatement();
s2.execute("SELECT MAX(UniqueId) FROM MyTable");
ResultSet rs2 = s2.getResultSet(); //
while ( rs2.next() )...
I have a ruby script which I run using the JRuby Interpreter.
The script connects to a Sybase database using DBI and Sybase JDBC (jTDS3.jar and jconn3.jar)
My problem is that I have a select query that alters the column names of table.
For example:
SELECT
t.TRANSACTION as 'business_transaction',
t.TRADE_CURRENCY as 'currency',
t.CURREN...
I am trying to use DBUnit with plain JDBC and HSQLDB, and can't quite get it to work -- even though I've used DBUnit with Hibernate earlier with great success. Here's the code:
import java.sql.PreparedStatement;
import org.dbunit.IDatabaseTester;
import org.dbunit.JdbcDatabaseTester;
import org.dbunit.dataset.IDataSet;
import org.dbuni...
To rephrase the question: should I avoid sharing instances of classes which implement java.sql.Connection between different threads?
...
Hi, i have an spring web application (on glassfish server) that use JDBC connection pool. It defined in XML file like this:
<resources>
<jdbc-connection-pool allow-non-component-callers="true" associate-with-thread="true"
connection-creation-retry-attempts="2" connection-creation-retry-interval-in-seconds=...
I am using Weblogic web server. Please let me know, how can i create a readonly JDBC datasource ,or should i handle this in my Java code ?
...
Using Spring 1.2.1 and oracle.jdbc.pool.OracleDataSource 10.2.0.3.0 I sometimes get a stack trace like below. I think it is caused by the connection pool being full. Does anyone know the cause for sure? Also do newer versions of spring or Oracle JDBC handle this better?
java.lang.NullPointerException
at org.springframework.jdbc.c...
I am trying to load the data in Oracle server remotely. I am doing "executeBatch()" for every 50 sqls that are added in batch. (thru JDBC)
What is the optimum number of sqls run in batch? Is it unlimited?
...
Java - Storing SQL statements in an external file
I am looking for a Java library/framework/technique of storing SQL statements in an external file. The support team (including DBAs) should be able to alter (slightly) the statement to keep them in sync in case database schema changes or for tuning purposes.
Here are the requirements:
...
I'm debugging a Java App, which connects to Oracle DB via a thin client.
The code looks as follows: (i'm trying to simplify the use case here so pardon me if t does not actually comile)
Connection conn = myEnv.getDbConnection();
CallableStatement call = conn.prepareCall(
"{ ? = call SomePackage.SomeFunction (?)}");
call.regist...
The topic has already been on the table in some previous questions. New elements come with new problems. I am seeking here for the best way to handle database connection(s), concerning aspects of : maintainability, performance, security and implementation. I must mention that i am not interested in abstractions like Hibernate, Spring, et...
I have an OSGi project that, among others, contains one bundle with JPA annotated domain models and another which uses Eclipselink as persistency provider. The latter instantiates the EntityManager using a configuration parameter to determine the JDBC driver's class name.
Now, the bundle with the models needs to be able to see the JDBC ...
I have to write a program that can take bookings, store them and then access them at a later time, the application has to be written in Java. Because of this i have been looking into various ways to use a database with Java.
I have been looking into using the JDBC with the mySQL driver database and also looking into the javaDB. What wou...
Is it possible to define a datasource connector in a Spring controller ?
I'm working on a tool : synchronize a source table to a target table.
I would define source and target in my controller (to synchronize different databases - in my view I can select different source and target databases).
Actually, I define my datasource in file c...
i am using jdbc to connect to a database server
the connection is over a wireless network and can be dodgy at times
at the moment when the connection is lost they need to close and restart the application
does anyone have some examples of code, where i could write some sort of wrapper to automatically reconnect and rerun the last query,...
Does anyone know how to connect to a Progress 9.1E database from a Mac (or even from Linux)?
I can connect successfully from Windows but the JDBC driver requires that the Progress install directory and it's bin directory are in the path.
It seems to be one product that is firmly under Google's radar. OpenLink has an OSX driver but it i...
i'm using JDBC to connect to SQL Server 2005 locally using integrated security. it's getting failed with the following error code
Error: 17806, Severity: 20, State: 2.
Logon SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed. [CLIENT: 127.0.0.1...
When trying to use DDLUtils it always seems to take over the id values for the columns that are set to autoincrement. How can I prevent this?
For example, I have a Dogs table with a column called ownerID. The column ownerID is set to autoincrement. However my list of owners is not continuous, there are gaps (for example, ownerID's 2, 4,...
We have an interesting problem:
We have a JMS queue of job statuses, and two identical processes pulling from the queue to persist the statuses via JDBC. When a job status is pulled from the queue, the database is checked to see if there is already a row for the job. If so, the existing row is updated with new status. If not, a row is c...
Hi,
My question is regarding ORM and JDBC technologies, on what criteria would you decide to go for an ORM technology as compared to JDBC and other way round ?
Thanks.
...