I saw in the documentation that the Microsoft JDBC driver does not work with Hibernate. However, what I can't find is information on using the Microsoft SQL 7 ODBC driver throught the JDBC-ODBC bridge. Does this work? I could not get the example code to run with this combination. The tables seemed to be created okay, but then I get the following error (full stack trace is below.)
[java] 09:22:07,484 WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: S1C00
[java] 09:22:07,531 ERROR JDBCExceptionReporter:46 - [Microsoft][ODBC SQL Server Driver]Optional feature not implemented
[java] 09:22:07,531 ERROR JDBCExceptionReporter:38 - could not insert: [org.hibernate.auction.AuctionItem]
[java] java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented
Thank you for any help,
Gary
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\projects\Components\Hibernate_2_1\unzip\hibernate-2.1>build eg
C:\projects\Components\Hibernate_2_1\unzip\hibernate-2.1>set JAVA_HOME="C:\programs\j2sdk1.4.0_01"
C:\projects\Components\Hibernate_2_1\unzip\hibernate-2.1>REM set JDBC_DRIVER=C:\mysql\mysql-connector-java-3.0.8-stable-bin.jar
C:\projects\Components\Hibernate_2_1\unzip\hibernate-2.1>java -cp "lib/ant.jar;l
ib/optional.jar;lib/junit.jar;lib/xerces.jar;"C:\programs\j2sdk1.4.0_01"/lib/too
ls.jar" org.apache.tools.ant.Main -Ddriver.jar= eg
Buildfile: build.xml
[taskdef] Could not load definitions from resource clovertasks. It could not b
e found.
eg:
[echo] remember to place your JDBC driver in the lib directory
[java] 09:22:04,890 INFO Environment:432 - Hibernate 2.1 final
[java] 09:22:04,921 INFO Environment:466 - loaded properties from resource
hibernate.properties: {hibernate.connection.driver_class=sun.jdbc.odbc.JdbcOdbc
Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_
class=net.sf.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1
, hibernate.dialect=net.sf.hibernate.dialect.SybaseDialect, hibernate.jdbc.use_s
treams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutio
ns=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hiberna
te.connection.username=engg, hibernate.connection.url=jdbc:odbc:EngDevelop, hibe
rnate.show_sql=false, hibernate.connection.password=engg, hibernate.connection.p
ool_size=1}
[java] 09:22:04,921 INFO Environment:480 - using java.io streams to persis
t binary types
[java] 09:22:04,921 INFO Environment:481 - using CGLIB reflection optimize
r
[java] 09:22:04,937 INFO Configuration:305 - Mapping resource: org/hiberna
te/auction/AuctionItem.hbm.xml
[java] 09:22:05,484 INFO Binder:220 - Mapping class: org.hibernate.auction
.AuctionItem -> AuctionItem
[java] 09:22:05,593 INFO Configuration:305 - Mapping resource: org/hiberna
te/auction/Bid.hbm.xml
[java] 09:22:05,625 INFO Binder:220 - Mapping class: org.hibernate.auction
.Bid -> Bid
[java] 09:22:05,671 INFO Binder:166 - Mapping subclass: org.hibernate.auct
ion.BuyNow -> Bid
[java] 09:22:05,671 INFO Configuration:305 - Mapping resource: org/hiberna
te/auction/User.hbm.xml
[java] 09:22:05,718 INFO Binder:220 - Mapping class: org.hibernate.auction
.User -> AuctionUser
[java] 09:22:05,875 INFO ReflectHelper:149 - reflection optimizer disabled
for: org.hibernate.auction.Name, IllegalArgumentException: Cannot find matching
method/constructor
[java] 09:22:05,890 INFO Configuration:571 - processing one-to-many associ
ation mappings
[java] 09:22:05,890 INFO Binder:1104 - Mapping collection: org.hibernate.a
uction.AuctionItem.bids -> Bid
[java] 09:22:05,890 INFO Binder:1104 - Mapping collection: org.hibernate.a
uction.User.bids -> Bid
[java] 09:22:05,890 INFO Binder:1104 - Mapping collection: org.hibernate.a
uction.User.auctions -> AuctionItem
[java] 09:22:05,890 INFO Configuration:580 - processing one-to-one associa
tion property references
[java] 09:22:05,890 INFO Configuration:605 - processing foreign key constr
aints
[java] 09:22:05,921 INFO Dialect:82 - Using dialect: net.sf.hibernate.dial
ect.SybaseDialect
[java] 09:22:05,921 INFO SettingsFactory:58 - Maximim outer join fetch dep
th: 1
[java] 09:22:05,921 INFO SettingsFactory:62 - Use outer join fetching: tru
e
[java] 09:22:05,921 INFO DriverManagerConnectionProvider:41 - Using Hibern
ate built-in connection pool (not for production use!)
[java] 09:22:05,921 INFO DriverManagerConnectionProvider:42 - Hibernate co
nnection pool size: 1
[java] 09:22:05,937 INFO DriverManagerConnectionProvider:71 - using driver
: sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:EngDevelop
[java] 09:22:06,000 INFO DriverManagerConnectionProvider:72 - connection p
roperties: {user=engg, password=engg}
[java] 09:22:06,000 INFO TransactionManagerLookupFactory:33 - No Transacti
onManagerLookup configured (in JTA environment, use of process level read-write
cache is not recommended)
[java] 09:22:06,312 INFO SettingsFactory:89 - Use scrollable result sets:
true
[java] 09:22:06,312 INFO SettingsFactory:99 - Query language substitutions
: {no='N', true=1, yes='Y', false=0}
[java] 09:22:06,312 INFO SettingsFactory:110 - cache provider: net.sf.hibe
rnate.cache.HashtableCacheProvider
[java] 09:22:06,312 INFO Configuration:1044 - instantiating and configurin
g caches
[java] 09:22:06,375 INFO SessionFactoryImpl:118 - building session factory
[java] 09:22:06,765 INFO SessionFactoryObjectFactory:82 - no JNDI name con
figured
[java] 09:22:06,765 INFO Dialect:82 - Using dialect: net.sf.hibernate.dial
ect.SybaseDialect
[java] 09:22:06,765 INFO Configuration:571 - processing one-to-many associ
ation mappings
[java] 09:22:06,765 INFO Configuration:580 - processing one-to-one associa
tion property references
[java] 09:22:06,765 INFO Configuration:605 - processing foreign key constr
aints
[java] 09:22:06,765 INFO Configuration:571 - processing one-to-many associ
ation mappings
[java] 09:22:06,765 INFO Configuration:580 - processing one-to-one associa
tion property references
[java] 09:22:06,796 INFO Configuration:605 - processing foreign key constr
aints
[java] 09:22:06,796 INFO SchemaExport:96 - Running hbm2ddl schema export
[java] 09:22:06,796 INFO SchemaExport:115 - exporting generated schema to
database
[java] 09:22:06,796 INFO DriverManagerConnectionProvider:41 - Using Hibern
ate built-in connection pool (not for production use!)
[java] 09:22:06,796 INFO DriverManagerConnectionProvider:42 - Hibernate co
nnection pool size: 1
[java] 09:22:06,796 INFO DriverManagerConnectionProvider:71 - using driver
: sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:EngDevelop
[java] 09:22:06,828 INFO DriverManagerConnectionProvider:72 - connection p
roperties: {user=engg, password=engg}
[java] 09:22:06,859 DEBUG SchemaExport:130 - alter table AuctionItem drop c
onstraint FK522A9BD6C9FF4F7F
[java] 09:22:06,984 DEBUG SchemaExport:130 - alter table AuctionItem drop c
onstraint FK522A9BD657291C03
[java] 09:22:07,015 DEBUG SchemaExport:130 - alter table Bid drop constrain
t FK104DD317B13
[java] 09:22:07,046 DEBUG SchemaExport:130 - alter table Bid drop constrain
t FK104DDAD3189F4
[java] 09:22:07,046 DEBUG SchemaExport:130 - drop table AuctionItem
[java] 09:22:07,109 DEBUG SchemaExport:130 - drop table AuctionUser
[java] 09:22:07,156 DEBUG SchemaExport:130 - drop table Bid
[java] 09:22:07,203 DEBUG SchemaExport:147 - create table AuctionItem (
[java] id NUMERIC(19,0) IDENTITY NOT NULL,
[java] description VARCHAR(255) null,
[java] ends DATETIME null,
[java] condition INT null,
[java] seller NUMERIC(19,0) not null,
[java] successfulBid NUMERIC(19,0) null,
[java] primary key (id)
[java] )
[java] 09:22:07,250 DEBUG SchemaExport:147 - create table AuctionUser (
[java] id NUMERIC(19,0) IDENTITY NOT NULL,
[java] userName VARCHAR(255) not null,
[java] [password] VARCHAR(255) null,
[java] email VARCHAR(255) null,
[java] firstName VARCHAR(255) null,
[java] [initial] CHAR(1) null,
[java] lastName VARCHAR(255) null,
[java] primary key (id)
[java] )
[java] 09:22:07,281 DEBUG SchemaExport:147 - create table Bid (
[java] id NUMERIC(19,0) IDENTITY NOT NULL,
[java] isBuyNow CHAR(1) not null,
[java] amount FLOAT not null,
[java] datetime DATETIME not null,
[java] bidder NUMERIC(19,0) not null,
[java] item NUMERIC(19,0) not null,
[java] primary key (id)
[java] )
[java] 09:22:07,343 DEBUG SchemaExport:147 - alter table AuctionItem add co
nstraint FK522A9BD6C9FF4F7F foreign key (seller) references AuctionUser
[java] 09:22:07,343 DEBUG SchemaExport:147 - alter table AuctionItem add co
nstraint FK522A9BD657291C03 foreign key (successfulBid) references Bid
[java] 09:22:07,359 DEBUG SchemaExport:147 - alter table Bid add constraint
FK104DD317B13 foreign key (item) references AuctionItem
[java] 09:22:07,359 DEBUG SchemaExport:147 - alter table Bid add constraint
FK104DDAD3189F4 foreign key (bidder) references AuctionUser
[java] 09:22:07,359 INFO SchemaExport:158 - schema export complete
[java] 09:22:07,359 WARN JDBCExceptionReporter:20 - SQL Warning: 5701, SQL
State: 01000
[java] 09:22:07,359 WARN JDBCExceptionReporter:28 - [Microsoft][ODBC SQL S
erver Driver][SQL Server]Changed database context to 'eng_development'.
[java] 09:22:07,375 WARN JDBCExceptionReporter:20 - SQL Warning: 5703, SQL
State: 01000
[java] 09:22:07,375 WARN JDBCExceptionReporter:28 - [Microsoft][ODBC SQL S
erver Driver][SQL Server]Changed language setting to us_english.
[java] 09:22:07,375 INFO DriverManagerConnectionProvider:137 - cleaning up
connection pool: jdbc:odbc:EngDevelop
[java] Setting up some test data
[java] 09:22:07,421 INFO DriverManagerConnectionProvider:137 - cleaning up
connection pool: jdbc:odbc:EngDevelop
[java] 09:22:07,484 WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState
: S1C00
[java] 09:22:07,484 ERROR JDBCExceptionReporter:46 - [Microsoft][ODBC SQL S
erver Driver]Optional feature not implemented
[java] 09:22:07,484 WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState
: S1C00
[java] 09:22:07,531 ERROR JDBCExceptionReporter:46 - [Microsoft][ODBC SQL S
erver Driver]Optional feature not implemented
[java] 09:22:07,531 ERROR JDBCExceptionReporter:38 - could not insert: [org
.hibernate.auction.AuctionItem]
[java] java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional f
eature not implemented
[java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
[java] at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
[java] at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBigint(Unknown Sourc
e)
[java] at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setLong(Unknown Sourc
e)
[java] at net.sf.hibernate.type.LongType.set(LongType.java:32)
[java] at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.j
ava:48)
[java] at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.j
ava:35)
[java] at net.sf.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType
.java:46)
[java] at net.sf.hibernate.persister.EntityPersister.dehydrate(EntityPe
rsister.java:394)
[java] at net.sf.hibernate.persister.EntityPersister.insert(EntityPersi
ster.java:545)
[java] at net.sf.hibernate.persister.EntityPersister.insert(EntityPersi
ster.java:479)
[java] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:877
)
[java] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:818
)
[java] at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier
(SessionImpl.java:738)
[java] at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:718)
[java] at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.ja
va:1320)
[java] at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
[java] at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.j
ava:526)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482)
[java] at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImp
l.java:2555)
[java] at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl
.java:2195)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2184
)
[java] net.sf.hibernate.JDBCException: could not insert: [org.hibernate.auc
tion.AuctionItem]
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTrans
action.java:61)
[java] at net.sf.hibernate.persister.EntityPersister.insert(EntityPersi
ster.java:585)
[java] at net.sf.hibernate.persister.EntityPersister.insert(EntityPersi
ster.java:479)
[java] at org.hibernate.auction.Main.createTestAuctions(Main.java:344)
[java] at org.hibernate.auction.Main.main(Main.java:365)
[java] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:877
)
[java] at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:818
)
[java] at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier
(SessionImpl.java:738)
[java] at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:718)
[java] at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.ja
va:1320)
[java] at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
[java] at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.j
ava:526)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
[java] at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482)
[java] at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImp
l.java:2555)
[java] at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl
.java:2195)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2184
)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTrans
action.java:61)
[java] at org.hibernate.auction.Main.createTestAuctions(Main.java:344)
[java] at org.hibernate.auction.Main.main(Main.java:365)
[java] Caused by: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver
]Optional feature not implemented
[java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
[java] at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
[java] at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBigint(Unknown Sourc
e)
[java] at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setLong(Unknown Sourc
e)
[java] at net.sf.hibernate.type.LongType.set(LongType.java:32)
[java] at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.j
ava:48)
[java] at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.j
ava:35)
[java] at net.sf.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType
.java:46)
[java] at net.sf.hibernate.persister.EntityPersister.dehydrate(EntityPe
rsister.java:394)
[java] at net.sf.hibernate.persister.EntityPersister.insert(EntityPersi
ster.java:545)
[java] ... 18 more
[java] Exception in thread "main"
[java] Java Result: 1
[echo] for more examples, download the hibernate-examples package
BUILD SUCCESSFUL
Total time: 6 seconds
|