Tag: java

How can I get a Login from JSP page? How can I correct my jsp code.?

I’m wrong here How can I correct this String Sql=”select * from login where username='”+name+”‘ AND password='”+abc+”‘”; c1.st.executeQuery(Sql); { out.println(“aa”); } catch(SQLException ex) { I am only wrong here this is a login page in jsp.I am only wrong here this is a login page in jsp. db conn.jsp <%@page import=”com.mysql.jdbc.Connection”%> <%@page import=”com.mysql.jdbc.Statement”%> <%@page import=”java.sql.ResultSet”%> […]

Output parameter from SQL Server stored procedure truncated at 4000 characters

I have a problem with the output parameter of a stored procedure when it contains more than 4000 characters. The response seems to be truncated by the JDBC driver? How can I get the full result? The stored procedure answers with the complete response (> 4000 characters) but I can not open it from Java. […]

Deadlock during insert/update in parallel

I am new to MS SQL Server and I am trying to update the record by incrementing occurrence counter(+1) if data is missing or I freshly insert it with counter value zero ‘0’. Moreover my application runs in parallel to process each element of data array a[]. When processing array in parallel SQL Server throws […]

DEADLOCK with C3P0 on java se application

I encountered a critical problem with the c3p0 library (version 0.9.5.2) that I use in my Java SE application. My application uses a Thread Pool to parallelize task by executing jobs. Each job uses the database to read, update or delete data at least once up to (in very rare cases but it can happen) […]

JDBC SQLServerException Parameter not defined

I have a Play 2.4.3 app and using JDBC to connect to SQL Server DB. I just wrote a database class to handle calling stored procedures. However, I’ve hit a wall: The start of my proc: ALTER PROCEDURE [WebApp].[Content_GetByAppID] ( @inAppID int, @inContentGroupID int = null, @inContentTypeID int = null, @inContentStatus char(1) = ‘A’ ) […]

Problems with Date Java8 Hibernate5.2

I used to use java.util.Calendar and java.util.Date, but now I´m facing a convert problem that I don’t undestand. Every date that a work persists righ at the database but in the application miss 2 days. My system uses Java8 Hibernate 5.2 MS SQL 2008 Database System.out System Actualy I’m using Calendar but it’s the same […]

how to know client ip port from jdbc connection

I am testing about MSSQL. “how to long session information created after after connection?” So, try to connection with MSSQL JDBC, then select the sys.dm_exec_session and sys.dm_exec_connection with client Ip and port. But, I don’t have any idea, how to get Client Ip and port from JDBC connection. or is it possible create JDBC connection […]

java delete column from primary key that start with?

ok iam having a problem i need to delete all columns that start with ? on primery key ex.?5 ,?4 i amm running this throw a java app i have build so i need the java query that search my database ektupotiko and then delete all columns that start with ? on primary key here […]

Executing an SQL command with EntityManager

Is it possible to run an SQL script that doesn’t return a resultSet or is not an INSERT or UPDATE type of script? I’m trying the following: Query q = entityManager.createNativeQuery(“DECLARE @max int;\n” + “SELECT @max = MAX(customer_number)+1\n” + “FROM organisation\n” + “\n” + “exec(‘ALTER SEQUENCE organisation_customer_number_seq RESTART WITH ‘ + @max)”); …but of course […]

Get the return value of date diff?

So i have this query using DATEDIFF function on MS SQL Server? SELECT DATEDIFF(DAY,(select StartDate from CarOrder where OrderID= 59),(select EndDate from CarOrder where OrderID= 59)) This work fine and the result is 10 but i dont know how to get the return value and use it in this function for java public int getDateDiff(int […]

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