jdbc

Getting the last inserted record id of a database table in java?

I have a database table A which stores records, A has a primary key (recordid) with auto_increment, each time i insert a record in to A, i get the inserted recordid and store it in another masterTable. I am using a select statement as soon i do an insert into A to get the recordid like this: select recordid from A order by recordid ...

Mysql session variable in JDBC string

hi, am using this connection string to connect to mysql from java: jdbc:mysql://localhost:3306/db?noDatetimeStringSync=true&useUnicode=yes&characterEncoding=UTF-8 is it possible to set the session variable in the string so that SET UNIQUE_CHECKS=0; would be executed upon connecting to server? the obvious jdbc:mysql://localhost...

Getting Number of Rows in a Group By Query with Microsoft Access

I have basically the same problem outlined in this question, however I am using Microsoft Access as a database instead of MySQL. The result of which is that SQL_CALC_FOUND_ROWS doesn't seem to be available to me. Believe me, I want to switch, but for the moment it is out of the question. I have a query that aggregates a number of ro...

Interrupt/Cancel a stuck connect() call

Sometimes when I call connect() on a third-party proprietary JDBC driver, it never returns and a stack trace shows that it is stuck waiting for a socket read (usually). Is there a generic way to forcibly cancel this operation from another thread? It's a blocking I/O call so Thread.interrupt() won't work, and I can't directly close the so...

JDBC Connection and Statement Classes

Since Connection and Statements are interfaces, interface methods will be abstract by default. How can we create Connection and Statement interfaces in our Java program while connecting to the database? ...

How to find out where a COMMIT might be happening?

I'm refactoring some code, converting a number of related updates into a single transaction. This is using JDBC, MySQL, InnoDB. I believe there is an unwanted COMMIT still happening somewhere in the (rather large and undocumented) library or application code. What's the easiest way to find out where this is happening? There must be s...

Index on date type column in oracle not used when query is run from java

Hi, i have a table containing 15+ million records in oracle. its sort of a log table which has a created_ts column of type "date" . i have a simple "non-unique" type index on created_ts column. i have a simple range query : select * from table1 where created_ts >= ? and created_ts <= ?; when i run this query from SQLPlus or SQ...

how to identify specific name attributes from an html select tag in a while loop into jsp

hi, iam retrieving data from the database using a while loop en pouring it out in table format as u can see below, along with a column that has a select tag included in the while loop,now the options for the select tag are;(pending and cleared),which at choice i want to use to update the respective database table,but the trouble is,when ...

How to initialize the SQLite3 JDBC driver in JRuby?

How do you access SQLite3 via JDBC without using active record? ...

How to correctly use ResultSet with h:dataTable

Hey there, The problem is, that after displaying the ResultSet with h:dataTable, the connection is left open. If I close it, it closes the ResultSet too. I'm thinking about copying the ResultSet data into some HashMap/ArrayList combo. Is there a good way to deal with this problem? Thanks in advance, Daniel ...

What is the JDBC equivalent to query an IBM Domino data store?

I need to query an IBM Domino data store that was populated using Lotus Notes from within a Java application. I am hoping that IBM followed the JDBC design pattern so that I can implement similarly to what I have done to get data from Oracle. Where should I start? I am aware that IBM does not support JDBC for Domino. What I need is...

pass ResultSet from servlet to JSP

Hi I am doing the following in my SampleServlet.java //Fill resultset from db ..... try { ArrayList Rows = new ArrayList(); while (resultSet.next()){ ArrayList row = new ArrayList(); for (int i = 1; i <= 7 ; i++){ row.add(resultSet.getString(i)); } Rows.add(row); } reques...

Unable to execute stored Procedure using Java and JDBC on SQL server

I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I use when setting up the stored procedure call in code I get an error stating that the stored procedure couldn't be found. I have provided t...

does android support JDBC

Hi all I know that on android there is android.database.sqlite package that provides helpfull classes to manage the internal android database. The question is - can i use the standard java.sql package to manipulate android's database without using anything from android.database.sqlite.* I try to open connection using sqlite JDBC driver...

Is JDBC a big memory hog?

I need to access (read in) data repeatedly from a database in my java codes, and therefore adopted JDBC. However, it seems to me that using JDBC takes up a lot of memory. I tried to be careful about closing the objects created for JDBC (ResultSet, Statemenet), but still it seems to hog a lot of memeory especially compared to reading in i...

MaxPooledStatements setting in JDBC oracle

Perhaps I'm retarded, but I can't figure out how to set MaxPooledStatements in Oracle using the Oracle thin JDBC driver. Could someone point me in the right direction? ...

Tomcat 6 can't find mysql driver

Hey, There is a similar question here but regarding the class path. http://stackoverflow.com/questions/1585811/classnotfoundexception-com-mysql-jdbc-driver I've had everything working great until some days ago. Suddenly my little application can't find the mysql driver. And i don't understand why (really I've checked everything) I got...

JDBC proxy to simulate a SQL view?

I need to be able to execute (via JDBC) a straightforward SQL select query against a view (the view can be generated via a fairly complex source query). Here's the catch: I don't have write access to the database, so I can't create the view there. Is anyone aware of a JDBC proxy that will let you define a view against the underlying da...

Using a java method to return multiple values?

I was just wondering whether or not there is a way to make a java method return multiple values. I am creating an application that uses the jdbc library to work with a database. Now, i can successfully enter values into the database but now i just need a way to return them and this is where im a bit stuck. I creating a form where the us...

variable column

I have a database in MS-Access which has field names as "1", "2", "3", ... "10". I want to select column 1 then when I click a button, column 2, column 3, ... and so on. How to do that? Actually i want to make a project in JSP. ...