problem about jtds-Collection of common programming errors


  • user2166757
    sql-server jtds slick
    I went through several iterations of trying different versions of the JTDS drivers with no luck. I switched to the Microsoft jar and have finally had some success.**** jtds driver config **** # Database configuration for M$ SqlServer # db.default.url=”jdbc:jtds:sqlserver:// an_ip_addy_to_a_server:1433/db_instance;user=user_name;password=user_password” # db.default.driver=net.sourceforge.jtds.jdbc.Driver**** M$ driver config **** # Database configuration for M$ SqlServer db.default.url=”jdbc:sqlserver:// an_ip_addy_to_a_server\db_instance:1433;user=user_name;password=user_password” db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriverDifferences??1) The sqljdbc4.jar is an, ‘unmanaged dependency’ : http://www.playframework.com/documentation/2.1.0/SBTDependencies 2) The URL strings are obviously different per the doc’s that I read on each.At least I can now start making some forward progress.-DaveI’m new to the Scala language and stack and have what I hope is a pretty easily solvable problem.Setup:Play2 (scala) Slick 1.0.0 SQL Server 2008 JTDS 1.3.0Whenever I start up the application and hit the initial page, localhost:9000 it appears the framework is attempting to get the connection to the database, but it’s throwing an exception:Any thoughts?*** Build.scala *** val appDependencies = Seq( // Add your project dependencies here, jdbc, “com.typesafe.slick” %% “slick” % “1.0.0”, “ch.qos.logback” % “logback-classic” % “1.0.9”, “org.scalatest” % “scalatest_2.10” % “1.9.1” % “test”, “com.h2database” % “h2” % “1.3.170”, “net.sourceforge.jtds” % “jtds” % “1.3.0” )*** application.conf *** # Database configuration for M$ SqlServer #db.default.url=”jdbc:jtds:sqlserver://server_name/server_instance;user=user_name;password=password” #db.default.driver=net.sourceforge.jtds.jdbc.Driver #db.default.user=user_name #db.default.pass=password db.default.defaultSchema=default_schema*** application.log *** 2013-03-08 14:29:06,950 – [INFO] – from play in main Listening for HTTP on /0:0:0:0:0:0:0:0:90002013-03-08 14:29:38,490 – [ERROR] – from com.jolbox.bonecp.hooks.AbstractConnectionHook in New I/O worker #1 Failed to obtain initial connection Sleeping for 0ms and trying again. Attempts left: 0. Exception: java.io.IOException: DB server closed connection.2013-03-08 14:29:38,540 – [ERROR] – from application in New I/O worker #1 ! @6dhc9mlf5 – Inte

  • Sean Adkinson
    sql-server jdbc c3p0 python-idle jtds
    Thanks in advance for any help!Here is the environment:Java 5 Web application running in Tomcat 6.0.18 on Windows (not sure the version) Database: SQL Server 2008 R2 JDBC Driver: jTDS 1.2.5 Connection pool provider: C3P0 0.9.1.2I am trying to debug a problem that a client is having. Basically every couple weeks, our web application locks up on their server, and they can’t access it. A restart fixes the issue. Further investigation shows that the reason everything is locked up is that everything is waiting on the database connections to return. I think the issue is likely with SQL Server, not C3P0.What I believe is going on is that C3P0’s “idle check query” is hanging. The query is this:select * from c3p0_connection_test_tableIt looks like this query is run, and the result is never returned. Here is what I see in my thread dump. Notice DefaultConnectionTester.activeCheckConnection(), which is the idle check:”com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2″ daemon prio=6 tid=0x0000000007c32000 nid=0x1250 runnable [0x000000001072f000]java.lang.Thread.State: RUNNABLEat java.net.SocketInputStream.socketRead0(Native Method)at java.net.SocketInputStream.read(SocketInputStream.java:129)at java.io.DataInputStream.readFully(DataInputStream.java:178)at java.io.DataInputStream.readFully(DataInputStream.java:152)at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:841)at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:722)- locked (a java.util.ArrayList)at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:466)at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:103)at net.sourceforge.jtds.jdbc.ResponseStream.peek(ResponseStream.java:88)at net.sourceforge.jtds.jdbc.TdsCore.wait(TdsCore.java:3928)at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1045)- locked (a net.sourceforge.jtds.jdbc.TdsCore)at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:465)at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1301)at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:73)at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:374)at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:310)at com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:1999)at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)But what could cause such a simple query to hang at reading from the socket? I don’t believe there would be any database locking on this table, as it is completely managed by C3P0 and never inserted/updated. Also, any failed attempts to get connections from the pool (if this were the cause of the hangin

  • Mahmoud Gamal
    sql-server-2005 jdbc spring-jdbc jtds
    All,I am trying to connect SQL Server named instance using Microsoft JDBC Driver as well as jTds.Both were giving different problems .Microsoft Driver issue : Connection URL : dataSource.setUrl(“jdbc:sqlserver://xx.xx.xx.xx;databaseName=DBNAM

  • fernacolo
    java sql-server jdbc glassfish jtds
    I have a Java EE application running on Glassfish and connecting to MSSQL Server 2008 through jTDS. For some unknown reason, the database connection becomes unexpectedly closed during requests. The application is huge, but here is a summary of how the error happens:During Glassfish setup, with create a connection pool with asadmin create-jdbc-connection-pool and asadmin create-jdbc-resource. The datasource class is net.sourceforge.jtds.jdbcx.JtdsDataSource.When Glassfish goes up, it calls our implementation of ServletContextListener.contextInitialized(), where we fetch the datasource from JNDI. The datasource is stored on a static variable.For a while, everything goes fine. All requests are handled and no connection is closed. Our application performs processing using Timer and MDB (Message Driven Bean) EJBs.This is a sample onMessage() implementation:public void onMessage(Message message) {this.message = message;this.connection = dataSource.getConnection(userName, password);try {doQuery1();doTransaction1();doTransaction2();doQuery2();doQuery3();} finally {this.connection.close();this.connection = null;} }Eventually, we start to get the following exception (happens about 100 times during one hour):java.sql.SQLException: Invalid state, the Connection object is closed.at net.s

  • user1825893
    java database applet jtds
    My intranet web application uses Java applets to connect to database. When one of the users tries to use the application the following error:java.sql.SQLException: The BUFFERDIR connection property is invalid. Restart connection. java.sql.SQLException: The BUFFERDIR connection property is invalid. at net.sourceforge.jtds.jdbc.ConnectionJDBC2.unpackProperties(ConnectionJDBC2.java:1241) at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:

  • Omu
    java jdbc connection-string jtds
    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.SQLException: Network error IOException: Connection refused: connectat net.sourceforge.jtds.

  • erikvold
    java jdbc export dbunit jtds
    I’ve got the following java code, which is giving the error below:import java.io.File; import java.io.FileOutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException;import org.dbunit.database.DatabaseConnection; import org.dbunit.database.IDatabaseConnection; import org.dbunit.dataset.IDataSet; import org.dbunit.dataset.xml.FlatXmlDataSet;public class export {public static void main(String[] args) throws Exc

Originally posted 2013-11-09 23:32:08.