Tagged Questions
0
votes
1answer
17 views
Is there a sql JDBC that will respect fetchSize?
I am using MySQL and want to utilize the setFetchSize property. the default mysql jdbc implementation does not really respect it. If you set fetchsize to INTEGER.MIN_INT it will fetch each row ...
1
vote
0answers
12 views
Java 1.6 to 1.7 causes database connection to throw “The driver could not establish a secure connection to SQL Server by using SSL encryption.”
We have some code that was connecting to a SQL 2008 R2 database on a different server using the Microsoft sqljdbc4.jar driver. It was running fine using Java 1.6u31 and we recently upgraded the ...
0
votes
1answer
19 views
How does Oracle handle SQL when autocommit=false and there is no commit or rollback?
I am running Java and Oracle SQL 11g.
What happens if you establish a connection to a database, setting the connection to AutoCommit=False but you have neither a commit() nor a rollback() ?
I have ...
0
votes
3answers
27 views
Check if update query affected row or not
If I want to select stuff in my database I can just executeQuery in a ResultSet and return that to see what I got. But how do I do checks if I want to insert or update rows?
How can I see what the db ...
1
vote
1answer
27 views
Hibernate Select wrong table name
Im trying to insert and select data in mysql database trough Hibernate and Insert is working fine for me but select somehow dont map the right table name and returns me no result.
Get and insert ...
0
votes
1answer
13 views
Android App MS SQL Server Authentication only works with WIFI
Problem: My Application can successfully connect to a Microsoft SQL 2014 server but only when my phone is connected via WIFI. As soon as I turn WIFI off, I am no longer able to connect. Shouldn't it ...
-6
votes
0answers
15 views
Monitor reservations using java and sql
There is something I want to know first. Is it possible to monitor reservations in java and sql? If yes, then how? Please give me an idea with this.. I'm new here and I want to learn.
1
vote
0answers
38 views
Hibernate filter with if condition
@Entity
@Table(name = "person")
public class Person {
private Long id;
@OneToMany(mappedBy = "person")
@Filter(name = "localeFilter", condition = "locale= :localeFilterParam")
...
0
votes
2answers
19 views
Hibernate Generated query - Non existent table
I created a @OneToMany relationship with Entities.
For instance, Member and Address. These two are joined by Mem_Addr table.
When I deploy the application, the log shows:
EntityBinder I ...
0
votes
2answers
16 views
H2 database does not accept a table name as named parameter
I'm having trouble when trying to run the following query against an in memory H2 (version 1.4.181) table:
Object result = hibernateSession
.createSQLQuery("show columns from ...
-5
votes
1answer
34 views
How Access Data base in java [on hold]
how do i enter data in SQL server management studio from text fields? i already created a connection but do not know how to access SQL database through net beans ? beginner in java.
here is the code
...
-1
votes
1answer
45 views
Java program for a sales receipt
EDIT!
The purpose of the program is to print to greet the customer and then provide them with information on what is for sale along with the prices and then to ask how much of each item the customer ...
0
votes
0answers
17 views
ava.sql.SQLDataException: ORA-01858: a non-numeric character was found where a numeric was expected
i have a prepared statement in which i set a field as :
busStatement.setDouble(5,bus.getFare());
my get Fare Function is :
public double getFare() {
return fare;
}
the fare is being ...
0
votes
1answer
39 views
JPA/Hibernate select query returning duplicate records
I have a table ,say, Instrument with ID,State, and User_ID as columns.
So I have this JPA query to return all the instrument records with a matching
User_ID.
query = manager.createQuery("SELECT ...
-1
votes
0answers
35 views
Batch insertion in hibernate
I was reading Batch processing in Hibernate.I have problem understanding the below
<property name="hibernate.order_inserts">true</property>
In case of parent-child association (taking ...
0
votes
0answers
32 views
Mysql Query for Calculate 0,4,8,16% taxes
I have query that calculate the zero,four,eight and sixteen percent taxes from database and view it in Report ,it's work OK with small database but when database get huge number of records its take ...
1
vote
2answers
37 views
Alarm Manager fail to Execute onReceive
I am having some problem with Alarm Manager in Android. I am setting the alarm manager to execute every midnight at 12am. Here are my codes:
Calendar calendar = Calendar.getInstance();
...
1
vote
1answer
28 views
Oracle date conversion error ORA-01858
I'm trying to run an Oracle stored procedure and pass the result as a data source to a report in a java web application. I'm using spring MVC and my OS is Windows 7- 32bit.
The code is something like ...
0
votes
2answers
21 views
How to speed up queries in sqlite android in db.execSql
I have the following code that I use to enter data in the database.
public static void execSql(SQLiteDatabase db, String sql)
{
String[] parts = sql.split(";");
for (String entry : parts) {
...
0
votes
2answers
66 views
How to make an array list to loop it self, while being in a loop?
Right I've got 3 model classes and 3 of those get data from the database (different tables) via SQL and save data into arraylists.
Now I'm trying to input three array lists data into the table.
The ...
0
votes
1answer
49 views
JOOQ - convert result into Pojo
I have seen that JOOQ can automatically return a POJO when we use .selectFrom(TABLE) or .fetchInto(POJO.class);
But is it possible to convert the result of a complex query into multiple POJO ?
...
0
votes
0answers
42 views
JDBC Connection Pool Issue
I'm experiencing an issue executing a sql query from within my java application; it's difficult to detect what the exact problem is until I get debugging going - there are no errors are returned
The ...
0
votes
1answer
40 views
Timeout Database connection in Java
What options are available in Java to timeout a database connection at a specific period of time?
For example, an application creates a database connection from a data source, then it executes a SQL ...
0
votes
1answer
33 views
Mysql java executeUpdate error
When i use this query I have this error
Exception in thread "main"
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an
error in your SQL syntax; check the manual that ...
0
votes
3answers
34 views
Converting timestamp String in a unique Primary Key
I'd like to transform a String (from an XML file) to a DB Primary Key using Java 7.
In particular, I would like to make sure that this values are unique, positive and respect the DB primary key ...
0
votes
2answers
43 views
casting time in string format into time format in jasper report5.5.0 [on hold]
The result of cast('00:00:01' as time) when I write in sql query field of phpmyadmin is what I wanted , but when I try the same query in jasper report I am not getting the result as per requirement. ...
0
votes
2answers
27 views
How to display selected columns of database in a Jtable?
I successfully populated my JTable with the contents of my database table but I only want to show selected columns of it. Is there any way of doing this? Or is it even possible to select which column ...
1
vote
1answer
21 views
Dynamic Update with composite id hibernate
In hibernate, if dynamic-update is enabled, while updating the object it generates query for only modified columns
Consider a class with composite-id using components. Composite-id saveOrupdate the ...
0
votes
1answer
33 views
How to write complex sql queries in properties file for java jdbc application
My requirement is to make the sql queries external to my java code so that it can me modified by manual testers. I need some suggestion/help to write the properties file for my utility class. I know ...
1
vote
2answers
41 views
Hibernate: Unexpected Error while using Named Query
I am getting an error when i am trying to display few contents of a table using named query in hibernate. I have tried looking for answers, with no success. The code is listed below.
<sql-query ...
1
vote
3answers
36 views
preparedStatement SQL error in java [on hold]
I get an error when I execute the following code.
preparedStatement = connection.prepareStatement("select * from fpp_alarm"+ "where id = ? ");
preparedStatement.setString(1, id); //string id = "4"
...
0
votes
1answer
43 views
Getting wrong time for timestamp field with hibernate select
Getting wrong time for timestamp field with Hibernate select.
We are using Hibernate framework and Postgres database.
We have a table which stores 'created_time' in column of data type TIMESTAMP ...
0
votes
2answers
35 views
building a Mybatis query with if
I've written the next code. I know it's wrong, but I don't know how it should really be to do the same. I'll appreciate any help.
<select id="getSeqTempByRulesCabN3" resultType="java.lang.Integer" ...
1
vote
1answer
25 views
jOOQ - error with alias and quotes
I have this query:
Field<String> yearMonth = DSL.field("FORMATDATETIME({0}, 'yyyy-MM')",
String.class, LICENZE.CREATION_DATE).as("anno_mese");
List<Record3<Integer, ...
0
votes
1answer
31 views
Create a Hibernate Criteria sentence from sql [on hold]
How can I create a Hibernate Criteria from this SQL query???
select di.*
from device_information di,
category_product cp
where di.ID_CATEGORY_PRODUCT=cp.ID
and cp.ID_INTERNAL_GROUP= 345
Actually I ...
0
votes
1answer
45 views
runtime exception in mysql
I have a code as shown below for data access object. On successful insertion of data in signup table,I want to extract only CustId of the signup table of that particular row. So am using UserName ...
0
votes
0answers
23 views
Android repeating insert and update SQL statement
I am having some logic concept problem when trying to do the recurring task in Android. Here is the code:
public View getView(int position, View convertView, ViewGroup parent) {
String ...
1
vote
1answer
21 views
Saving an Image on Data Base
Basically I have to save an image I put on a JLabel on my DB(I have a BLOB var there)
JLabel LImg = new JLabel();
ImageIcon img = new ImageIcon("**filepath**");
LImg.setIcon(img);
...
0
votes
1answer
22 views
Where should I create a local db, and connect-disconnect from a database?
in a college project I have a Java application,
the main method do some stuff, then call a method that every 10 seconds:
-connects to a local database, (localhost, username and password are known),
...
0
votes
1answer
31 views
Oracle invalid identifier doesnt understand string
I'm having an issue with my query not working. This is the command variable.
When it executes it should be retrieving the tuples that have BSc as their degree. I have tested this in oracle directly ...
0
votes
1answer
29 views
retrieving values from MySQL database provide only null values
I have created a table within a MySQL database and need to retrieve the values from it using java but the output only displays NULL values...
Here is my java code..
Connection con;
...
0
votes
0answers
32 views
Android Alarm Manager Event Trigger
I am trying to run recurring task in background using Android. What I am trying to do is I populate a list view with date and make some calculation for next payment date. Once the next payment date ...
-4
votes
0answers
34 views
“attendance marking system” Any way to get this in java & SQL? [closed]
I am developing A attendance marking system for a project in java and i need to get number of hours worked by each employ including the over Time it record it like this
Time in Time out
...
0
votes
2answers
36 views
JDBC Connection String with selectMethod=cursor breaks connection
I'm trying to deploy a JBoss webapp that requires selectMethod=cursor in the jdbc driver connection string.
But when I try connecting to my mssql (2008) database with this in the string, it just ...
-1
votes
1answer
35 views
Database abstraction using Java [closed]
I want to develop an application which will provide a kind of abstraction layer to access the database. In other words, I want to create a REST service which will accept a certain parameters (like db ...
0
votes
0answers
18 views
Java JDBC SQLite search databse from string input [duplicate]
I am trying to create a method that can take in a string and use that string to search the SQLite JDBC database.
Currently, to search the database I am using the line:
ResultSet rs = ...
1
vote
1answer
49 views
How to initialize Condition object without explicitly assigning?
There is some example:
Condition condition;
condition = CAR.COLOR.eq("blue");
condition = condition.or(CAR.MODEL.eq("Genesis"));
condition = ...
-1
votes
1answer
26 views
Partial Data deletes using Java SQL Hibernate
Our Java program has to delete large number of records from DB2 tables but it is running out of Transaction logs.
We are working on increasing the logs space but due to internal processes and other ...
1
vote
0answers
27 views
Display generated SQL queries from JPA entities (without running the application)
I would like to build a tool to help developers/architects to detect potential slow or bad queries in their applications.
Complex generated SQL queries due to wrong JPA usage are quite very common ...
0
votes
1answer
52 views
How to optimize pagination on a SELECT DISTINCT sql?
My query is a select distinct on a very large database, and in pgAdmin sql tool the query itself lasts 12 sec.
SELECT DISTINCT ON (city, airport, zip, country, name) city, airport, price, id FROM ...