Tag: java

Customizing entity generation from datasource in IntelliJ IDEA

I want to generate my JPA-Entities from the database schema of an SQL Server 2012 using IntelliJ IDEA Ultimate 2016.2. I created a new data source and connected via JDBC to the server. Everything including the generation of the entities from database schema works. The problem is, that the ID fields in my database are […]

JTDS error: Native SSPI library not loaded

I’ve seen this question come up multiple times, but all the answers I’ve tried haven’t worked for me. The Connection string used to look like this url = “jdbc:jtds:sqlserver://server1/dbname;user=user;password=pswd”; //this one works fine url = “jdbc:jtds:sqlserver://server1;dbname;databaseName=dbname;integratedSecurity=true”; //doesn’t work but I am getting the exception. java.io.IOException: SSO Failed: Native SSPI library not loaded. Check the java.library.path […]

Connection Between Java App and Sql Server EXPR 2008 R2 Not Established

I’m newbie with SQL Server , i’m trying to connect my java Application to SQL Server, actually i get the JDBC jar file for MSSQL Driver from Microsoft Offical website then as showing in my Screenshot Here* the SQL Server Driver was imported well, but m problem i faced that i got this Exception while […]

Is there an alternative to UPDLOCK with NOWAIT that leaves the transaction committable?

Given the following: DB objects in SQL Server: create table t (c int); create table t2 (c int); create table t3 (c int); create table t4 (c int); create trigger tr on t after update as begin update t2 set c = c; end; create trigger tr2 on t2 after update as begin begin try […]

(Sum) query results in jtext

i want to create a function to show me the sum in Jtextfield .I dont know how to call the result any idea ? My jtextfieldname is sum_calc .Ty public void getSum() { Connection con =getConnection(); Statement st; PreparedStatement pst = null; ResultSet rs; try{ String qquery=” SELECT sum(Receipt.Sales_Quantity * Receipt.Pro_Price) AS TotalItemsOrdered FROM Receipt”; […]

Using Hibernate to connect to MS SQL Server

I’m trying to connect to an SQL Server database using Hibernate in Java. My hibernate.cfg.xml file looks like this: <hibernate-configuration>    <session-factory>   <property name = “hibernate.dialect”>org.hibernate.dialect.SQLServerDialect</property> <property name = “hibernate.connection.driver_class”>com.microsoft.sqlserver.jdbc.SQLServerDriver</property> <property name = “hibernate.connection.url”>jdbc:sqlserver://*******.database.windows.net:1433;databaseName=*******;</property> <property name = “hibernate.connection.username”>*******@******</property> <property name = “hibernate.connection.password”>**********</property> <property name = “hibernate.show_sql”>true</property> </session-factory> </hibernate-configuration> After trying to run the app, I get […]

Hibernate Mapping Exception : Unknown Entity

I am mapping a simple POJO to a database table in SQL server using xml file mapping. I am getting Hibernate Mapping Exception : Unknown Entity These are my code files: Entry point class : public class Program { public static void main(String[] args) { System.out.println(“Helo World”); Session session = HibernateUtilities.getSessionFactory().openSession(); session.beginTransaction(); User user = […]

why? connection reset by jdbc (ms sqlserver)

MS SQL Server 2008 sqljdbc4.jar Connection is OK. But if I execute any SQL or any string, just “connection reset” occurrs. Why does this happen? I don’t have any experiences for any dbms (oracle, mssql, etc…)

how to insert bulk data from one database to another data base same structure using java

I have two SQL server running on two different location having same structure but different IP a = 100.0.0.1 and IP b = 192.0.0.1. I have a table a.table and b.table of same structure. Now i want to move all data that is in a. Table from 100.0.0.1 machine to b.table machine 192.0.0.1 .I want […]

Database call stuck at java.net.SocketInputStream.socketRead0(Native Method)

Calls made from Java to SQL server using jtds driver is stuck. We have checked there is no locking or any long running queries on SQL server. Following is the stack trace from java thread dump. Any one has any idea? “core-CommandInvoker-thread-7133” prio=5 tid=7362 @@@@ RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:152) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.io.DataInputStream.readFully(DataInputStream.java:195) […]

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