jtds

jtds No Suitable Driver Exception when running a maven built project

We have a simple spring-hibernate application(console app) where in we have set the classpath in manifest file of the executable jar file. And the app connects to the database using jtds driver, Everything works as expected on windows machine and jdk1.6. But on Linux, the app is unable to find the driver, We are running the program usin...

SQL Server connection management in Tomcat 6

We are having trouble with a Java web application running within Tomcat 6 that uses JDBC to connect to a SQL Server database. After a few requests, the application server dies and the in the log files we find exceptions related to database connection failures. We are not using any connection pooling right now and we are using the stand...

What MS SQL Server types map to Types.VARCHAR

I'm working on a statement scanner for our updater (looking for statements that will cause problems with synchronized data) and I need to know which TSQL data types get resolved as Types.VARCHAR and which ones resolve to Types.LONGVARCHAR when you invoke DatabaseMetaData.getColumns()? ...

Number of sockets available for a JDBC connection at Windows 2003

My team built a Windows Service in Java that connects to a SQL Server 2005 in a Windows 2003 Server, using pure JDBC (no connection pooling) with the JTDS driver. After a while, the method that opens the connections to the database start raising exceptions with the following stack trace: java.net.BindException: Address already in u...

java : non-static variable cannot be referenced from a static context Error

the following code is generating an error on the variable con2 saying "non-static variable con2 cannot be referenced from a static context Error." I googled for a resolution and they are suggesting the variable isn't initalized yet to make the methods available. Am I initializing this incorrectly? i also tried changing things to publi...

Is it possible to run multiple DDL statements inside a transaction (within SQL Server)?

Hi, I'm wondering if it is possible to run multiple DDL statements inside a transaction. I'm specially interested on SQL Server, even though answers with other databases (Oracle, Postgre at least) could also be interesting. I've been doing some "CREATE TABLE" and "CREATE VIEW" for the created table inside a transaction and there seems ...

What is the jTDS JDBC Connect URL to MS SQL Server 2005 Express

I'm trying to connect to a MS SQL Server 2005 Express database that is running on the local host from a java program. I have tried the same connect URL (below) that I used on another system (same jave code) that was running MS SQL Server 2000. But that does not work. jdbc:jtds:sqlserver://127.0.0.1:1433/Finance Any ideas? ...

Using JTDS driver

Hi Everyone I just want to know your opinion. I have here a situation. I have a almost release ready (release in 2 month) application that runs queries on the microsoft Sql-Server database.We use the standard Microsoft jdbc driver implementation for sql-server. Works great,no problems. Now there come a developer to me and says that i ...

SQL Server JBDC Driver comparison

Currently we use jtds for connecting to our SQL Server databases. I've always taken it for granted that we use it due to performance and reliability reasons, however, it's usage pre-dates my employment. All of that being said, we are now playing with the idea of moving to SQL Server 2008, which jtds has limited support for. Initial tes...

Is there an alternative to ParameterMetaData that can tell you valid parameter names

MSSQL has an interesting JDBC inconsistency. Regarding the parameters on a stored procedure, when you access their names, they are referenced with an @ sign in front of them (the way they are declared in the stored procedure). When you use a callable statement to set parameters by name, however the Microsoft JDBC driver requires you to ...

connecting groovy to sql server

I am trying to connect a simple groovy script to the DB. Code: import groovy.sql.Sql class GroovySqlExample2{ static void main(String[] args) { def sql = Sql.newInstance("jdbc:sqlserver://MYSERVERIP", "uname", "pwd", "net.sourceforge.jtds.jdbc.Driver") sql.eachRow("select * from word"){ println it.spelling +...

JDBC-driver / SQL Server recompiles my prepared statements all the time when they contain ROW_NUMBER()

I've noticed that prepared statements containing ROW_NUMER() code often gets recompiled although their SQL-code hasn't changed. (example from book Inside Microsoft SQL Server 2008: T-SQL Querying): WITH SalesRN AS ( SELECT ROW_NUMBER() OVER (ORDER BY qty, empid) AS rownum, empid, mgrid, qty FROM dbo.SalesOrder ) SELECT r...

Using Sybase ASE 12.5.4 with jTDS drivers with JRuby

Problem I am trying to build a small ruby script - which will be run using jruby once a day - to connect to a Sybase ASE 12.5.4 database and perform a complex query. Ultimately I intend to do some processing on the data and insert the new data in a MySQL table for use within a rails application. Environment jruby v1.4.0 java v1.6.0...

Stored proc running 30% slower through Java versus running directly on database

Hi All, I'm using Java 1.6, JTDS 1.2.2 (also just tried 1.2.4 to no avail) and SQL Server 2005 to create a CallableStatement to run a stored procedure (with no parameters). I am seeing the Java wrapper running the same stored procedure 30% slower than using SQL Server Management Studio. I've run the MS SQL profiler and there is little...

is it possible to get the query plan out using jdbc on sql server?

I am using the JTDS driver and I'd like to make sure my java client is receiving the same query plan as when I execute the SQL in Mgmt studio, is there a way to get the query plan (ideally in xml format)? basically, I'd like the same format output as set showplan_xml on in management studio. Any ideas? Cheers, -James Some code f...

Help me create a jTDS connection string

my sql server instance name is MYPC\SQLEXPRESS and I'm trying to create a jTDS connection string to connect to the database 'Blog'. Can anyone please help me accomplish that ? I'm trying to do like this: DriverManager.getConnection("jdbc:jtds:sqlserver://127.0.0.1:1433/Blog", "user", "password"); and I get this: java.sql.SQLExcepti...

Problem in using indexes with SQL Server 2005 and Hibernate

I've a problem with a query generated by Hibernate that do not uses an index. Access to database is made from Java using JTDS and server version is SQL Server 2005, latest service pack. The field is nullable and is a foreign key that, in some specific scenarios, could be completely null, column is indexed via a not clustered index but t...

Why JPA, Hibernate and jTDS always uses varchar(8000) for String columns?

I'm using JPA (Hibernate) and jTDS as my jdbc driver. Whenever the datatype of my entity columns are String, the created prepared statement uses varchar(8000) as its parameter. I've already tried to use @Column(length=50) in my mappings for example, but it seems to be ignored. If I set sendStringParametersAsUnicode in jTDS connection, i...

sql server network error

hi i am using sql server 2005 for my servlet jsp project, i am connecting it using jtds jdbc driver. the problem is it is working really good for 3 to 4 days but after that it throws error "Network Error IO Exception : Access Denied" unable to read file blah, blah .... then i have to detach the database and then attach it to mak...

"Invalid SQL statement or JDBC escape, terminating '}' not found." with jTDS and Sybase.

I'm calling a stored procedure via ibatis. It works, and has worked, when using the jconn2.jar (5.5). When I swap it out for the jtds jar (1.2.5) I get an exception "Invalid SQL statement or JDBC escape, terminating '}' not found." For more transparency I'm using Spring with DBCP. Obviously the parsing of the SQL code in jTDS is not bei...