Tag: java

JDBC MATLAB and SQL

I see there’s already a post on something similar but the solution there didn’t work for me. I’m trying to use the MATLAB 2017 database app and MSSQL Enterprise so I can import SQL data into MATLAB using SQL syntax. I tried the Mathworks method by creating the two text files. This didn’t work as […]

is it possible to connect mssql by domain user using impersonation not using jtds

We are mostly using MSSQL and connecting the databases either database user or active directory user. We use the jtds library for active directory users. Now we start to use Oracle databases, I think jtds not support Oracle. Before starting Oracle connection, I try to connect MSSQL with integratedSecurity option by impersonating not using jtds. […]

java.sql.SQLException: Native table 'performance_schema'.'session_variables' has the wrong structure

Previously I accidentally dropped ‘performance_schema’ and ‘sys’ from DB. I ran mysql_upgrade -u root -p –force –skip-version-check in order to recreate those two. They were successfully recreated. I couldn’t restart the MySQL service because I couldn’t find MySQL running in Administrative Tools -> Services. So I think some of the database has broken and now […]

Get image from SQLServer to Android using JDBC

I am trying to get an image from sql server and use it in my android application. The code for creating table and storing the image in the database table is : create table Imagee (ID int not null,Img VARBINARY(max) not null) insert into Imagee (ID, Img) SELECT 1, BulkColumn FROM Openrowset( Bulk ‘C:\Razvan\PozeDB\hawai.png’, Single_Blob) […]

How to get *everything* back from a stored procedure using JDBC

I occasionally encounter two forms of strange behaviour when using JDBC to work with SQL Server stored procedures: Issue 1: I run a stored procedure in SQL Server Management Studio (SSMS) and it returns a result set. However, when I try try (CallableStatement cs = conn.prepareCall(“{call dbo.TroublesomeSP}”)) { ResultSet rs = cs.executeQuery(); I get the […]

add java datatype <-> db datatype mappings

I initially generated the entitis from the database. Now there were certain DB datatypes which weren’t understoond by eclispelink, such as: DateTime2 Date They were just interpreted as strings. Since I am using Java 8 I use LocalDate and LocalDateTime on the java side. And I created a converter from java.sql.Timestamp to these to Types. […]

How do I map java.util.Date to sys.datetime

I am upgrading our JDBC driver to mssql-jdbc-6.2.1 so we can move to SQL server 2016. Everything works fine with the new driver except our reports. We have 6000+ reports that use java.util.Date. With the previous driver these were treated as DATETIME in SQL but the new driver treats them as DATE. The reports are […]

How to insert JSON data to sql server without converting into Java beans

My requirement is like, i have a json file data as below., {Key1: value1, key2: value 2,….} with file name example.json It should be inserted into sql server as, Take name: example Data as below, Id key1 key2 1 value 1 value 2 I’m searching for a solution such that, there won’t be any Java […]

Run sql script from jpa-hibernate ddl auto

Can’t find a solution in SO, so I’m trying to findout how to accomplish the goal here. I’ve a SqlServer 2014 db which accepts and runs fine a script (which does lots of things, mainly check if exist procedures, drop then, build them, run them and drop them… ). For example this simple statement: SET […]

all listview data insert only one row

I have a ListView with multiple rows. When I insert the entries in the ListView into an sql database, all the entries get inserted into a single row. I get all the entries from the view with a String builder. How can I solve this problem? StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new […]

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