jdbc

How do you set ANSI_NULLS off using JPA?

I'm trying to use one Named EntityQuery that will allow nulls in the Where clause using '=' Is there a way of setting ANSI_NULLS off or "set ANSI_NULLS off" in JPA the same way as in SQL? My JBOSS Data source file looks like the following: <?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>jdb...

multiple conditions in where clause

i am using mysql. this query is working fine: SELECT * FROM tablename where Date >'20091109' and id='11'; but below this query does not return any thing. SELECT * FROM tablename where Date between ('20091109' and '20081010') and id='11'; ...

connection cannot be made with derby client jdbc driver

im using Eclipse Helios Java EE IDE for Web Developers,Version: 1.3.0. connection with derby embeded jdbc driver is workin fine but i cannot make connection with derby client jdbc driver... what should i do to make it work,please help me... ...

How to handle parent key constraints in jdbc transactions?

Hi, I have 2 tables named T1 and T2. Where T1 is parent and T2 is child. The scenario is, I started a jdbc transaction and then insert a row in T1 and then try to insert a row in T2. Inserting row in T2 gies me "Integrity Constraint-Parent key not found" exception. How i handle this scenario ? Connection con; try{ con = ConnectionP...

compare resultset result with a variable

Hello All, I am having some difficulties in java while comparing between a variable and the next resultset. In my case, I want : if the temp variable = rs.next() then temp ="" else the rs.next() value should be displayed. This is because I am getting the Tname field many times, so I would like to retrieve it once. Here is my code wh...

Multi-user Datasources - Spring + Hibernate

Hi, I'm writing a web app that supports multiple users. Each user has their own database - using H2. all database schemas are the same. I wish to use Spring + Hibernate for this application. So I'm stuck at how to associate a user's database with that user - maybe associated it in the HTTPSession, and extend spring's AbstractRoutingDa...

Using jdbcdslog or log4jdbc with maven2

Hi all, I'm trying to use jdbcdslog or log4jdbc with maven2. - I want to log all SQL that is executed by mvn-sql. I installed slf4j-api (1.6.1), slf4j-log4j12 (1.6.1) and jdbcdslog (1.0.5) Jars to my local maven2-repo and configured in my pom.xml the following: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>sql-mave...

Read rows from a mysql table via java

I need sample code to read rows of data from a mysql table using java ...

Either possible? 1) Connection to Oracle 8i w/ ojdbc5 or ojdbc6 2) Multiple ojdbc jars

Hello, I'm building an application which is collating data from multiple data sources. Of these data sources, we have multiple instances of Oracle running. I find that the only way I can connect to my Oracle 8i instance is by using the ojdbc14.jar and the following: String driver = "oracle.jdbc.OracleDriver"; String url = "jdbc:orac...

Applying Oracle PL/SQL via JDBC

Is it possible to create/replace PL/SQL via the Oracle JDBC driver, i.e not via SQLPLus* ? Update 1: Driver: ojdbc14 (JDBC) Update 2: Change is being applied to oracle via Ant <SQL> task, which is passed a sql script file. In this instance using SQLPlus in the Ant script is not possible (long story). ...

SmartGWT RestDateSource and Paging (Large DataSet of) Dynamic Data

Hello I have a database table for log messages and at any time there can be inserted new rows. I want to show them in grid and when you scroll down I want to request more rows form this table (server side) but without to be affected from new added rows. The new rows only have to be visible if I refresh the whole grid. I'm not sure how ...

JDBC + statement.setEscapeProcessing(false)

Just want to know the exact effects of statement.setEscapeProcessing(false) as anywhere in documentation i am not finding proper explaination here are my questions 1) statement.setEscapeProcessing(false) will not any effects if we dont have escape clause in query . is this correct ? 2) If first one is correct why query modification ...

Where to keep large SQL queries when usuing Spring's JdbcTemplate classes

I'm developing a DAO using Spring JdbcDaoSupport and would like to know if anyone can suggest best practice for externalizing the SQL from the Java code. I'm used to using Hibernate and iBatis for this kind of project and like the way that the queries are not held in the Java code. Due to the complexity of the data access (accessing dif...

jdbc transaction management : when releasing resources and distributed transactions

hello i'm a beginner java developer and this is one question in a list i'm posting since i've started porting a very old web service . I'm trying to improve the access to db and i'm finding a lot of code i believe migth be dangerous, but being not so experienced with java i cannot be sure . Actually i've a class which manages the db conn...

Can't see JMX entries in jconsole when using Tomcat JDBC Connection Pool

Hi, we're evaluating switching over from the C3P0 connection pool to the Tomcat JDBC Connection Pool (as described here). It appears to work as a connection pool but I can't seem to see any JMX entries for it when I run jconsole. Out of the box C3P0 gives lots of operations and attributes via JMX, the Tomcat JDBC Connection Pool gives ...

Is there a way to determine that a Connection is managed?

I have some legacy JDBC code that is used within an EJB, in this code a call to setAutocommit() is made (which is not allowed for managed transactions, for understandable reasons). I would like to skip this method call if the code is used within a managed transaction, but let the call remain if used in an un-managed context. Is there a...

Specify IBatis query timeout

Hi, There is a way to specify IBatis query timeout using oracle jdbc and Java? Thanks ...

Java never recieves data from mysql

Hi Lately i have been having some trouble with connecting to mysql from java. Mostly everything works fine. But sometimes, the query takes forever, it is a pretty hard query and it should take about 10s. But it takes minutes without java recieveing the result from mysql. When i look in the processlist of mysql, it is sending data and blo...

JDBC - Resultset data processing : Strange behaviour : default fetchsize returned

I have a oracle(10.2) PLSQL procedure which fetches 15 records from a table in a sysrefcursor. I then pass this cursor to a java class as a resultset. This java class is loaded to oracle. Driver name : Oracle JDBC driver Driver Version : 10.2.0.1.0 Driver Major Version : 10 Driver Minor Version : 2 Observations: 1 Inside the java clas...

glassfish connection pool additionnal delay while re-creating after idle timeout

Hi, We are currently deploying some applications on a glassfish 3.0.1 using a postgres database through postgresql-9.0-801.jdbc4.jar Our actual configuration regarding the connexion pool is : Idle Timeout : 120 seconds Max Wait Time : 60000 millisecondes Initial and Mimimum Pool Size : 1 Maximum Pool Size : 1 Pool Resize Quantity : 1 ...