• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Hibernate Configuration ODBC SQL Server

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 = "jdbc:odbc: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">jdbc:odbc: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?
 
Ranch Hand
Posts: 331
Python Ruby Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic