Tag: java

SQL and Java return different dates?

I am using sqljdbc4.jar to connect SQL Server from my java application. I have a date field in my table. It works normally when I check from Sql Server Management Studio. But in java, every date is 2 day missing. For example; my date : 2012-01-10 date in java : 2012-01-08 PreparedStatement stmt = conn.prepareStatement(“SELECT […]

Java : save data from UTF-8 file into Sql Server 2008

I failed to save data with accents from utf8 file into my SQL Server 2008 table – SQL collation = SQL_Latin1_General_CP1_CI_AS – (when I do a System.out.print of my insert statement : the accents are OK). Here’s the steps I’m doing : 1) Convert file to String : File f = new File(file); byte[] buffer […]

Incorrect Syntax near 'Contribution'

I developed a Java application with MS SQL Server 2008 as database. I am using the JDBC drivers available on Microsoft’s website. It was working fine till now. But as the load increased, a lot of SQLServerException appeared. The query is INSERT INTO ANSWERS VALUES (‘pd’,’GK002′,’A’,’B’,”,”,’Yes’,’QUIZ012′) The exception is com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ‘Contribution’. at […]

how to get current date time in sql server?

I want to pass sys date to my procedure. Below is my code snippet DateFormat dateFormat = new SimpleDateFormat(“mm/dd/yyyy”); Date date = new Date(); String insertquery=”{ call sp_process_job (?,?,?) }”; cs = con.prepareCall(insertquery.toString()); cs.setString(1,id); cs.setString(2,host); cs.setDate(19,(java.sql.Date) date); cs.execute(); con.commit(); My stored Procedure create procedure sp_process_job (@request_id varchar(25),@host varchar(20),@created_on varchar(25)) as begin set dateformat mdy SELECT […]

Parse Apple plist with TSQL

I’m working with a SQL Server 2008 database that stores Apple plists in a column. I’m looking for a quick and dirty way to extract some of that information. I know SQL Server can do XML parsing. Since a plist isn’t true XML, is there anything out there that can help me query/manipulate the data? […]

Using SQLXMLBulkload via Java

Is it possible to use the SQLXMLBulkload component of SQL Server using Java? I am using SQL Server 2005 database for my Java EE application. If not then is there any similar API for Java?

How bad is the usage of nvarchar

Our software is deployed at a client site where they are having performance issues, they’ve hired a SQL consultant to look at the databases and see where their bottlenecks are. One of the things the consultant spotted was that a lot of our statements where converting to nvarchar. After some investigation I discovered that it […]

Java + how to read MS SQL DB bak file

I read & create MS SQL server created bak file in java. But for this prediction is MS sql server is not installed on that machine. Are there any tool / library with the help of that I can read/ write file?

PHP Server not connecting using JSON objects

I am not able to retrieve the data from the server. I am not sure where i have gone wrong in the code..When i run the application, the data from the server is not displayed on the emulator.. The code is given below private void postData1(){ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new […]

Migrating code previously accessing a MySQL server to access a MS SQL Server

I have a small app that is composed of Java servlets and the database server is a MySQL server. Now I have to move to a new server which runs Tomcat(thank god!) but for database it has SQL Server running in its stack. So is there a big change that I have to make in […]

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