result « SQL « Java Database Q&A





1. osql -S not giving me expected results    stackoverflow.com

I'm trying to write a program in Java that uses osql to generate a list of databases on a server. My code is as follows:

    public Object[] findDataBases(String ...

2. Result Set Problem    stackoverflow.com

It is possible to Use two query with in single ResultSet

3. How order results of SQL request according hierarchy level    stackoverflow.com

I the context of a Java application I am using SQLIte to persist some data. One of my SQL table has the following structure

CREATE TABLE containers (ID INT PRIMARY KEY, NAME ...

4. caching sql result set in java    stackoverflow.com

I know that caching the resultset of frequently used sql statements is better for the performance I am searching about the best way to cache sql result set in java. I ...

5. How to get the size of a result set in java.sql?    stackoverflow.com

I want to get the size of the resultset inside the while loop. Tried the code below, and I got the results that I want. But it seems to be messing ...

6. Error SQL in java: Illegal operation on empty result set    stackoverflow.com

I have a problem with an empty result set, which are throwing some errors. But it is working fine as long as it is not empty.

String sql = "SELECT M2.fromProfileId, profiles.profileMiniature, ...

7. Toplink bug. Empty result for valid sql with not empty result    stackoverflow.com

How is it possible? We are executing EJBQL on Toplink(DB is Oracle) and query.getResultList is empty. But! When i switched log level to FINE and received Sql query, that TopLink generates, i tried to ...

8. How to get all the result columns from database with other custom(concat, sum, count) columns in Jooq    stackoverflow.com

I have a table Table1 with 6 columns. Here is the sql statement that i need to map.

Select *,count(ID) as IdCount from Table1;
Now, the sql query result will be 7 columns ( ...

9. Strategy to map SQL results to java objects    stackoverflow.com

I am using JDBC (and spring-jdbc's jdbcTemplate) to access my database in a java web application. I have many different varying queries, some where I join to the table over there, ...





10. Which is more efficient in java using jdbc, results.getString(1) or results.getString("field_name")    stackoverflow.com

Is there's a noteworthy difference? I'm talking about a program that spends a lot of its time reading results from queries, and some runs (these are web hits) are taking upwards ...

12. java.sql.SQLException: After end of result set    coderanch.com

Hi all, I'm having a problem and I'm about to go insane. I use Apache/Tomcat/4.1.12 and Connector/J 3.0.6 to connect to a MySQL 3.23.55 Database server. For some very obscur reason, I'm getting an error on every second query using the same connection. The weird part is that the same query crash on the second time too Here's my code: Connection ...

13. Sql Result set processing    coderanch.com

I am using an SQL call to db2 to get the count(*) value from a query. I was going to use the getInt method to get the value of the count. I cannot use that method. I get the following error: The method getInt(int) from the type resultset is not static. What method should I use to get the value of ...

14. Putting SQL results into a java variable    coderanch.com

I have exhausted every resource at my disposal and have yet to find an answer to my problem. I am creating a simple applet for a small library in my community. It interfaces with an MS Access database. I have figured out how to query the database in jave, but I can't figure out how to take that information and put ...

15. SQL Results To Collection    coderanch.com

I am looking for the best way of storing a result of sql query results in a collection. The sql results look similar to the following: 100 Tg Sample1 101 Th Sample5 102 Tk Sample8 103 Tf Sample7 104 Ts Sample2 Would a multidimensional array be best for storing the results so that they can be extracted element by element when ...

16. SQL Results    coderanch.com

Hello, I want to display results in a sql in the format mentioned below. Category is a column in one table and answrs are in another table and id is the join to connect these tables. Category 1 Answr 1 Answr 2 Answr 3 Category 2 Answr 1 Answr 2 Answr 3 so forth.





17. "Store Locator" sql results    coderanch.com

I'm following this guide http://code.google.com/support/bin/answer.py?answer=87134&topic=11364 to help me create store locator functionality, but changing the code to java. I have not actually gotten to the part that i will need to change as it took me some time to automate the geocoder funcionality in js and then pass to the db. To test the Haversine sql code, i just tried it ...

18. simple MAX SQL returns wrong result (!)    coderanch.com

19. How to copy a SQL result into a Map    coderanch.com

Oh yes! I see what you mean. Run a query, get the first column, store the result in a map, then use that as key to get other values in another - say class or collection, where the Primary key equals the one in map. But the problem is one is probably gonna end up with few thousand lines to complete! ...

20. Error: java.sql.SQLException: After end of result set    coderanch.com

You should really focus on the code that throws the exception. Right now it looks like you are lumping a whole lot of different things into one big confusing ball of string. You have a JSP which generates a page. That page contains some Javascript which generates an AJAX request. And when the request is processed, there's an exception. (Is that ...

22. SQL operation against a cached result set    coderanch.com

Hi all, I would illustrate what I am trying to do with an informal pseudo-code ResultSet rs = db.query("select * from blah"); FooStructure fs = new FooStructure("foobar",rs); ResultSet rs2 = fs.query("select distinct column1 from foobar where column2='meh'"); In other words: is there such a class that does what FooStructure is doing? holding the content of a ResultSet in a structure that ...

23. No SQL result unless i reopen    coderanch.com

Hi = ) //Using MySql I have a replace statement that works, the only problem is if i run it, it does not display the change in the database unless i close mySql and re-open it. Any idea's on why this happens and how i could fix it? F5 does not refresh it, neither does ctrl + F5 Thanks //This is ...

24. java.sql.SQLException: Before start of result set    coderanch.com

Hello All, I am creating a simple servlet, which is retrieving a value from the database. i am using eclipse IDE. Here is the code. import java.io.IOException; import java.io.*; import java.sql.*; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Ex */ public class Ex extends HttpServlet { /** * */ private static final long serialVersionUID = ...

25. java.sql.SQLException: After end of result set    coderanch.com

dear fiend, I have this code: ResultSet rows = booktrading.BookBuyerAgent.GApoolDB1.selectGroup(agentNumber,buyerOrseller); if((rows.next())&&(matingCounter

26. jdbc sql exception as After end of result set for following code please help me    coderanch.com

resultSet2=statement.executeQuery(sql); if(resultSet2.next()) { PreparedStatement psIsPordChanged = connection.prepareStatement( "SELECT * FROM tbl_plcproducts"+machine_id " WHERE change_time BETWEEN DATE_ADD(NOW(),INTERVAL -8 HOUR) AND NOW()"); ResultSet rsIsProdChanged = psIsPordChanged.executeQuery(); if(rsIsProdChanged.next()) { int noOfProd = 0; float quantityPer = 0; float quantity = 0; rsIsProdChanged.beforeFirst(); while(rsIsProdChanged.next()) { ++noOfProd; float prodMultFactor = 0; float prodCycleTime = 0; String fromDate = null; PreparedStatement psGetData = connection.prepareStatement( "select * from ...

27. java.sql.SQLException: After end of result set    dbforums.com

I'm having a small problem with using the MySQL JDBC driver to retrieve the column contents of a ResultSet. the code I have is as follows: Code: String query = "SELECT * FROM users WHERE login = '" + userName + "' AND password = '" + password + "'"; System.out.println(query); Statement stmt; stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); int ...

28. Difference in the result returned by SQL DEVELOPER IDE and JDBC.    java-forums.org

i have checked and i am 100% sure that 1) db is same 2)user is same 3) query string is same. 4) java code counting is below int count=0; while(rs.next){ count++; } one more thing that caught my attention is i have made both odbc6.jar and odbc14.jar available to my project. i dont know which class is loaded from which jar ...

29. SQL find if no results are returned    forums.oracle.com

is bad. You should be using PreparedStatements instead. For a lot of reasons. One of the key ones being what happens with tag like "It's a flower" or something? Bad things with your code. also if you wouldn't mind fixing your spelling? It should be Photo_Location not Locaction. You'll have to post your updated code and tell us exactly where it's ...

30. Filter result set (My sql)    forums.oracle.com

31. How do I get SQL results to text, columns matching up, with data.    forums.oracle.com

Hi All, I have written a java application, that connect to a database, make a query, and return a resultset, that is then put into a LinkedList. The main aim of the application is that it should take snapshots of the database at certain intervals, and store a textfile per tableName, with this data. Therefore, I want to create a range ...