Tag: java

Does anyone know why JPQL query on a view with SQL Server does not work? 'GetResultList' always returns empty list

So basically as in title, my JPQL query created with entityManager.createQuery() method always returns empty list, which is strange because there certainly exists underlying data. I have a View object in SQL Server database which maps several tables into one view using union all. Here is my JPQL string passed to earlier mentioned method createQuery(): […]

Java: get specific table from my sql database

I have a code in which i can get all my tables, but how i can get my table i specify. Here is my code : private void initComponents() { System.out.println(“trying to connect”); try{ conn = DriverManager.getConnection(CONN_STRING,USERNAME,PASSWORD); System.out.println(“Connected”); } catch(SQLException e){ System.err.print(e); } jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jTextField1.addMouseListener(new MouseAdapter(){ @Override public […]

MyBatis Mapper Xml Stored Proc Call: Supply Default Parameter Value

I need to be able to pass default parameters to a MyBatis xml mapper. Originally, this is what I was doing: <select id=”someFunction” parameterType=”com.myCompany.Member” resultMap=”memberMap” statementType=”CALLABLE” > {call dbo.trp_MembersGet_ById_sp (#{memberId,jdbcType=INTEGER,mode=IN}, 1)} </select> The default parameter in this case would be the second param, ‘1’. This seemed to work, but all traces in the database make […]

How to convert blob data in MS-SQL and MySQL to it's original form using java?

In our product,when we run a project (Say ‘ABC’) that inserts blob data into the database(can be MySQL/Oracle/MS-SQL) , but when we execute a select query and retrieve a blob data from database to convert it to original form using java (Here we are writing this output to a file) then the following block of […]

JSP: Insert not functioning (SQLSERVER)

Good day. I’m a beginner at JSP and I got a Daily Sales Monitoring as a project. I have done my research and I’ve made my first CRUD jsp program function, but when I added a lot of columns, the insert didn’t work(delete and view still works). There are no visible errors, but as soon […]

The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer

When my java application tries to connect to SQL SERVER, I get the following error and I don’t know the reason. HTTP Status 401 – Could not get JDBC Connection; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: “java.security.ProviderException: java.security.KeyException”. […]

sql request fail with implicit conversion even when no records match clause in prepared statement

I like very much StackOverFlow cause i often found solutions to my problems. But today i’m lost and need your help. I apologize for my poor english. I have a spring batch software which interrogate a sql server database. For that, we use a prepared statement : select linkcode, cmpcode, doccode, docnum, doclinenum, usrref1 from […]

Getting LockAcquisitionException error while inserting a row through Java+Hibernate code

There is a table named: tableA. I am trying to insert a row into tableA. I am getting LockAcquisitionException while doing the above operation. Please note that this does not happen often, but it happens once in a while. I am posting the error stacktrace below:- Transaction (Process ID 111) was deadlocked on lock | […]

WAS Liberty: sqljdbc driver not configured for integrated authentication

I have a problem with the database connection when migrating a web application from Tomcat 6 to WAS Liberty 8.5.5.8. On WAS Liberty I get the following error: com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication I have placed “sqljdbc4.jar” inside the applications WEB-INF\lib-folder. I have tried placing the file “sqljdbc_auth.dll” various places, like […]

Transaction not starting unless I do modification

I’m having an issue where my transaction doesn’t truly seem to be starting unless I issue a command that appears to be transaction worthy (the last part is conjecture). Below I have a method decorated with the @Transaction attribute, it’s public, it’s being called via the spring proxy. I’m connecting to SQL Server, using Microsoft’s […]

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