These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: error message using timestamp with MS-SQL 2000
PostPosted: Mon Apr 19, 2004 4:10 pm 
Beginner
Beginner

Joined: Thu Mar 25, 2004 9:13 am
Posts: 20
Hi there, I am using a timestamp as follows (Hibernate 2.1):
Code:
<property name="creationTimeStamp" type="timestamp" column="NET_CREATION_DATE"/>


The is a TIMESTAMP in my SQL2000 server, and the property is mapped to:
Code:
public java.sql.Timestamp getCreationTimeStamp() {
        ...
    }

    public void setCreationTimeStamp(java.sql.Timestamp timestamp) {
        ...
    }


Yet I am getting the following error message:
Code:
java.sql.SQLException: Disallowed implicit conversion from data type datetime to  data type timestamp, table 'snap.dbo.SSN_NETWORKS', column 'NET_CREATION_DATE'.  Use the CONVERT function to run this query.


What am I missing here?



TIA Oren

_________________
Oren Gross


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 4:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Probably use another driver, try the jdts driver.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 4:16 pm 
Beginner
Beginner

Joined: Thu Mar 25, 2004 9:13 am
Posts: 20
It is the JTDS driver...
Code:
hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver

_________________
Oren Gross


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 4:47 pm 
Beginner
Beginner

Joined: Thu Mar 25, 2004 9:13 am
Posts: 20
I also tried sprinta2000 by inet...

Code:
hibernate.connection.url=jdbc:inetdae:localhost:1433?database=dbname
hibernate.connection.driver_class=com.inet.tds.TdsDriver


I am getting the following error:
Code:
Disallowed implicit conversion from data type varchar to data type tim
estamp, table 'snap.dbo.SSN_NETWORKS', column 'NET_CREATION_DATE'. Use the CONVERT function to run this query
.

To make it clear, when I use jTDS, I use 0.7.1 as follows:
Code:
hibernate.connection.url=jdbc:jtds:sqlserver://localhost/dbname
hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver

_________________
Oren Gross


Top
 Profile  
 
 Post subject: Re: error message using timestamp with MS-SQL 2000
PostPosted: Wed Apr 21, 2004 3:25 am 
jTDS Developer
jTDS Developer

Joined: Tue Feb 24, 2004 5:36 pm
Posts: 70
Location: Bucharest, Romania
The TIMESTAMP of SQL Server is not the same as the Java Timestamp. It's a read-only binary column automatically updated by SQL Server when the row is altered (it's used for replication and optimistic concurrency among others).

So just declare your column as DATETIME instead and it should work.

Alin.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.