jdbc 1 « SQL « Java Database Q&A





1. tool for detecting non-parametrized sql in java jdbc code    stackoverflow.com

I'm looking to inspect SQL statements in Java/jdbc code to ensure that the SQL to be executed is of acceptable quality. Neither PMD not Findbugs appears to have JDBC or sql ...

2. AS400 style naming over JDBC    stackoverflow.com

Is there any way I can use AS400 style library/file style naming over JDBC with jt400? I want to be able to run queries like:

SELECT * FROM MYLIBRARY/MYFILE
Thanks

3. jSecurity JDBCRealm SQL setup    stackoverflow.com

I am trying to use jSecurity for an enterprise java app, but the documentation is...well...lacking. Has anyone out there in SO-land been able to get the JDBCRealm setup, and if so ...

4. SQL logging in Websphere 6.1    stackoverflow.com

I am looking for a tool that Logs SQL statemetns fired in the application as I use the application. I found p6spy. But there is an issue with that. It doesnt seem ...

5. Java 6 Source backward-compatibility and SQL    stackoverflow.com

My understanding is that in order to maintain source-compatibility, Java never introduces new methods to public interfaces, as that breaks existing clients implementing the interfaces. Java Release notes ...

6. When is faster to use batch operations on JDBC?    stackoverflow.com

I have a piece of code that executes about 500,000 inserts on a database. It's now done in a loop calling PreparedStatement's executeUpdate at each iteration. Would it be faster to ...

7. JBoss 3.2.2 and JDBC upgrade    stackoverflow.com

Moved a bunch of databases from sql server 2000 to 2008. One of the applications is on JBoss 3.2.2 and is now failing to connect to the database. The particular error is "The ...

8. Recommendation for JDBC SQL client tool    stackoverflow.com

Can someone recommend a good, open source, standalone developer tool for querying SQL databases using JDBC and exporting the results to a file? I know a lot of database vendors provide ...

9. JDBC proxy to simulate a SQL view?    stackoverflow.com

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: ...





10. how can we use prepareStatement()?    stackoverflow.com

I use prepareStatement() when the id is a key of my SQL table and it will be created by SQL and I want to use this statement :(what should I write ...

11. Best practices on cache implementation    stackoverflow.com

I would need to implement cache, which would need to perform SQL queries and cache results. So, I would love to read something about best practices of doing that; how do ...

12. sql delete lock    stackoverflow.com

I execute a query in JDBC

delete * from mytable where ...
I got:
java.sql.SQLException: The total number of locks exceeds the lock table size
I have about 200k records in the table. how to fix ...

13. Java SQL database independence    stackoverflow.com

I have been looking for an alternative to Hibernate for various reasons. I came across Liquibase and i like the idea so i am willing to try it. Liquibase will cater ...

14. JDBC Pagination    stackoverflow.com

I want to implement pagination using JDBC. The actual thing I want to know is "How can i get first 50 and then next 50 records from database for page 1 ...

15. SQL java get value assigned to auto increment primary key    stackoverflow.com

I have a primary key auto increment attribute in my table. I want to know the value assigned to it for a row that is inserted using statement.executeUpdate(). How to achieve ...

16. What is the best approach using JDBC for parameterizing an IN clause?    stackoverflow.com

Say that I have a query of the form

SELECT * FROM MYTABLE WHERE MYCOL in (?)
And I want to parameterize the arguments to in. Is there a straightforward way to do this ...





17. What is the most "database independent" way of creating a variable length text field in a database    stackoverflow.com

I want to create a text field in the database, with no specific size (it will store text of length unknown in some case) - the particular text are serialized simple ...

18. Public SQL database for educational purposes    stackoverflow.com

I am looking for a publicly available SQL database with free access, where one can run some SELECT queries for free on some meaningful data (not item1, item2, item3). Have you ...

19. Intersystem's ENSEMBLE JDBC SQL Gateway example    stackoverflow.com

Hi I'm trying to connect to an Oracle DB from an Ensemble 2010 machine, on a server that i can only access remotely. So, I first tried it locally: I installed the same ...

20. What's the problem in the next sequence of Java/SQL code?    stackoverflow.com

I made an update to a table in access via Java code, and it doesn't work. But, when I print to the console the result of executeUpdate(), it shows me 1, ...

21. JDBC: in set condition: can I pass a set as single param?    stackoverflow.com

In JDBC I can use question marks for query parameters, like this:

"SELECT * FROM users WHERE login = ?"
and then
ps.setString(1, "vasya");
But how can I query for list of logins:
"SELECT * FROM ...

22. Jruby Stack Traces    stackoverflow.com

So this might be a dumb question but I don't know what to ask for since 'jruby print stack trace' googled doesn't come up with much thats worthwhile but, How does one ...

23. Is it possible to use JDBC as an abstraction layer for RDBMS?    stackoverflow.com

JDBC provides an API, which may be used to connect to different RDBMS or similar datastores. But the datastores differ in implementation (e.g. SQL dialects). Is it possible to use JDBC ...

24. can only use limited amount of methods on java sql    stackoverflow.com

Is it normal that if you declare a method on a jFrameView. You can only use few methods from the java.sql package?I'm trying to create a preparedStatement so that I could ...

25. Java - Trouble Reading from SQL database    stackoverflow.com

I am currently trying to read from a database and output the information to an html file. But I am having trouble reading from the database. Surely it is because of ...

26. Problem with alphabetic sorting    stackoverflow.com

Possible Duplicate:
i want to search the name alphabetically required query for that
I am searching the person name by alphabet and I am getting the ...

27. locale jdbc sql problem java    stackoverflow.com

I have a weird problem with locales in Java. I have a connection via jdbc driver to a DB (informix) where ClientLocale and DBLocale are set to EN_US.CP1252. I can't change this connection ...

28. JDBC Example for java    stackoverflow.com

I have downloaded JDK 6 and also I have sqljdb4.jar and I have database.properties file that content the following data

database.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
database.url=jdbc:sqlserver://.;databaseName=UserInfo;integratedSecurity=true; 
database.username=sa
database.password=admin
B.N : I'm installing the server on my machine and ...

29. How can i set prefech size in clojure.contrib.sql?    stackoverflow.com

I want select 1000000 rows from oracle database to coherence for analysis. i use clojure.contrib.sql to select db. and in jdbc ,i can set setFetchSize(1000) , can i set fetchsize in clojure.contrib.sql ? ...

30. How to create SQL server2005 database on remote machine using JDBC?    stackoverflow.com

I am creating a desktop application, in which I have to log in into SQL Server 2005 on the remote machine and have to create a database, User etc. By ...

31. Running PLSQL Code in Java-JDBC    stackoverflow.com

Hello I have the following code using which I am trying to run a Pl SQL b: lock of code in my db server.

public class Main 
{
    public static ...

32. jdbc: Get the SQL Type Name from java.sql.Type code    stackoverflow.com

I have an array with Field Names and jdbc Type codes. (Those int codes that you can find in http://download.oracle.com/javase/1.4.2/docs/api/constant-values.html#java.sql.Types.BIT I use a level 4 Driver. I can't figure out how to ...

33. Java reading and writing to a local database?    stackoverflow.com

I have a program which is constantly getting information from a website and is constantly updating. As of now I store all that information in an arraylist and then when I ...

34. which cf_sql type shall I use for MS-SQL SmallMoney type?    stackoverflow.com

The doc didn't say, but shall I use CF_SQL_MONEY or CF_SQL_MONEY4?

35. jdbc to my sql connectivity    stackoverflow.com

This is my java code for jdbc connectivity:

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class dbtest
{
    public static void main(String args[])throws ClassNotFoundException,SQLException
    {
   ...

36. DB Independent Java Programming - Suggestions?    stackoverflow.com

I'm looking to write a java program that has the following requirements:

  1. An ability to replace the database in use without changes to the code.
  2. I would like to do the maintanence from ...

37. Hitting stored proc - javax.ejb.EJBException    stackoverflow.com

I'm trying to hit a stored procedure but I'm getting this error message: 'javax.ejb.EJBException'... I've never worked with stored procedures so the exception is a bit Greek to me. Anyone that could ...

38. Java user class    stackoverflow.com

How I can resolve java user class and JDBC user class? The problem is when i run out put is ther is data in sql.For example

public User authenctication(String eMail, String ...

39. Java sql user class    stackoverflow.com

Look at my code. What is wrong? The output is "No user found".

package it.unitn.ing.guide;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

public class LoginDao {
    private static Statement stm = null;
 ...

40. Java Database with Mapping?    stackoverflow.com

I am going to make a database where I need to make use of mapping, (THIS IS NOT JAVA EE) I am speaking of JavaSE only not EE, I was wondering ...

41. variablise embedded sql in the jdbc request    jmeter.512774.n5.nabble.com

On 02/06/2008, aidy lewis <[hidden email]> wrote: > Hi, > > In a JDBC request, is it possible to use variables in the sql query? > > I have a file > > 15004781 > 15004782 > 15004783 > 15004784 > 15004785 > 15004786 > 15004787 > 15004788 > .... ...

42. sql plus    coderanch.com

i installed oracle 8i client enterprise edition on windows 98 , when i start sql plus from programs menu and give username : scott ,password : tiger , it does not work , on other system with oracle 7.x , windows 98 this username and password works fine to start sql plus , how can I start woriking with sql plus ...

43. Good Web Sites for learning SQL    coderanch.com

44. jbbc - sql    coderanch.com

45. is this SQL Stament correct ???    coderanch.com

to group two "where" clauses like that you really need a relation; I assume you mean "AND" in this case. You should also be careful to quote all text constants but not column names (is ja really a column name or does kfach contain the column name and 'ja' the value?), and make sure there are spaces round each keyword. A ...

46. is this SQL Stament correct ???    coderanch.com

It will be almost correct if your table only has a single column of a text type. You should remove the quotes from the table name, first, though. As with "select" statements, it's almost always better to specify the column names: int result = stmt.executeUpdate("insert into " + table + " (colname) values('" + tableValue + "')" ); If your column ...

48. A simple SQL question    coderanch.com

49. Which Jar contains java.sql.* ?    coderanch.com

I've installed Java2 1.3 development environments on Solaris several times without this problem, but I'm new to Win2k. Do I need J2EE? When I compile my connection pool I'm told javac can't find "Timer" which I think is part of java.sql. When I run JSP under Tomcat I'm that I have an illegal constant pool type, probably because it can't compile ...

50. please need help on sql    coderanch.com

public boolean isAiportIdExist(Connection conn,String iataCode) throws PersistenceException { Statement statement=null ; int rowCount; try { super.query= new StringBuffer( "select count(*)") .append(" from AIRPORT ") .append(" where IATACODE = \'") .append(iataCode) .append("\' ") .toString(); statement = conn.createStatement(); ResultSet rs = statement.executeQuery(query); rowCount = 0; while (super.rs.next()) { rowCount=rs.getInt(1); } } catch (SQLException e) { throw new PersistenceException (e); } finally { statement.close(); ...

51. SQL Question    coderanch.com

Excerpt from Frank Carver post: For bigger datasets or busier sites it has really got to be the "go back to the database" approach. It works much better if you can ask the database to only retrieve (say) items 151 to 200, but not all databases support that sort of SQL. We use this approach here with Oracle and it works ...

52. How do lower/upper work in SQL?    coderanch.com

Hi, I'm trying to execute the following select statement in Oracle 8i. SELECT EMPNO,LOWER(EMPNAME) FROM EMPLOYEE WHERE EMPNAME LIKE ? What actually happens here ? My understanding was that EMPNAME column values are first lower-cased, and then SELECT statement is executed. If I have EMPNAME column value as 'Mallika', and I pass 'mallika' to the above query, I expected the column ...

53. Hypersonic SQL unstable    coderanch.com

We are developing a Java application as a front end to a HSQL DB. It mostly works fine but seems to be unstable and will sometimes give very unexpected errors like unique key violations and integrity constraint violations at unexpected times. We know what can cause these types of errors but they do not have a logical reason to occur where ...

54. Help Downloading the javax.sql    coderanch.com

55. jdbc with sql anywhere    coderanch.com

I use an SQL anywhere database. I launch it with dbeng50w.exe or db32w. this engine ask a name and load the file.DB all this is OK The point is what do i need to access to that database in another way than with isql. for example with JDBC.... the odbc driver is 16 bits so cannot be seen with odbc32 in ...

56. SQL for lowest    coderanch.com

57. Memo field in SQL    coderanch.com

Hi, I am facing problems with the Memo field of MS Access in my database that i used for my online shopping. If I have even one memo field in my table, the SQL engine in the Netscape enterprise webserver (running on novell netware) would give "Invalid descriptor" error whenever i query the table thru my servlet program and thereby the ...

58. Urgent -- SQL Help    coderanch.com

Hi, We have a problem here. We have a situation in which we will be inserting a row in a table. Now after a time interval of say 5 minutes we want to delete this row. Is there any easy means of doing this in SQL. We know that a Scheduled object in java can do the job. But we would ...

59. ORA-00933 SQL Command not properly ended    coderanch.com

Hello all - I am writting a program in which I'm build a query statement based on options selected by the user. After the the statement is built I execute it via the executeQuery() method. I have been using the same set of options so I am always executing a query that I know should work. When I run the query ...

60. Dynamic SQL with JDBC    coderanch.com

Iam also trying dynamic sql. U have given eg. "select * from emp where id = '" + stringvar + "' "; if id is integer and i want to check against a dynamic integer variable how do u write the code? i mean if id is also integer and, "select * from emp where id = integervariable "; i would ...

61. is it possible to delete record from sql    coderanch.com

Im new to most of this ,so please bare with me. I have a table with email addresses. And I would like to delete a record if it is no longer in use. How would I write this would it be something like this "DELETE [Email Address] FROM [Email Addresses] WHERE [Email Address] LIKE '" + emailString + "'"; Thank u ...

62. my sql code for my last inquiry....    coderanch.com

63. SQL HELP    coderanch.com

Am working on a project that involves taking an ACCESS 97 db and recreating it in MS SQL (for database) and JRUN. I'm new at SQL and am unfamiliar with VB. Anyone knows of a good resource website where I can search the knowledge base? Microsoft's site looks more like a labyrinth.. can't find anything on sqlmagazine either. Thanks a million, ...

64. AS400 and JDBC (and SQL)    coderanch.com

It isn't so much that it won't commit and rollback, but when I add these commands then the program gives me an SQL error stating that a token is wrong, or a statement in not correct. Forgot to write down the SQL error number. If anyone knows where I can vind a listing of SQL error codes (mostly for Oracle, and ...

65. Create SQL store procedure    coderanch.com

You can CALL a stored procedure with JDBC, but you cannot CREATE one. Each DBMS has its own syntax for creating stored procedures, and the current JDBC spec does not handle this. You have to look into the syntax for the particular DBMS you are running. Once you've created the stored procedure on the DBMS, calling it from a JDBC statement ...

66. sql loader    coderanch.com

Hi, I have added 2 extra attributes to an existing table. Now I have to load data to only those 2 columns.How can I do this using sql loader? I tried using Filler in ctl file, I get error because of the foreign key references. Can anyone give some ideas? Thanks, Vanitha.

67. Creating New SQL DB    coderanch.com

I am fairly new at the world of JDBC and SQL. While doing some reading, I have noticed that it seems one must create an SQL database outside of JAVA and then use JDBC to access and manipulate the DB. I was wondering if there was a way, that if SQL was running as a service, there is a way in ...

68. the SQL    coderanch.com

69. JDBC with SQL 7    coderanch.com

70. store and retrieve image from SQL    coderanch.com

71. Problems using the SQL statment SUM()    coderanch.com

Hi I am accessing an SQL data using JDBC. The SQL query I'm making is: ResultSet rs = stmt.executeQuery("select sum(OHScan), sum(Keyed), sum(HHScan), sum(Dispatch), sum(Stray), sum(Misc) from Induction where ((InductionName = 'IU011' or InductionName = 'IU014') and (EntryDate = '10-10-01 19:00:00' or EntryDate = '10-10-01 20:00:00'))"); The query returns the vaules it has to and I can print out the values in ...

72. A SQL Problem: Help Please    coderanch.com

In my database, there is a Car table, which contains the following columns: CarID CarMake CarModel CarYear CarMileage CarColor I want to do a web application where users can search the Car table by entering a keyword such as "Ford". Usually, we do SELECT * FROM CAR WHERE CarMake='Ford' But the problem here is that the user may well enter "Taurus", ...

73. How to use the SQL key word EXISTS?    coderanch.com

I use mysql for a web application. This application requires the customer to log in using his email address and a password. Now when I get the customer password, I want to check the customer table in my database and see if that e-mail address exists. If it exists, I then check if the password the customer has just entered matches ...

74. SQL    coderanch.com

Hi. I am having a couple of problems with SQL. First Problem: Here's my SQL statement: String s = (String)customer.getSelectedItem(); "SELECT INWCCD FROM INCUST WHERE INWCNM ='" + s +"'" Why can't this SQL statement bring in a record with an apostrophe in it??(i.e- Mervyn's). Keeps telling me "Incorrect Syntax". Second Problem: if(rs.getString(5) == "S") { sing.setSelected(true); } There is a ...

75. Can someone figure out whats wrong with this SQL    coderanch.com

Originally posted by moiz11: I got this program out of a book and this code part works on Microsoft Access but on MySQL it give me an err. First the CODE: String updateStatement = "UPDATE Books " + "SET Price = Price + " + priceChange.getText() + "WHERE Books.Publisher_Id = " + "(SELECT Publisher_Id FROM Publishers WHERE Name = '" + ...

77. SQL Warnings    coderanch.com

Yes, It has happened (or at lease used to) when the database password was getting ready for expiring (not yet expired). Allowed for the application manager to change the backend database password and the password in the app. I'm sure there are others, but this was the only one I was interested in. -steve

79. Simple SQL question    coderanch.com

Hello all, I'm wondering if it is possible to get the following three sql-queries in one: Select sum(amount) as amount1 from tbl_accounts where accountNo like '22%' and customerName like 'A%'; Select sum(amount) as amount2 from tbl_accounts where accountNo like '37%' and customerName like 'B%'; Select sum(amount) as amount3 from tbl_accounts where accountNo like '44%' and customerName like 'C%'; ... so that ...

80. SQL question    coderanch.com

81. SQL doubt    coderanch.com

82. metadata w/o sql call?    coderanch.com

hi, does anyone know of a nifty way to get this sort of data... w/o constructing an actual sql query? for( int x= 0; x < rs.getMetaData().getColumnCount(); x++ ){ field = new String[GMSConstants.FIELD_LENGTH]; field[GMSConstants.FIELD_NAME] = rs.getMetaData().getColumnName( x + 1 ); field[GMSConstants.FIELD_LABEL] = rs.getMetaData().getColumnLabel( x + 1 ); field[GMSConstants.FIELD_TYPE] = String.valueOf( rs.getMetaData().getColumnType( x + 1 ) ); field[GMSConstants.FIELD_SIZE] = String.valueOf( rs.getMetaData().getColumnDisplaySize( x ...

83. Simple SQL question    coderanch.com

84. Small SQL databases for JUNIT tests    coderanch.com

85. sql    coderanch.com

In general, the LIKE operator will be an order of magnitude slower than an = operator. Also, a LIKE operator will not be able to take advantage of any indexes which may exist on the operand columns. However, your sample is so simple, you might not be able to find a difference. For example, if you time the two queries in ...

86. Create primary and foreign key with SQL    coderanch.com

Hi, I'm new to SQL. I need to create a table that has a primary key to be used by a CMP entity bean. I used following to create the table: create table my_table(id not null number, val_1 number, val_2 string) ID is the primary key. Does above SQL statement requires id to be unique? If not, what should I do ...

87. Very Urgent !!!...Sql Gets Hanged...    coderanch.com

I am using Oracle 9i.Everything is working fine but now when i try to insert in a specific table using SQL Plus ,it gets hanged..why?? If i insert it in a different table it does not give any problem. Can anybody tell me what is the problem.. Please help..its very urgent.. Thanx Geeta

88. sql    coderanch.com

89. sql    coderanch.com

if I want the date with lowest version # which is belong to stmt 2. How should I write my sql? i.e. i need date = 1999 in 1st one i need date = 2000 in 2nd table stmt can either be 1 or 2 version is ascending. stmt version date ==== ======= ==== 1 1 1997 1 2 1998 2 ...

90. delete sql    coderanch.com

U can't perform DML(insert/update/delete) operations on more than one table at a time..even if u are referring to the same table by means of alias. I think what u intend to do is delete duplicate records. If that is the case, u can try the following.. DELETE FROM EMP A WHERE ROWID > ( SELECT MIN(ROWID) FROM EMP B WHERE A.EMPNAME ...

91. Announcing IronEye SQL a JDBC Performance Analysis Tool    coderanch.com

IronEye SQL is a performance analysis tool that transparently (no code changes required) exposes and times all of the SQL being generated by an application (behind plain JDBC, O/R mapping tools, EJB, etc) for the purposes of identifying and excessive or long running SQL statements. Press Release ------------------- Announcing IronEye SQL JDBC Performance Analysis Tool IronGrid introduces a program to allow ...

92. SQL commands in MS-Access....Pls Help    coderanch.com

93. Using java.sql.array    coderanch.com

I need help about working with arrays in an access database. 1) How do you use array in create table statement? stmt.executeUpdate("CREATE TABLE tblA (ID INT PRIMARY KEY, Var2 INT, Var3 VARCHAR(50), ???)"); //I want Var4 to be an array 2) How do you insert values into Var4, which is initially an empty array? 3) Retrieving an array. Is this correct? ...

94. How to use Sequence using sql commands    coderanch.com

u are using stmt.executeUpdate (" INSERT INTO Accounts (firstName, lastName, mailAdress, Zipcode) VALUES (accountID_sequence.NEXTVAL,'"+firstName+"','"+lastName+"','"+address+"','"+zipCode+"')"); But, the number of columns are diferent to the number of values, I mean, you should use : (id, firstName, lastName, mailAdress, Zipcode) where id is the name of the column where you want to insert the value of the sequence. Hope this helps.

95. need sql parser!!!    coderanch.com

96. SQL Doubt    coderanch.com

97. Toughest SQL    coderanch.com

98. SQL question -- is it possible to do this?    coderanch.com

Table1 Table2 +-----------+--------++-----------+----------+------+ | ip | name || ip | time | hits | +-----------+--------++-----------+----------+------+ | 127.0.0.1 | local1 || 127.0.0.1 | 2002-7-1 | 100 | | 127.0.0.2 | local2 || 127.0.0.1 | 2002-7-2 | 200 | | 127.0.0.3 | local3 || 127.0.0.2 | 2002-7-1 | 300 | +-----------+--------++-----------+----------+------+ mysql> select a.ip,name,time,sum(hits) from table1 a left join table2 b on a.ip= ...

99. [fixed] Urgent SQL question: Is it possible to do this?    coderanch.com

I have two tables- table1 & table2 Table1 Table2 +-----------+--------+ +-----------+----------+------+ | ip | name | | ip | time | hits | +-----------+--------+ +-----------+----------+------+ | 127.0.0.1 | local1 | | 127.0.0.1 | 2002 | 100 | | 127.0.0.2 | local2 | | 127.0.0.1 | 2002 | 200 | | 127.0.0.3 | local3 | | 127.0.0.2 | 2003 | 300 | ...

100. SQL warnings driving me nuts    coderanch.com

Ok people. I'm using db2 and if I try to execute the statement: Update t set i = 10 where i = 123 this row where i = 123 doesn't exist and I get the following warning: SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQLSTATE=02000 So far...everything's fine. ...