I have a problem with closing a connection to MySQL. I’m getting the error: java.sql.SQLException: Operation not allowed after ResultSet closed My code: public static ResultSet sqlquery (String …
Tag: jdbc
How do you get values from all columns using ResultSet.getBinaryStream() in jdbc?
How do I to write an entire table to a flat file (text file) using jdbc? So far I’ve attempted the following: Statement statement = connection.createStatement(); ResultSet result = statement….
Execute native sql with hibernate
I’m using hibernate 4.2.6 and PostgreSQL 9.1 I’ve been trying to execute sql query with hibernate. I’ve written: Session session = Hibernate.util.HibernateUtil.getSessionFactory().openSession(); …
What is type 1,2,3 or 4 of a JDBC Driver?
To connect to a database using Java, most of us use JDBC API. We normally include driver like ojdbc14 (Intended for Java 1.4) in class path, and in program we use Class.forName to use it. Unlike …
Getting a date from a form and saving into database and listing products
I’m trying to create a page which can list products which are saved in the database and then the customers can view the list of products that are available.The problem I am having is with the date in …
ORA-00928 missing SELECT keyword in Oracle
I’m using the following code to insert data. But I’m receiving an error as “ORA-00928: missing SELECT keyword” try { Class.forName(“oracle.jdbc.driver.OracleDriver”); java.sql.Connection conn = …
How to process 0000-00-00 date in jdbc MySQL query
I’m getting this exception: java.sql.SQLException: Value ‘0000-00-00’ can not be represented as java.sql.Date Originating from this code: Date internalDate = rs.getDate(idx++); Where rs is a …
Passing Date from an HTML form to a servlet to an SQL database
I have a problem getting an inputed date (yyyyMMdd) from an HTML form to a sql database via a servlet. The date from the form passes to the servlet as a string but then somehow I need to convert it to date for storing in the database. I have tried a number of methods, date formatter etc.. A possible way
Map database type to concrete Java class
Background Map a column data type to its corresponding Java class. Problem A query returns meta information from a database: For example, this query returns (the self-referential): Where ‘dictionary’ is the schema name, ‘resource_bundle’ is the object_name, and ‘column_name’ is the column_name. It would be great to do something like: And have this query return: Then use JDBC to discover
Finding the actual Job number for a particular JDBC SQL connection to iSeries?
I am using the JTOpen JDBC driver to connect to the iSeries (aka AS/400, IBM System-i, IBMi, WTH?!…). I am having problems with a particular statement and it appears I need to go back to the actual SQL job QSQSRVR (or QZDASOINIT?) to find more details. Only problem is that there are hundreds of these on the system. Is there