search
HomeDatabaseMysql Tutorial【sqlserver2005】 'hibernate.dialect' must be

今天把项目拿到办公室来做,先装好了sqlServer 2005,密码和自己电脑上sqlserver的密码也一样,再把数据库附加进来 , 然后把项目导入到MyEclipse 中。 从一个工作环境迁移到另一个工作环境,就这样每一步都很顺利,可是当程序开始运行时,却总是报这样一个

今天把项目拿到办公室来做,先装好了sqlServer 2005,密码和自己电脑上sqlserver的密码也一样,再把数据库附加进来 ,  然后把项目导入到MyEclipse 中。

从一个工作环境迁移到另一个工作环境,就这样每一步都很顺利,可是当程序开始运行时,却总是报这样一个错误'hibernate.dialect' must be set when no Connection avalable 

网上也有不少人遇到这种问题,看上去好像是跟Hibernate的方言有关。所以就一直也把焦点放在方言上去寻找解决方案。可是不管怎样都还是报同一个错误。


如果再仔细琢磨一下这句话

'hibernate.dialect' must be set when no Connection avalable 

当连接不可用时,必须要设置Hibernate方言


发现问题了!并不是方言的问题,而是数据库连接的问题。

既然知道是数据库连接的问题就放心多了,至少不是代码引起的错误了,,,


在程序中使用Hibernate连接SQL Server 2005,有时候会出现连接不上的情况。这时候请检查一下SQL Server的配置情况:

  1. 检查SQL Server的端口是否打开。默认的SQL Server端口是1433。在Windows命令行里面输入netstat -a -n,查看1433端口是不是打开了。如果没有打开,往下配置。
  2. 重启服务器,看看程序能否成功连接数据库。
  3. 如果还不能连接数据库,看看数据库是不是开启了SQL Server身份验证登陆。测试方法就是你用SQL Server用户名和密码登陆你的SQL Server Management工具。如果成功连接证明已经开启,如果不能连接登陆,则用Windows身份验证进入Management工具,然后右键你的服务器——属性——安全性——选择“SQL Server 和 Windows 身份验证模式”,登陆审核选择“仅限成功的登陆”。
  4. 如果没有登录名,新建一个。右键要使用的登录名——属性——用户映射——勾选要使用的数据库——确定。右键要使用的数据库——属性——权限,这里会看见我们刚刚编辑的用户,配置该用户的权限,一般使用的有“连接”“插入”“选择”“删除”“执行”“更改”“创建表”等,根据需要修改。重新连接数据库,用SQL Server身份验证登陆,这时候应该没有问题了。 


ps:都是这个错误信息的误导,其实可能也是我们中国人跟外国人的语言表达方式的区别,他们把条件限制放在了后面,而我们习惯于关注一句话前半部分,

尤其是还给Hibernate.dialect加了个引号,注意力都转移到dialect上面去了。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor