jdbc

JDBC driver unregisted when the web application stops

I am getting this message when I run my web application. It runs fine but I get this message during shutdown. SEVERE: A web application registered the JBDC driver [oracle.jdbc.driver.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered...

Handling MySQL datetimes and timestamps in Java

In a java application what would a good compromise in terms of extracing and inputting date information with a MySQL database using a mix of datetimes and timestamps? ...

JDBC, JNDI Problem with tomcat 6.0.26

Greetings, I am developing a webapp that requires setting up a DataSource with JNDI using Enterprise JDBC Classes.I am using the Netbeans 6.9 bundled tomcat (6.0.26 app) server with mysql 5.xx.The issue really is that I can still see the database values from a relation being displayed in my jsp page whereas during the tomcat initializati...

JDBC, INSERT MULTIPLE records obtained from query, into other table

I need to insert multiple records into mysql database at once. What I am doing is SELECT on one table, from my application with Prepared statement. What I must do is to insert those results into one other temporary table. String sqlquery = "select * from table1 where arg1 = ?"; PreparedStatement statement; statement = con.prepareStatem...

How to use the update statement in my jsp

Hello All, I am having an update statament in my jsp. The problem is that when I am changing the whole fields in the jsp and executed the update statament, the DB will be updated, but when I am updating a certain field, the other fields will be "" in the SQL statement. Also, I am having a problem is that I am having a miss match in the ...

Associating Postgres Connections with Java code

I'm trying to track down leaky connections. (In particular, I'm noticing connections staying open past the closure of the last DataSource, using C3P0 for connection pooling. I suspect a bug but want to ensure I'm not just being stupid first.) Is there a good way to associate open connections from the Postgres view postgres=# select ...

which database to use in Scala (and examples needed)

I am new to Scala. Which database connectivity is best supported in Scala? I am also looking for complete examples to access a database (authenticate, connect, query, extract result) I have a table MyTable with two columns (Value1, Value2) in a database MyDB, which I need to access. I have been thinking of postgresql, so some example...

How can I execute a stored procedure with JDBC / jTDS without using a transaction?

We run a website written in Java that uses JDBC with jTDS to access an SQL Server database. Our database contains a complex stored procedure that typically takes 10 minutes to run. The stored procedure works fine if we execute it directly (say from SQL Server Management Studio) because it does not run in a transaction. But if we execute...

Dao methods, manipulating single/multiple objects and closing resources

The usual advice is to close JDBC ressources once they're no longer needed. This could be done in a catch and finally. However, what if a DAO method only manipulates one domain object and an operation requires several of these to be retrieved/created in one go? Would getting a statement and then closing it repeatedly be an issue in terms...

java.sql.SQLData - Oracle object mapping problem

Hi guys, I am using java.sql.SQLData interface to map my java objects to Oracle database types. For example, I have an object type Person in Oracle DB defined as: CREATE OR REPLACE TYPE PERSON AS OBJECT ( PERSON_ID NUMBER, PERSON_NAME VARCHAR2(100) ); Corresponding Java type is: public class Person implements SQLData { ...

Java:how to pass value from class/bean to servlet

hi, i am new to java, i'm having problem passing value from a class/bean (which are stored in arraylist) to servlet. any idea how can i achieve that? below is my code. package myarraylist; public class fypjdbClass { String timezone; String location; public String getTimezone() { return timezone; } public void setTimezone(String t...

Invalid Cursor State on every query JDBC, Spring, Derby. Configuration problem?

Hello! I am just getting started with Spring (MVC,Webflow etc etc) and I am trying to write my own small web application. As a database I am using Apache Derby which I set up though the Eclipse Database Developer plug-ins. Now my problem: Everytime I fire queries through the JDBCTemplate I get an "Invalid cursor state" exception at ru...

JDBC communication link failure after some time

Hi, I am using JDBC with proxool connection pool to connect to mysql DB. I am selecting large number of rows from multiple threads and after some time i get an error saying communication link failure, Last packet sent to the server was ...ago. I am closing connection,statement,resultSet in every thread. The fetching time increases grad...

what's the default size of hibernate.jdbc.fetch_size?

We know by default, most of jdbc drivers' fetch sizes are 10. does anyone know what the default fetch size in hibernate, namely hibernate.jdbc.fetch_size is? ...

PostgreSQL JDBC - can drop but not recreate indexes

Hi, I've been searching for an answer, but no luck so far... I want to perform bulk operations on a database with potentially millions of records, reading the PostgreSQL guide: '13.4 Populating a Database' 1, it suggests removing indexes and foreign-key constraints to speed up the copy operation. I'm trying to accomplish this using JDB...

The topics that should be covered for learning JDBC

I have been asked to learn JDBC. I do not know where to start. I have started with some books. It's using some SQL tables (I am also new to SQL). So I want any of you to assist me that the topics that should be covered for JDBC. I also want to know how to creae a simple DB in Windows, so that database will be connected to my program. Wh...

Long type with SQLite and Zentus Jdbc driver

Hi there, I am using SQLite in Java code through Zentus. I need to map Java long primitive type in my database. For that I tried to create tables with the following statement: CREATE TABLE MY TABLE (...., LONG time, ...). Insertion into the database through Java with Zentus works perfectly but when retrieving the data, always through ...

Can I use multiple statements in a JDBC prepared query?

Hi, I'd like to execute something like this on my MySQL server: SET @id=(SELECT id FROM lookupTable WHERE field=?); (SELECT * FROM table2 WHERE id=@id) UNION (SELECT * FROM table3 WHERE id=@id) UNION (SELECT * FROM table4 WHERE id=@id); This works fine from the console, but not from my Java PreparedStatement. It throws an exception...

problem with insert data into DB by SqlReplacer?

I wanted to insert a row to my table and using SqlReplacer in org.j2sos.shine.jconnection.SQLReplacer I wrote this code but it doesnt work.anybody knows how to fix it? JDBC j = new JDBC(); if(j.login("oracle.jdbc.driver.OracleDriver","jdbc:oracle:thin:@localhost:1521:J2OS","username","pass",true)) { SQLReplacer rsql = new SQLReplacer();...

Does the setting time_out in mysql affect JDBC connection pool?

It's usually set to 60 seconds. But I think con pool will hold the connection, so is there any conflict? Thank you. ...