Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Configuration ODBC SQL Server

 
ivan deselt
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai all... I'm newbie in hibernate technology, and i have a question about hibernate configuration.
First i'm using Netbean to create web application. I'm using struts , spring and hibernate. i'm stuck in hibernate configuration. Database i'm using is SQL Server, and it is on other network. so far i can established connection by writing the java code like :

public static Connection getConnection() throws Exception {
Driver d = (Driver)Class.forName
("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();

String URL = "jdbcdbc:dsnmay";
con = DriverManager.getConnection(URL, "sa", "may");

return (Connection) con;
}
i create odbc data source as well. then when i try to use hibernate, this is the setting i made:

<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.connection.driver_class">sun.jdbc.odbc.JdbcOdbcDriver</property>
<property name="hibernate.connection.url">jdbcdbc:dsnmay</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password">may</property>
</session-factory>
</hibernate-configuration>

then when i create hibernate reverse engineering wizard, there's no tables load...

same thing happens in intelij, test connection success but refresh tables , error
JDBC operation failed
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index

i already have tables in my database and i wanna use hibernate and also create a mapping files from my database. any idea?
 
Sumit Bisht
Ranch Hand
Posts: 331
Python Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are getting a "Invalid Descriptor Index" problem, It could be due to wrong numbering of columns in table an as needed by the caller.
Also, if it is feasible, can you use a jdbc driver to access the database ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic