Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 TDS Protocol Error - Java

Author  Topic 

newbie16
Starting Member

8 Posts

Posted - 2012-07-22 : 21:24:14
Hello,

I have SQL Server 2000 on my virtual machine and I need to do some basic tests from my local.I am using Java.

I have the following statements in my java but it is failing. I would like to know if there is anything specific to be done.


@Test
public void testDatetime1() throws Exception {
DBCursor cursor = fSession.createStatement();
try {
cursor.execute("CREATE TABLE tab2 (VALUE DATETIME)");

Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(1999, 1, 23, 12, 34, 56);
Date date = calendar.getTime();
cursor.parse("INSERT INTO tab2 VALUES(?)");
cursor.setDateParam(1, date);
cursor.execute();

cursor.executeQuery("SELECT * FROM tab2 ");
cursor.next();
Assert.assertEquals(date, cursor.getDate(1));
}
finally {
cursor.forceClose();
}
}



My error is :
Jul 23, 2012 10:20:31 AM com.microsoft.sqlserver.jdbc.TDSReader throwInvalidTDS
SEVERE: ConnectionID:7 got unexpected value in TDS response at offset:71
com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid.

But after running the create statment, I was not able to see the table anywhere in my remote.

What am I missing here?
   

- Advertisement -