例如利用hibernate连接数据库操作的配置文件hibernate.cfg.xml
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="hibernate.connection.driver_class">
com.microsoft.sqlserver.jdbc.SQLServerDriver
</property>
<property name="hibernate.connection.url">
jdbc:sqlserver://localhost:1433;databaseName=wxyxgb;selectMethod=cursor
</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password">sa</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<hibernate-configuration>
<session-factory>
在url的配置中加上selectMethod=cursor这样一句话,如果利用jdbc连接数据库也是
在在url上加上这句话。
例如jdbc:sqlserver://localhost:1433;databaseName=wxyxgb;selectMethod=cursor
SelectMethod=Cursor
作用:利用服务器端的游标加快速度
使用:1.执行多个Statements的操作时候用
2.需要手动使用事务的时候使用