Tag: java

com.microsoft.sqlserver.jdbc.SQLServerException: The “variant” data type is not supported

I want to create simple Java code which displays MSSQL server version: public void testMSSQLVersion() throws Exception { System.out.println(“\nTesting SQL query for MSSQL version\n”); try { // Load the SQLServerDriver class, build the // connection string, and get a connection Class.forName(“com.microsoft.sqlserver.jdbc.SQLServerDriver”); String connectionUrl = “jdbc:sqlserver://localhost:1433;” + “database=master;” + “user=admin;” + “password=dss!Q;”; Connection con = DriverManager.getConnection(connectionUrl); […]

Apache solr configuration with tomcat 6.0

Can you help me configuring Apache Solr using Tomcat and how to index in MS SQL database using Solr. What are the steps to configure Tomcat to run Apache Solr in Tomcat.

Return an array after querying database in Java

I have to query a MSSQL database and I want the result of the query to returned as a Array or ArrayList. I have a this code now, but it gives an error. I have a connection to the database so that’s not the problem. public ArrayList<Array> queryResult(String q) throws SQLException { ArrayList<Array> array = […]

Poor performance using Hibernate Criteria API

I have a Java application using Hibernate to communicate with a MsSQL 2005 server, the driver is net.sourceforge.jtds 1.2.4. Things are working but the performance is horrible, I suspect the index isn’t used for the queries passed to it, since the response times are proportional to the number of entries in the table. I have […]

SQLException during executeBatch() when I'm handling BatchUpdateException

I’m having some trouble with this. I’m trying to list some data about the queries that failed during an executeUpdate() and I have read that BatchUpdateException can be caught and then get the updateCount, that tell you which queries worked and which not, but when a query fails because a bad data conversion, it launches […]

ClassNotFoundException when connecting to MS SQLServer using JDBC

I’m trying to connect to a MSSQL using the MS JDBC Driver (Microsoft SQL Server JDBC Driver 3.0: http://www.microsoft.com/download/en/details.aspx?id=21599) but what every i do i get java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver when i run the project in Netbeans. I am running Netbeans 7.1 on Windows 7 Enterprise 64-bit. I have gone through quite a few guides on the […]

how to add sqljdbc_auth.dll to my maven project

I am trying to establish connection to database. It’s a simple project with using maven. I have problems with sqljdbc_auth.dll I have added mssql jdbc driver and added a dependency in pom.xml <dependency> <groupId>com.microsoft</groupId> <artifactId>mssql-jdbc</artifactId> <version>4.0.0</version> </dependency> This is my try block try { // Establish the connection. SQLServerDataSource ds = new SQLServerDataSource(); ds.setIntegratedSecurity(true); ds.setServerName(“BUILDSRV”); […]

Different representation of UUID in Java Hibernate and SQL Server

I am trying to map a UUID column in POJO to SQL Server table column using Hibernate. The annotations are applied as follows: @Id @GeneratedValue @Column(name = “Id”, columnDefinition = “uniqueidentifier”) public UUID getId(){ … } However, it seems that there is some endianness problem between the Java Hibernate mapping and SQL server. For example, […]

How to connect Android Studio with SQL Server database

First, just tell me right off the bat if my attempts are futile by trying to connect Android Studio, a JVM-based IDE, with MS SQL Server. I do understand Oracle or MySQL would be better. However, I would like to try it. I have successfully accessed a SQL Server database using Eclipse by adding an […]

android application not connecting to mssql server 2008

this is my layout.xml <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” tools:context=”.MainActivity” > <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/t1″ /> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/t2″ /> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/t3″ /> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/t4″ /> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/t5″ /> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/btn2″ /> </LinearLayout> this is my activitymain.java package com.example.mssqlconnect; import android.os.Bundle; import java.sql.*; import net.sourceforge.jtds.jdbc.*; […]

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