Tag: java

OpenJPA 1 – sequence table not being created

I have an entity class with the following annotation on its primary key: @GeneratedValue(strategy = GenerationType.AUTO). However, when I try to persist an instance of this class, I get com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name ‘OPENJPA_SEQUENCE_TABLE’. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197) The table it’s looking for definitely does not exist in the database. The user it’s connecting to the database […]

What are the best practices for migrating an Oracle 10g database to Microsoft SQL 2008 R2? Application is using Hibernate

Basically what the title says. Going forward, we need to start supporting both database platforms (and will start writing migrations accordingly), but we need to do the first initial “port”. Our DBAs are confident they can convert the schema, tables, data types, etc. but our developers have less confidence that the DAOs will “just work”. […]

Connecting Android to SQL Server using JDBC

I am currently making an application for Android that is supposed to synchronize it’s data to MSSQL Server 2008. I am currently testing out ways to make it work, since I have never done it before. I should mention that the device will sync whenever it is connected to the USB port and not through […]

Java/MSSQL: java.sql.SQLException Invalid object name 'TableName'

I’m trying to move a java application from an old server to a new server. The application runs on Tomcat, uses Microsoft SQL Server as the backend DB, and used a system DSN defined in Data Sources (ODBC) to decide where to connect to. The old server used Windows 2000/SQL server 2000, the new server […]

Liquibase – checksum differs with different database vendors

I have a problem with Liquibase checksum when I try to run it on MSSQL and MySQL. In my MSSQL-base I have a changelog-entry with this checksum: 3:cf2f5de7a1dcc738bbc185e25fbcf6c9 When I run my liquibase against this database, it works just fine. Then, I copy the changelog-entry to my MySQL-database and try to run, and get this […]

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 […]

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