SQLserver 1 « SQLserver « Java Database Q&A





1. Java + SQL Server - a viable solution?    stackoverflow.com

I'm going to start a new project - rewriting an existing system (PHP + SQL Server) from scratch because of some very serious limitations by design. We have some quite good knowledge ...

2. Is there a class or method in Java that will check if a string is a SQL Server keyword?    stackoverflow.com

I want something that can check if a string is "SELECT", "INSERT", etc. I'm just curious if this exists.

3. How does the SQL Server JDBC Trusted Connection Authentication work?    stackoverflow.com

How does the SQL Server JDBC Trusted Connection Authentication work? (ie how does the trusted connection authenticate the logged in AD user in such a transparent and elegant fashion and how ...

4. How can I change the database schema using a Statement.execute() in Java ( and SQL Server)?    stackoverflow.com

I need to execute a SQL Server system stored procedure, programmatically, and since it executes in the current schema, I need to change it on the fly. Like this Statement st = connection.createStatement(); st.execute("EXEC ...

5. Accessing an SDF SQLServer Mobile file from Java    stackoverflow.com

Here at work we want to access the data inside a .sdf file generated in a PDA with SQLServer Mobile Edition. We use the SqlJDBC4 packet for JDBC but can't get ...

6. Is there any library/framework for undo/redo changes of rows in database?    stackoverflow.com

May be my title is not clear. I am looking for some kind of version control on database tables, like subversion does on files, like wiki does. I want to trace the ...

7. How to use SQL Server Compact Edition (CE) from Java?    stackoverflow.com

I want to access Microsoft SQL Server Compact Edition databases from Java. How can I do that? I searched for JDBC driver for SQLCE, but I didn't find any.

8. Can Paradox 4.5 be set up on a server?    stackoverflow.com

I have established a link using Netbeans and Paradox driver and can query the database. Can Paradox 4.5 (Borland) be set up on a server so that the database can be ...

9. What's the best new development tool of 2009?    stackoverflow.com

I am looking to do a presentation at work to our development team. I was wondering if their is any new tool which would be easy to demonstrate. It is just ...





10. NaN value in float field in MSSQL    stackoverflow.com

I'm working on a java application,use double type to save value of unitprice,qty etc.I found some of these values show in MSSQL are NAN and throws infinite error when I try to ...

11. Restricting a SELECT statement in SQL Server 2005    stackoverflow.com

I have a situation where before doing a particular task I have to check whether a particular flag is set in DB and if it is not set then rest of ...

12. uniqueidentifier in Sql Server database - how to generate in Java environment?    stackoverflow.com

I have a database table that uses Sql Server 2005's uniqueidentifier column. I know how to create GUIDs in C#...

string newid = System.Guid.NewGuid().ToString();
However, the application that is inserting into this database is ...

13. Programming decision java or .Net, db or no db    stackoverflow.com

I am stuck while making a programming decision, I am a .Net developer, I am currently building an application for my client that receives data from a third party application, it has ...

14. Login Problem Windows Authentication    stackoverflow.com

Duplicate of: http://stackoverflow.com/questions/881928/windows-authentication-trusted-connection-problem I logged in the Windows Server(Machine 1) as "abc\user1 ". Windows Server machine is in abc domain. MSSQL Server is in the "abc" domain on Machine 1 and have ...

15. Too many parameters were provided in this RPC request. The maximum is 2100.?    stackoverflow.com

A search query returned this error. I have a feeling its because the in clause is ginormous on a subordinant object, when I'm trying to ORM the other object. Apparently in clauses ...

16. ClassNotFoundException: com.microsoft.sqlserver.jdbc    stackoverflow.com

When I ran my web application under Eclipse IDE everything worked fine. But when I exported my project into war-file and deployed in tomcat I've got following message:

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc
I've tried putting sqljdbc4.jar ...





17. How can I make MS SQL Server available for connections?    stackoverflow.com

I'm trying to connect to MS SQL Server (running on my machine) from a Java program. I'm getting the following long winded exception: Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection ...

18. Arabic text displaying in webapp without db changes    stackoverflow.com

When a user enters arabic name and password I am supposed to retrieve data for that user.In java I am using utf-8 encoding I am supposed to retrieve data in the form ...

19. How to avoid dupicate request?    stackoverflow.com

If i click a link ia m calling a servlet. Is there any possibility to track the duplicate request thru filter or something so that i can avoid hitting the servlet?

20. How to make Java work with SQL Server?    stackoverflow.com

I know this is a basic question, but I can't seem to find an answer and I apologize, if this question is way too stupid, but here we go: I am supposed ...

21. DBUnit and SQL Server getting a socket closed    stackoverflow.com

I keep getting this exception with DBUnit in the same place:

org.dbunit.dataset.DataSetException: com.microsoft.sqlserver.jdbc.SQLServerException: Socket closed
at   org.dbunit.database.DatabaseTableMetaData.getColumns(DatabaseTableMetaData.java:359)
etc.
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Socket closed
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(Unknown Source)
at ...

22. CallableStatement setString - Unsupported character(s)?    stackoverflow.com

I have a Java application decoding a UTF-8 encoded String received over the wire and saving it to a varchar column in my database (SQL Server 2000). I am saving ...

23. Precision nightmare in Java and MSSQL    stackoverflow.com

I've been struggling with precision nightmare in Java and MSSQL up to the point when I don't know anymore. Personally, I understand the issue and the underlying reason for it, but ...

24. Screencast or video for Database programs in JAVA    stackoverflow.com

Can someone point me towards a good video tutorial that teaches how to connect to a database (preferrably SQL Server) USING JAVA TO insert data? Thanks

25. fastest way to query database in java    stackoverflow.com

I have a MSSQL Database, and I have a stored procedure for any possible query, most of them just return a row of data with 3 columns or just execute an ...

26. java:getting sqlexception message "incorrrect syntax near '{' "    stackoverflow.com

platform :sql server 2000 java 1.4

String queryStringForCustomer = "{call MIGRATE_CUSTOMERS_FILE(?,?)}";
String queryStringForCard = "{call MIGRATE_CARDS_FILE(?,?)}";
for(int i=0;i<recordIds.size();i++)
{
 if(FileType.equals("1")){
  callableStatement = connection.prepareCall(queryStringForCustomer);
  callableStatement.setString(1,(String)recordIds.get(i));
  callableStatement.setInt(2, 0);
  callableStatement.execute();
 }else {
  callableStatement = ...

27. java:not able to set auto commit mode with value false in java 1.4 api?    stackoverflow.com

sql server 200 java 1.4 jboss 3 HI am getting exception message "You cannot set autocommit during a managed transaction" code is below

    try {
    try {
    ...

28. What would be a best way to notify an application (C++ or Java) when underlying DB changes?    stackoverflow.com

I'm writing a C++ console application that needs to respond to a change in a specific field of a database table. Though I can keep sending a query to check the ...

29. SQL Server 2005 + JavaEE application on one computer in production    stackoverflow.com

We have project with a server witch have about 3000 requests at day from client. 30-40 on-line users. And smth about 30-40Gb data increase per year. And system should be on-line 24x7. Where can ...

30. Connection problem in Win2k3 server 64 bit with JDBC    stackoverflow.com

DriverManager#getConnection() returns null when I am deploying my JSP/Servlet package in a Windows 2003 Server environment (64 bit). The database is Microsoft SQL 2005 Enterprise Edition. The code is:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:calsoft2k","xxx","xxx");
The same ...

31. iBatis.Net SQL Server Compact Edition 3.5    stackoverflow.com

I want to migrate one of our databasis from SQL Server Express to SQL Server Compact 3.5. I'm using iBatis.Net but do not know what the providers.config must look like for me ...

32. SQL Server Windows Authentication using a Service    stackoverflow.com

I am running a Java Application as a Service in Windows that's using JDBC to connect to SQL Server. This application is started as a different user than the one logged ...

33. How to access a UniqueIdentifer column from Java's JDBC-ODBC bridge    stackoverflow.com

I'm currently working on a java program that will access an Microsoft SQL Server using the JDBC-ODBC bridge driver provided in the Java distribution. Everything seems to be setup correctly and I ...

34. Run sqlcmd without having SQL Server installed    stackoverflow.com

I'm working on a Java program that is calling sqlcmd. It works perfectly on a computer with SQL server installed, but not at all on a computer that doesn't. ...

35. JDBC SQL Server Database Migrations    stackoverflow.com

I'm working on a Java web application (Adobe Flex front-end, JPA/Hibernate/BlazeDS/Spring MVC backend) and will soon reach the point where I can no longer wipe the database and regenerate it. What's the ...

36. What do I do about a Java program that spawned two instaces of itself?    stackoverflow.com

I have a java JAR file that is triggered by a SQL server job. It's been running successfully for months. The process pulls in a structured flat file to a staging ...

37. Problem after assigining port number to MSSQL2005 named instance:Service won't start    stackoverflow.com

I'll like to combine both my initial problem which leads me to this one and this one.

  1. my first problem was to be able to connect jaspersoft ireport 3.7.0 to MSSQL2005.I ...

38. How determine database server IP via UDP in Java    stackoverflow.com

I am writing clients in Java that store the data on a database server. So far, the IP and Port of the server has to be specified in the client's settings ...

39. updateBinaryStream on ResultSet with FileStream    stackoverflow.com

If I try to update a FileStream column I get following error: com.microsoft.sqlserver.jdbc.SQLServerException: The result set is not updatable. Code:

System.out.print("Now, let's update the filestream data.");
FileInputStream iStream = new FileInputStream("c:\\testFile.mp3");
rs.updateBinaryStream(2, iStream, -1);
rs.updateRow();
iStream.close();
Why is this? Table ...

40. Simple select not working on JDBC SQL Server?    stackoverflow.com

I am trying to move project which was using MySQL database to the one that uses SQL Server 2008, But the select that was working in mysql is no longer working ...

41. Drop all tables in sql server database using ant script    stackoverflow.com

Can anybody help me with this? I prefer if I don't have to explicitly list the table names.

42. How to group a database write and spreadsheet write in single "transaction"    stackoverflow.com

I have a Java program that writes results to both a DB (SQL Server) and a spreadsheet (POI), and it would be best if neither is written to if there's an ...

43. Need help with writing from XML to a SQL Server database (detailed)    stackoverflow.com

I'm a bit of a newbie with XML and WebServices and stuff like that. I'm working on a project using GlassFish OpenESB to schedule a process to get some information from a ...

44. Solr DataImportHandler with SQL Server    stackoverflow.com

I'm having a problem getting Solr to talk to Microsoft SQL Server via the Microsoft JDBC Driver. I have the handler registered in solrconfig.xml:

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
  <lst name="defaults">
   ...

45. JDBC url with database containing spaces    stackoverflow.com

I'm trying to connect to a SQL Server database using JDBC, the database I'm trying to connecto to contains a space, and unfortunately I have no control over the name, so ...

46. how to solve this problem? java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver    stackoverflow.com

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) ...

47. JDBC Change Default Schema    stackoverflow.com

I'm trying to connect to a sql server 2005 database via JDBC. I get the error: com.microsoft.sqlserver.jdbc.SQLServerException: The SELECT permission was denied on the object 'MyTable', database 'MyDatabase', schema 'dbo'. The schema ...

48. What's the most efficient way to bulk-copy to SQL Server from Java?    stackoverflow.com

I have data that is streamed from disk and processed in memory by a Java application and that finally needs to be copied into SQL Server. The data can be fairly ...

49. What is the best way to log to SQL Server from Java EE    stackoverflow.com

I have a web service Jax-RS running in Weblogic. I have a need to logg the calls made to the service. What is the best way to log to SQL Server ...

50. How do I convert a Joda Time DateTime object into a String in SQL Server format?    stackoverflow.com

I am using the Java Joda Time library, and have a date and time stored as an org.joda.time.DateTime object. How can I reliably convert this DateTime object into a String that will ...

51. Creating server side cursors    stackoverflow.com

com.microsoft.sqlserver.jdbc.SQLServerException: The system is out of memory. Use server side cursors for large result sets:Java heap space. Result set size:280,236,031. JVM total memory size:423,297,024.
I am trying to fetch ...

52. Netbeans 6.9 to SQL Server 2008 R2: "cannot resolve collation conflict..."    stackoverflow.com

I'm trying to connect to a SQL Server 2008 R2 Express on my local workstation but keep getting an error. In Netbeans 6.9, in the New Entity Classes from Database wizard, I ...

53. web service in java related problem    stackoverflow.com

i want to bulid an web service application using java. main theme is i want to create a student database and users of the system will view a particular students ...

54. create sql server table function thru java    stackoverflow.com


I used a simple sql statement for testing purposes if it is possible to create a table function thru java.
However, it takes a very long time for the creation of function ...

55. SQL Server Query Notification with java    stackoverflow.com

Is there a java equivalent to c# SqlDependency class? Is there any way to use SQL Query notification in java ?

56. Can I use JBoss AS 5 or 6 with a Firebird or InterBase SQL server?    stackoverflow.com

Today I tried to configure a JDBC resource in the JBoss AS 6 RC1, and encountered a field which requires a RAR name. If I have a database with a JDBC ...

57. spell check and singular/plural check in VB/Java/SQL    stackoverflow.com

Im basically trying to do a simple search utility in my SQL Server database. Need to search for "different form of words" typed by the user including spell check, singular/plural. Having the ...

58. performing auditing in java with sql server DB - before and/or after do not get audited    stackoverflow.com

When auditing, sometimes the before value does not get audited, other times the after value does not get audited, other times both values do not get audited at all. After researching, I ...

59. Architecture question for performance and scalability    stackoverflow.com

I have a high performance system (well I think, but not yet there 100% ) written entirely in C# and I think I have made some big architectural mistakes while designing. ...

60. SQL Server Libraries for Java    stackoverflow.com

I'm curious to find what SQL Server libraries are available for Java. At present we are using the com.microsoft.jdbc.sqlserver.SQLServerDriver driver. I think this was downloaded from the Microsoft site a while ...

61. How does one call a SQL server function (UDF) properly using IBatis.Net/MyBatis.Net?    stackoverflow.com

So I've been using IBatis for a couple of years now, and I know it pretty well, but I can't figure out how to call a function. It's a simple function ...

62. soapUI access MS SQL DB from groovy script    stackoverflow.com

I am trying to connect to MS Sql 2005 DB from SoapUI using Groovy script.

import groovy.sql.Sql

sql = Sql.newInstance("jdbc:jtds:sqlserver://servername\\inst1/databaseName", 
     "username", "password", "com.microsoft.sqlserver.jdbc.SQLServerDriver")
Error: No suitable driver ...

63. Specific Query runs fine directly or when any change to it is made but in current state takes longer to run    stackoverflow.com

Major Update after a couple days of debugging: I run a few queries similar to :

SELECT RTRIM(part) as part 
FROM tableP pm 
LEFT join tableS s on pm.id = s.id 
INNER JOIN ...

64. SQL server stub for java    stackoverflow.com

I have a java application that is using MSSQL server through the JDBC driver. Is there some kind of stub that I can use for testing? For example I want to ...

65. SQL Server: Syntax near keyword 'CREATE' when batch executing CREATE SCHEMA and CREATE TABLE    stackoverflow.com

I'm trying to set up an SQL Server 2008 database using JDBC (latest version). I have a list of setup sql commands which I'd like to execute all together: Basically what I do ...

66. JDBC on SQL Server, executeQuery() cannot find the result with null    stackoverflow.com

I use jdbc to retrieve data from SQL Server, and ANSI_NULLS is off . So if I run

select * from cj_log where evt = null
I can get the result. But when I ...

67. JDBC OLEDB .bin    stackoverflow.com

Does anyone know of a good place to find a Java binary for connecting to MSSQL? I've already tried Microsoft's provided JDBC bin, however I would like to try an ...

68. JBoss vs. Sql Server    stackoverflow.com

I get error

org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1966 has failed. Error: "Connection refused: connect. Verify the connection properties, check ...

69. Why I don't get a connection? Java.. SQL Server Express Edition (server)    stackoverflow.com

Where do I have a bug? A mistake? Why can't I connect? My code,

    package conexiones;
    import java.sql.DriverManager;
    import java.sql.Connection;

   ...

70. JDBC commit(): what happens behind the scenes?    stackoverflow.com

I'm helping with a deadlock hunt. The environment: Tomcat 5.5, Java 5, Microsoft SQL Server 2008, jTDS (replacing an old driver). We have a legacy connection pool. The database code always follows ...

71. master/worker in sql server without locks    stackoverflow.com

What would be the best way to implement master-worker approach using ms sql-server? I.e., one java process (master) puts data to the table(s) and one or more java processes (workers) retrieve ...

72. What's the maximum I can afford to cache?    stackoverflow.com

I have some design issue, Lets say you have an application that stores data into its cache during runtime, what do you think is the maximum amount of data (in mb) an ...

73. Application not running on 64 bit machine    stackoverflow.com

I am woking on windows server 2008 r2. I have installed 32 bit ms sql server express edition, and 32 bit jdk ,jre. after i create the dsn to connect to ...

74. How to set lock wait timeout in SQL Server    stackoverflow.com

how do i set a lock wait timeout in sql server? Is there anyway that I can specify maybe through JDBC or a configuration script that I can use? I want to make sure ...

75. How to Generate Matching MD5 Hash: SQL Server nvarchar Field vs. ColdFusion    stackoverflow.com

I am trying to figure out how to generate a matching MD 5 hash value between SQL Server and ColdFusion. The root cause appears to be that the SQL Server field ...

76. Is there a way to determine if JDBC transaction is in effect?    stackoverflow.com

I am calling several SQLServer 2008 stored procedures through JDBC. I would like all these proc calls to be a part of the same transaction. On java side I have the equivalent of ...

77. Java NetBeans JDBC Connection working in Debug, not in Run    stackoverflow.com

I'm building a little internal tool (non-production code) that gets some stuff from our MS SQL DB. I wanted to try out NetBeans 6.9.1 so am using that. I have this ...

78. Integrating a java application to SAP business one    stackoverflow.com

I am planning to develop a java se payroll application that connects to a Microsoft SQL database...same as is used in the SAP business one version 8.81 that I want to ...

79. SQLServerException when using CallableStatement.setObject(int,Object)?    stackoverflow.com

Quick question, why am I getting the below exception when using the following code; Note this is using Java to call into MS SQL Server 2008 R2 using stored procs.

Connection con = ...

80. Sleeping connections in SQL Server    stackoverflow.com

Not being a database administrator (even less of a MS database admin :), I have received complaints that a piece of code I've written leaves "sleeping connections" behind in the database. My ...

81. Change of design of queries to improve performance    stackoverflow.com

This is more like a design question but related to SQL optimization as well. My project has to import a large number of records into the database (more than 100k records). In ...

82. java (jdbc, ms sql server) how to get an indication that my query was executed?    stackoverflow.com

My application does queries to database (non-queries too). I show to the user indeterminate progressbar while transaction. The problem is that I don't know when to close the progressbar, because ...

83. SQL Server query behaves differently interactively than over JDBC - omits some tables    stackoverflow.com

I've been trying to retrieve constraint data for all tables using an SQL query over JDBC. My test database has only 3 tables. If I execute the query interactively using MS SQL Server ...

84. j2me + direct access to MS SQL Server    stackoverflow.com

It is possible to access MS SQL Server from j2me directly without any webservices? I'm new to Mobile programming, but I need to create a small application on Pocket PC (WinCe 5.0) ...

85. BCP exits with code 0    stackoverflow.com

When running BCP from my Java application it exits with status code 0 when 1 is expected. I run bcp with an invalid combination of data and formatting file and bcp gives ...

86. need help for Formatting time in eclipse-rcp while accessing through the database    stackoverflow.com

i have use the DateTime Control that shows only time i have declare it as

DateTime timeTo= new DateTime(cmpGrid, SWT.BORDER | SWT.TIME);
i have Declare the Column TimeTo as a dataType Time ...

87. how to convert the time from the database field into integer for hours, minutes, seconds separately through java?    stackoverflow.com

i am using the DataType Time in my database it stores the data in the form as 01:23:14.0000000. i am using dateTime controls of sWt as

DateTime dateTime = new DateTime(cmpGrid, SWT.BORDER | ...

88. Invalid object name    stackoverflow.com

When doing...

select * from students
I get a "Invalid object name" error. Basically, I think I can see the problem in that the tables are prefixed with an object name rather ...

89. what is the range or ms sql xml argument?    stackoverflow.com

I am using mssql with j2ee spring framework. When insert a data to a table, i am using bulk insert with xml argument in mssql. Can you anyone say how much data ...

90. Using sqljdbc4.jar for windows authentication in integrated security mode    stackoverflow.com

All, this is in reference to the question I have asked earlier: Using windows authentication with sqljdbc.jar Based on the MSDN blogs that I have gone through.... It looks like I also need the ...

91. jdbc string sql server character encoding    stackoverflow.com

If I have a jdbc string such as...

jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]
How do you say "connect with character encoding as utf-8 like you can if you were connecting with mysql? Thanks,

92. Validating SQL Server installation presence using Java    stackoverflow.com

I am trying to write a program in Java which has to check if SQL Server (2008) is installed on a particular machine. Is checking the registry entry the only solution? ...

93. How to bind DataSource using context.bind. Connection pooling etc    stackoverflow.com

I created a simple java project in NetBean 7.0 and added jar file sqljdbc4.jar for MS SQl support. I created a class where i have created a datasource (code below) for ...

94. How to get sqlserver database name from datasource name in Java    stackoverflow.com

As specified in the title, I want to get the database name in sqlserver, all info I know is datasource name, login name/password to get the Connection object, please show some ...

95. How can I get sql server database name from DatabaseMetaData object    stackoverflow.com

I am wondering how can I get the database instance name from DatabaseMetaData, or is there any way I can do that, kind of stuck here, thanks for any pointers! How ...

96. how to do jdbc connection with sqlserver2000?    stackoverflow.com

here is the code

import java.*;
public class Connect{
     private java.sql.Connection  con = null;
     private final String url = "jdbc:microsoft:sqlserver://";
     ...

97. SQL Server FIRST function via JDBC    stackoverflow.com

I am building an application in cold fusion which has a SQL Server database connection. I need group records and only return the first in the group. I wrote the following ...

98. How to support support SqlServer's ".." in HyperSQL?    stackoverflow.com

tl;dr: I am trying to unit test some SqlServer queries which state the db name but they do not seem to work in HyperSql.


We are using Sql Server in production and ...

99. IKVM + DatabaseLoader = Classpath issue    stackoverflow.com

Weka in .net through IKVM works great. The tutorial in Wiki is lots of help. However, I think the way that weka loads the jdbc jar file is causing some problems in ...

100. Best way to convert Jackson to JDBC Recordset for SQL Server CRUD updates?    stackoverflow.com

I'm sucessfully sending JSON from the client using jQuery to the server which has Guice bindings to Jackson using bind:

        bind(MessageBodyReader.class).to(JacksonJsonProvider.class);
    ...