Skip to content
Advertisement

Tag: sql

unknown database in jdbc

I am using JDBC and new to it. but I keep getting this runtime exception: Here is the gave code how do I get this code to work? I am only a beginner with JDBC…. for the above code; PASS = “passowrd”, USER = “root” I had a problem with port which it was fixed through this site thanks a

Hibernate faster EntityManagerFactory creation

In my desktop application new databases get opened quite often. I use Hibernate/JPA as an ORM. The problem is, creating the EntityManagerFactory is quite slow, taking about 5-6 Seconds on a fast machine. I know that the EntityManagerFactory is supposed to be heavyweight but this is just too slow for a desktop application where the user expects the new database

ResultSet getFetchSize() doesn’t seem to work?

I’m having trouble with the getFetchSize() function. I simply need to know if the SQL query has returned zero rows. I’ve tried this simple statement: where rs is of the ResultSet type. The above code doesn’t seem to work. It always prints the message whether rs is empty or not. I checked the SQL query itself and it correctly returned

What type of data structure should I use to hold table rows?

I’m new to Java and just getting into querying databases. So far I have my results in a ResultSetMetaData. I’m think that for each row in the dataset I should add it to some form of collection? Can anyone tell me the best practice for this? Thanks, Jonesy Answer Usually we have a class with fields that correspond to a

java.sql.SQLException: Exhausted Resultset

I get the error java.sql.SQLException: Exhausted ResultSet to run a query against an Oracle database. The connection is via a connection pool defined in Websphere. The code executed is as follows: I note that the resultset contains data (rs.next ()) Thanks Answer I’ve seen this error while trying to access a column value after processing the resultset. Hope this will

How to monitor slow SQL queries executed by JPA and Hibernate

Is there any Hibernate property I could set to see all the slow queries? I’, interested in queries that take too much time to return the result set. I’m using Spring with Hibernate, configured via an applicationContext.xml Spring configuration file. Answer I have 2 suggestions: you could use Oracle’s Statspack. you could use some kind of JDBC proxy driver logging

What are all the possible values for SQLException.getSQLState?

SQLException.getSQLState retrieves the SQLState for the SQLException object. What are all the possible values that can be returned by this method? Can I use the value to identify specific errors that occurred in the database (i.e. can this value tell me if it was a PK violation, or a unique constraint, or column value too large, etc.)? Also, the DatabaseMetaData.getSQLStateType()

Advertisement