SQL 2 « oracle « Java Database Q&A

1. Alter user password via jdbc. Problems with passes containing question marks    stackoverflow.com

I have a problem with altering a users password when the password contains a question mark char. I do not encounter this problem with any other char so far, it seems ...

2. Nested SQL Exception - iBatis error in parameter map    stackoverflow.com

Friend, I am using a hard coded select query in oracle with iBatis framework which is running perfectly. If i'm calling for the first time it is fetching the data to screen ...

3. Derby equivalent of Oracle CONNECT BY / START WITH    stackoverflow.com

I'm looking for a way to port an Oracle query that uses START WITH / CONNECT BY to Derby. Suggestions?

4. Database query in code    stackoverflow.com

I am using a sysdate query in code to obtain the last updated rows in the past 3 hours (should be configurable). The database runs in GMT timezone and the application ...

5. SQL query to find a row equalling a date in Toplink    stackoverflow.com

Really hate dates in Oracle but all I want to do is just to a basic query to find whether a row or rows that are equal to a date (the ...

6. Java date question using oracle10g    stackoverflow.com

I am trying to decode this little peice of java code (using an oracle10g database) from a left over program i am remaking in VB.net. Say i chose on the datepicker ...

7. Will Database omit incoming request since it is busy?    stackoverflow.com

In my application I have implemented a method to get favourits of particular user. If the user is a new one there will not be a entry in the table.If so ...

8. Java ResultSet: Does the DB only update if updateRow is called?    stackoverflow.com

In java.sql.ResulSet, can the updateObject, updateString, update[Type] methods update the underlying database without a call to updateRow()? Thanks,

9. convert SQL and binding data to straight SQL    stackoverflow.com

I have a custom Java query engine that produces a String of SQL (with ? as data placeholders) and a List of objects containing the data to bind to the placeholders. ...

10. Java doest run prepare statements with parameter    stackoverflow.com

If using PreparedStatement to query my table. Unfortunately, I have not been able to do so. My code is as simple as this :-

PreparedStatement preparedStatement = connection.prepareStatement(
"Select favoritefood from favoritefoods where catname ...

11. Using a java.sql.Timestamp object in an sql query    stackoverflow.com

I am trying to run a query in java that uses a java.sql.Timestamp object as the date to compare with in the where clause. Here is how the query string that ...

12. How to insert empty_clob() from java to Oracle    stackoverflow.com

I am having an NCLOB column in oracle. When I create a row, I need to insert an empty_clob() using normal java insert query. Does anyone know how this is done? ...

13. Oracle created in C or Java?    stackoverflow.com

So i've looked around online trying to figure out if Oracle(Database) was created in C/C++ or Java? I've gotten answers saying either or, but not a definite answer? seems like it should've been ...

14. Java: ResultSet getString() differs between environments    stackoverflow.com

I have a SQL query that is returning an oracle Date object. e.g. SELECT sysdate FROM DUAL There is code currently that does the following: String s = rs.getString("sysdate"); The problem is, this returns different date ...

15. How to execute Oracle Package (with parameters) using ANT SQL Task    stackoverflow.com

Hi I have an Oracle package in which I have to pass different file names - a.rdt, b.rdt etc

I saved the package into a SQL file and the file contains ...

16. Calling an Oracle stored procedure in Squirrel SQL    stackoverflow.com

I was able to create a stored procedure for an Oracle database, but now I can't figure out how to run it. I'm using SQuirrel SQL and this worked to create ...

17. With ojdbc6 getMetaData() on resultset spikes in number of sql's executed, dont see this with ojdbc5    stackoverflow.com

we use getMetaData() on every cursor returned from the oracle stored procedure call. With ojdbc5 we dont have spike in number of metadata sql's executed and average time. But with ojdbc6 we ...

18. Trouble with PreparedStatement that uses union of selects query and IN CLAUSE    stackoverflow.com

I wrote a query of the form:

select .... where x.y in (?) union select .... where p.y in (?) and a.b not in (?) 
The question marks indicate places where I ...

19. What is wrong with my SQL statement? Cannot Insert NULL    stackoverflow.com

What am I doing wrong? I keep getting weird errors from SQL?

   //get parameters from the request
 String custID=request.getParameter("cust_ID");
 String saleID=request.getParameter("sale_ID");
 String firstName=request.getParameter("first_Name");
 String mInitial=request.getParameter("mI");
 String lastName=request.getParameter("last_Name");

20. Why am I getting: [Oracle][ODBC][Ora]ORA-00904: invalid identifier    stackoverflow.com

Oracle keeps giving me an invalid identifier error when I clearly have identified the variable.

  //get parameters from the request
   String custID=request.getParameter("cust_ID");
   String saleID=request.getParameter("sale_ID");

21. Why do I keep getting this cursed SQL*Plus invalid identifier error?    stackoverflow.com

I keep getting a invalid identifier exception when I try to run the below script: javax.servlet.ServletException: java.sql.SQLException: [Oracle][ODBC][Ora]ORA-00904: "CUSTID": invalid identifier

   conn = DriverManager.getConnection("jdbc:odbc:rreOracle","xxxxxx","xxxxxxxx"); 

22. what does the following error mean: java.sql.sqlexception missing in or out parameter at index    stackoverflow.com

I get the following error when working on some JDBC code:

java.sql.sqlexception missing in or out parameter at index: 6
Can somebody explain what this means? More generally, is there a website/set of ...

23. SQL Exception while connecting to oracle 11g from web application using jdbc    stackoverflow.com

I am getting SQL Exception. The following is my code,

 public DBConnect()
      try {

24. sql developer cant use jdbc mysql connector    stackoverflow.com

I have installed Oracle SQL Developer 3 and I tried to connect to mysql database. I used tutorials, which told me to use mysql-connector-java-5.0.8.jar, so I attached it. But when ...

25. returning a result set from a java stored procedure through SQL "select * from "    stackoverflow.com

Can i get the result from a java stored procedure (oracle) directly through an SQL "select * from" statement ? On the database I would hava a java stored procedure function ...

26. how to convert the changes that I have done in a resultset to sql queries in java?    stackoverflow.com

I am comparing 2 resultsets, and I have to update one resultset according to the data in another. I can do this easily using updateRow (or insertrow, if required). But I ...

27. Oracle SQL inserting multiple rows and returning something    stackoverflow.com

In Oracle, one can insert multiple rows by doing a query like

   INTO mytable (column1, column2, column3) VALUES ('val1.1', 'val1.2', 'val1.3')
   INTO mytable (column1, column2, column3) ...

28. JDBC question: not being able to correctly bind variables and values (shortened)    stackoverflow.com

I'm working on a project that can be described as follows: The user will pass in a table name and some criteria. The program will then retrieve a table from Oracle ...

29. In which cases does a sql update statement return as no rows updated?    stackoverflow.com

In my application we are using the following code

if (m_ps.executeUpdate() != 1) {

30. Keeping search result consistent across multiple transactions    stackoverflow.com

I have to implement a requirement for a Java CRUD application where users want to keep their search results intact even if they do actions which affects the criteria by which ...

31. Running sql scripts from sqldeveloper vs from java code    stackoverflow.com

I am trying to run a few sql scripts in Oracle 11g R2 When I try to run these scripts from a standalone java code the query runs into 40 odd minutes ...

32. How to Pass java.sql.Connection in Oracle Pro*C    stackoverflow.com

My question is: In the past, the Pro*C programs use the database connection from the caller. But now, How can I pass the connection from Java to Pro*C, considering that the connection ...

33. get database views    stackoverflow.com

CREATE VIEW customer_ro (name, language, credit)
      AS SELECT cust_last_name, nls_language, credit_limit
      FROM customers
How do i get the names of the aliases(i.e ...

34. configuring Oracle SQL Developer for first use    stackoverflow.com

I am using Oracle SQL Developer application for the first time. After adding the path to java.exe, it starts well only to display the error "error while registering oracle jdbc diagnosability ...

35. Calling an oracle function from Java    stackoverflow.com

I have created a oracle function called getEmployee(id in varchar) in my remote database and I'm trying to call it from my local database using database link. In getEmployee, I'm trying to ...

36. java.sql.SqlRecoverableException while querying oracle cube    stackoverflow.com

I get the following error when I try to query a cube (based on Oracle Olap 11gr2) from a Java program java.sql.SqlRecoverableException: no more data to read from the socket. This error occurs ...

37. how to print out sql query that will be sent to oracle    stackoverflow.com

I would like to verify that the sql query I'm sending to Oracle is the one I actually want. I was wondering how do I do that? I can print out ...

38. How do I get an sql*plus connection for the oracle 11db that I downloaded on my computer yesterday?    stackoverflow.com

Okay, this is kinda infuriating. . . I can connect to the oracle database on a server in another city but I can't connect to the oracle database on my own ...

39. How do I generate random sample data in my Oracle database?    stackoverflow.com

Does anyone know of a tool that can inspect a specified schema and generate random data based on the tables and columns of that schema?

40. How to protect yourself against SQL Injection in dynamic queries?    stackoverflow.com

My application gets in a String object query to the database. E.g. String query = EMAIL like '% test%' and USER_NAME like '% user%'. The query is built dynamically and I ...

41. Am I closing this Oracle pooled connection correctly?    stackoverflow.com

I am attempting to use a pooled connection for my web application in Java. I am using an Oracle database and here is my code:

public class DatabaseHandler

    static ...

42. Anonymous block called via JDBC executes without error but does not run    stackoverflow.com

Probably missing something trivial here but I have a function in my Java application running on Oracle 10g which generates a bunch of insert and delete statements into a BEGIN...; END; ...

43. java.sql.SQLException: ORA-01438:    stackoverflow.com

java.sql.SQLException: ORA-01438: value larger than specified precision allowed for this column
ORA-04088: error during execution of trigger 'CARE_SLB.TRG_AFT_I_U_CATEGORY_MASTER'

44. java.sql.SQLException: ORA-01438:    stackoverflow.com

I'm inserting data in table through this query:

insert into CATEGORY_MASTER (
values ( 
  ( SELECT COALESCE(MAX(ct.cat_mas_id), 0)+1 

45. What is the name given to tables that hold static information    stackoverflow.com

I am working on a large project that contains many reference / look up type tables. This is maybe not the correct place to ask this question but I would like ...

46. Can some one tell me whats wrong with this query    stackoverflow.com

UPDATE trans_actual SET comment_id = ? 
            FROM trans_actual 

47. How to pass struct with array attribute from Java to SQL stored procedure?    stackoverflow.com

I have some types in Oracle.

create or replace
TYPE r_telefone_cand AS OBJECT (
    candidato NUMBER(10,0),
    telefone VARCHAR2(15)

create or replace TYPE t_telefone_cand AS TABLE OF r_telefone_cand;

create or ...

48. Multi count in single query - Oracle    stackoverflow.com

I need to count two data in same table for 2 time periods. I tried something like this:


49. Differing results for same select query in JDBC vs. SQL*Plus / Toad    stackoverflow.com

I have the following (example) query that I'm trying to run

SELECT some_field
WHERE date_field >= TO_DATE('2011-06-22', 'yyyy-mm-dd')
When I run this in SQL*Plus, I get a set of results, when I try ...

50. Export Sql query resultset to a comma separated file using JDBC    stackoverflow.com

I am polling a file from a unix directory , and creating a external directory using following command, and loading the data in the file as table. Later i am applying ...

51. How to store directory structure in Oracle sql using java    stackoverflow.com

I want to store Directory/tree structure to backend from java code. Any one can guide me which way is better to store tree structure to database, here tree structure is not ...

52. getString("daterow") returning different format from 10g to 11g    stackoverflow.com

I have a large legacy application which calls resultSet.getString(column) and the column it is calling on is the DATE format in Oracle. This code worked just fine with Oracle 10g ...

53. oracle sql hints pattern match using java    stackoverflow.com

I want regular expression to match the any of the following hints or others in the sql query in the java .

1. /*+ parallel */
2. /*+ first_rows  */
kindly let ...

54. Getting an exception ORA-00942: table or view does not exist - when inserting into an existing table    stackoverflow.com

I am getting below exception, when trying to insert a batch of rows to an existing table

ORA-00942: table or view does not exist
I can confirm that the table ...

55. Database: Can java.sql.Timestamp be stored in a oracle database?    stackoverflow.com

I wanted to know if java.sql.Timestamp can be stored in a oracle database. In teh oracle database the column type is TIMESTAMP? Sorry, i can not try it out myself as ...

56. Oracle DB : java.sql.SQLException: Closed Connection    stackoverflow.com

Reasons for java.sql.SQLException: Closed Connection from Oracle??

java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at ...

57. Connecting to an Apache Derby/JavaDB database using Oracle SQL Developer    stackoverflow.com

I've been trying to connect to an Apache Derby/JavaDB embedded database using Oracle SQL Developer but without much success. I've tried to create a new connection using the following JDBC URL: jdbc:derby:/path/to/file/database.derby;create=true which resulted ...

58. Simple way to run sqlplus script from java    stackoverflow.com

I've got sql file that contains sqlplus specific script: it includes / or ; as statement terminators, EXEC to execute stored procedures, etc. I need to execute this script from java (jdbc) ...

59. Why is While (rs.next()) statement ending after 1st iteration?    stackoverflow.com

I am using a SELECT statement to get data from a table and then insert it into another table. However the line "stmt.executeQuery(query);" is inserting the first line from the ...

60. ORA-00928: missing SELECT keyword when inserting data    stackoverflow.com

I am trying to insert data into database but I am getting this exception:

java.sql.SqlException:[Oracle][ODBC]ORA-00928:missing SELECT keyword

61. SQL conditional statement    stackoverflow.com

i'm trying to create a conditional statement in an ORACLE sql code I have a funtion in java that takes 2 parameters. getchildren(child1,child2)..this function's parameters are used to create a query statment

public ...

62. How to insert reference values in database using JDBC?    stackoverflow.com

I am trying to insert values into Oracle 10g database using the code below but its giving an error of "Missing Expression" on execution. I have to pass reference values into ...

63. How to use SQL Wildcard in PreparedStatement with variable    stackoverflow.com

On my web site, I need to perform a wild card query with a value provided by the end user. The best practice is to use a PreparedStatement mainly to ...

64. Support Oracle and Access data layers in Java    stackoverflow.com

Please note that I've searched and searched but I am not able to find an answer. I'm writing a Java application and I need to support both Oracle and Access databases. I ...

65. java user defined function in oracle using byte[]    stackoverflow.com

Given this table in Oracle

create table test (bytes raw(100), chset varchar2(50))
insert into test (bytes, chset) values (hextoraw('454647'), 'iso-8859-1')
or in MSSQL
create table test (bytes varbinary(100), chset nvarchar(50))
insert into test (bytes, chset) values ...

66. SQL Command not properly Ended    stackoverflow.com

Tried running a java method that runs this oracle SQL query

String query =
            "SELECT count(*) " +

67. 2nd time calling PreparedStatement is not working after closing connection    stackoverflow.com

I'm trying to execute 2nd time PreparedStatement, but it fails if I close DriverManager.getConnection the code:

public void getRates(String id) throws Exception, DBException {

        Connection conn ...

68. java.sql.BatchUpdateException: ORA-04091 on BEFORE INSERT TRIGGER    stackoverflow.com

I'm getting a curious error on a BEFORE INSERT TRIGGER, which I can't understand. Even after reading multiple questions posted here with similar problems.

failed to process "method": category_id = ...

69. Using insert in a select statement in SQL    stackoverflow.com

I have a table person with columns personID, firstName, lastName, DOB and sex. As I insert each record I auto increment the personID column with a sequence. I need that value ...

70. Return identity value from an insert in a generalized way in C#    stackoverflow.com

I'd like to be able to get the identity value back after calling an insert statement. I can do this now and it works fine with SQL server by adding SET ...

71. Inserting Clobs in Oracle with JDBC is very slow    stackoverflow.com

Hi i am trying to insert a clob using the jdbc, through a maven plugin. But it is taking about 10 minutes to insert. This is exceptionally slow, and ...

72. getting java.sql.SQLException: Closed Connection error    stackoverflow.com

I'm using JDBC to Oracle 10g database and getting Closed Connection exception. My Code actually reads one row of resultset and then perform some calculation on it and then add that result ...

73. getting java.sql.SQLException: Closed Connection when accessing large resultset    stackoverflow.com

Hello i have big data in my oracle 10g database and have to perform some calculations on every row of resultset. So i call a separate calculation class after fetching value ...

74. Java searching option    stackoverflow.com

I have drop down that has list of column name. When user selects column name and enters serach value i populate the page but I am trying to bring everything from ...

75. data inserted but still giving java.sql.SQLException: ORA-00942: table or view does not exist    stackoverflow.com

data is inserted into the table, however every time i run and check the console, below is line displayed in the console.

java.sql.SQLException: ORA-00942: table or view does not exist

76. Getting Timestamp results in java.sql.SQLException: General error    stackoverflow.com

I have a problem with fetching a timestamp from an Oracle database. The table is created as follows:

create table csi(start_time timestamp);
Then I selected the value as follows:
import java.sql.*;

public class hel

77. Java Desktop Application to Upload CSV Files to Database    stackoverflow.com

I'm working on desktop application (Extract Transform Load type of app) that requires uploading of large CSV files (about 6 GB) to a database using Java as front end and Oracle ...

78. Oracle error ORA-00971    stackoverflow.com

I'm getting an error when running the following SQL against oracle 10g (

UPDATE fx_datumvcompgeneric AS c
   SET mp =  (SELECT p.mp

79. Oracle error "SQL command not properly ended" (ORA-00933) for Java prepared statement    stackoverflow.com

I'm getting ORA-00933 when creating the following prepared statement for Oracle 10g ( using JDBC:

conn.prepareStatement("INSERT INTO fx_tv_date (id, mp, doc_id, effective, actual, stale, val) VALUES (?, ?, ?, ?, ?, ?, ...

80. Fetching Table Names from Oracle with Java?    stackoverflow.com

I'm working on a Java GUI project; in one of its property screen I use 3 comboboxes in order to get: first user chooses DB name, with this value 2.Schema names ...

81. ORA-00942: Table or view does not exist    stackoverflow.com

I am passing a select query from java, it works for all table but one of the table gets an error "ora-00942 table or view does not exist". I checked grant ...

82. valid SQL query fails using iBATIS    stackoverflow.com

I have a complex SQL query which works when I paste it into SQLDeveloper from the source code or the debug logs but fails to return results when using iBATIS 2.3.4. ...

83. How to create an oracle.sql.ARRAY object?    stackoverflow.com

This question is related to my original issue How to return an array from Java to PL/SQL ?, but is a more specific. I have been reading Oracle Database ...

84. Query runs on DB but throws exception in java    stackoverflow.com

I'm having some trouble executing a nested sql query. It works fine when i run it on TOAD (for Oracle DB) but when I try and execute the same query from ...

85. How to insert HTML into Oracle DB    stackoverflow.com

I got to insert HTML into a column of a Oracle DB table. I created the insert statement, and used apache commons StringEscapeUtils.Escapesql and StringEscapeUtils.EscapeHtml to try to insert that HTML. ...

86. Where do you get the sqlj libaries for java?    stackoverflow.com

I've been charged with writing a DB manipulator with java for a project.
My professor gives us material that says to use the sqlj library (Oracle I'm assuming?), but nobody explains where ...

87. How to access Informix DB using Oracle SQL Developer?    stackoverflow.com

I currently work with Oracle databases, but in a few weeks I need to start learning Informix. Are there any tools available for Informix, similar to Oracle SQL Developer or any extensions for ...

88. error calling stored procedure from java through callable statement    stackoverflow.com

I am writing a simple java program that calls a oracle stored procedure, but it doesn't work with callable statement. When I call that stored procedure on SQLDeveloper,


89. Insert many rows to Oracle Database very fast    stackoverflow.com

I need to insert many sql rows into oracle database very fast. IndexData is the class which contains save method to insert into oracle database.

while ((line = in.readLine()) != null) {

90. How to update Oracle Clob by using JDBC    stackoverflow.com

Normal way looks like this:

    pStmt = conn.prepareStatement("SELECT DETAILS FROM PROGRAM_HISTORY WHERE id = 12");
    rset = pStmt.executeQuery();
    Clob detailsClob= rset.getClob(1);

91. Performance improvement on a select query    stackoverflow.com

We have a table with around 2 billions of records. Simple select query also taking lots of time to fetch the records. We tried Indexing & partitioning options but didn't got ...

92. name is already used by an existing object    stackoverflow.com

In this code I am trying to delete the tables if they already exist every time I run the program, but the control is not going inside the if statements. table1 ...

93. How to use setCharacterStream to update Clob in Oracle?    stackoverflow.com

When I used the follow snippets to update Oracle Clob:

     String toBeUpdated = ""
     StringReader reader = new StringReader(toBeUpdated);

94. Oracle DBMS_CRYPTO.ENCRYPT initialization vector length for AES256    stackoverflow.com

Is there a minimum/max length for the initialization vector when using the DBMS_CRYPTO.ENCRYPT proc? I get the error below:

ORA-28817: PL/SQL function returned an error.
ORA-06512: at "SYS.DBMS_CRYPTO_FFI", line 3
ORA-06512: at "SYS.DBMS_CRYPTO", ...

95. Issue happened when union\minus on Oracle clob    stackoverflow.com

I have a table named "preference" which includes more than 100 columns in oracle,I wrote a little bit complicated SQL which need use keyword UNION/INTERSECT/MINUS to do a query. Take a simple ...

96. java.sql.SQLException: ORA-00928: missing SELECT keyword. when inserting record to DB using JDBC    stackoverflow.com

I get an error when I try to insert some rows to a db. so here is the code

try {
    String insertStmt = "INSERT into " +

97. How to track all queries submitted to Oracle DB from app server?    stackoverflow.com

Possible Duplicate:
Oracle: is there a tool to trace queries, like Profiler for sql server?
I am using JDBC to talk to Oracle. Are there any ...

98. Error while Calling PL/SQL function that returns cusor    stackoverflow.com

I want to retrive data from database and display it in java. So I created this function, which returns a cursor.

create or replace function std_getInfoFunc return types.cursortype 

99. Logic to calculate the number of the day of year which is not a holiday?    stackoverflow.com

What I Require :- To a DB table which has entry of all the days of an year with a flag "IsHoliday" with "Yes" if its a holiday and "No" if ...

100. How to execute sql file from java    stackoverflow.com

I have an ORACLE SQL sctipt with several queries and tables, and I wan to run that script from my java program at the starting of the program to ensure that ...