Tag: java

Microsoft SQL Server – Query with huge results, causes ASYNC_NETWORK_IO wait issue

I have a Java application requesting about 2.4 million records from a Microsoft SQL Server (Microsoft SQL Server 2008 R2 (SP3)) The application runs fine on all hosts, except one. On this host, the application is able to retrieve data on some occasions. But on some others, it hangs. Monitoring the MS Sql server indicates […]

JDBC connection to Azure fails in Android Studio

So I’ve been fighting with this on/off for a few days and feel as if I’ve exhausted any relevant search terms. Let me begin by saying that I’ve done a lot of research into this to no avail; I’ve come to the conclusion that it’s either something very abnormal (less likely) or it’s some minuscule […]

JPA to MS SQL Server via Eclipse: Ping Failed

This question already has an answer here: JDBC connection failed, error: TCP/IP connection to host failed 5 answers

How to take Null values query expression using servlet and jsp

I need to calculate and retrieve data from SQL server database table in my table having the NoOfErrors and NoOfAudited columns. I need to calculate the Accuracy based on these columns. I have a query like this select a.id, (100-((a.NoOfErrors*100)/ NULLIF(a.NoOfAudited,0))) as Accuracy from Table1 a join Table2 pd on a.batchid=pd.id where a.charge='”+Poster+”‘ and status=1 […]

How to insert all the SQL table data into an array in java

I’m trying to get all the data in my sql server table and to insert it into an array. My table’s name is “users” and I want to get all the names and emails and put them inside an array like that: [name,email,name,email,name,email……] I used volley while POSTING data to my sql server but i […]

jdbc.SQLServerException on group by clause

While executing this code in my project: Integer countObj = (Integer) ht.findByCriteria(criteria.setProjection(Projections.rowCount())).get(0); I get the following exception: com.microsoft.sqlserver.jdbc.SQLServerException: Column “PRODUCT_TASK.PRODUCT_TASK_ID” is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.” Here I am using two tables. Product_task with product_task_id as primary key Product_info […]

Sql Server call from Java error

I have the following code in Java class: CallableStatement stmt = con.prepareCall({ call myInsert( ?, ?, ?)}); stmt.setString(1, myTO.getField1()); stmt.setString(2, myTO.getField2()); stmt.setString(3, myTO.getField3()); stmt.executeUpdate(); And myInsert in database is defined as: IF OBJECT_ID ( ‘myInsert’, ‘P’ ) IS NOT NULL DROP PROCEDURE myInsert; GO CREATE PROCEDURE [myInsert] @Field1 as uniqueidentifier, @Field2 as varchar(120), @Field3 as […]

Stop a CMD run from SQL Job

I need to have a java program always running in the background. I’ve set it up as a SQL Job that runs periodically, running the Java from CMD. The job runs periodically to check if the Java program is still active. The issue I’m encountering is that if I stop the SQL Job, the Java […]

Passing an String array to a Prepared Statement Array (JDBC + SQLServer)

This question already has an answer here: PreparedStatement with list of parameters in a IN clause 14 answers

Java JDBC SQL Server database keeps freezing

So I have recently been working on a web-app which is connected to a SQL server database. During testing everything went fine; all methods work and there were no major issues. At a certain point in the testing-phase I left the server on for more extended amounts of time and after a while of usage […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.