- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
给定两台 MySQL 服务器,一台本地,一台远程。两者都有一个包含表 bohica 的数据库 foobar。本地服务器定义了用户 'myadmin'@'%' 和 'myadmin'@'localhost'。远程服务器定义了用户 'myadmin'@'%' 、 'myadmin'@'localhost' 和 'myadmin'@'my.domain.com'。
已向所有这些用户授予权限并刷新权限。
两台服务器都已启动。
从命令提示符窗口我可以连接到两个服务器,即
mysql --user=myadmin --password=mylocalpw
mysql --user=myadmin --password=myremotepw --host=my.domain.com
都成功了,证明我可以到达并登录到远程服务器。
我的 java/maven/hibernate 应用程序有一个上下文文件
...
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
foobar
$dbServerB{hibernate.connection.username}
$dbServerB{hibernate.connection.password}
20
$dbServerB{hibernate.dialect}
$dbServerB{hibernate.connection.characterEncoding}
$dbServerB{hibernate.connection.driver_class}
$dbServerB{hibernate.connection.url}
$dbServerB{hibernate.connection.release_mode}
$dbServerB{hibernate.cache.provider_class}
$dbServerB{hibernate.c3p0.min_size}
$dbServerB{hibernate.c3p0.max_size}
$dbServerB{hibernate.c3p0.timeout}
$dbServerB{hibernate.c3p0.max_statements}
$dbServerB{hibernate.show_sql}
$dbServerB{hibernate.format_sql}
$dbServerB{hibernate.hbm2ddl.auto}
com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory
com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup
...
和属性文件databaseServerBliveadmin.properties
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.connection.characterEncoding=UTF-8
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://my.domain.com:3306/foobar
hibernate.connection.username=myadmin
hibernate.connection.password=myremotepw
hibernate.connection.release_mode=after_transaction
hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider
hibernate.c3p0.init_size=10
hibernate.c3p0.min_size=10
hibernate.c3p0.max_size=50
hibernate.c3p0.timeout=600
hibernate.c3p0.max_statements=50
hibernate.show_sql=false
hibernate.format_sql=true
hibernate.hbm2ddl.auto=create
和databaseServerBlocaladmin.properties
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.connection.characterEncoding=UTF-8
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost:3306/foobar
hibernate.connection.username=myadmin
hibernate.connection.password=mylocalpw
hibernate.connection.release_mode=after_transaction
hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider
hibernate.c3p0.init_size=10
hibernate.c3p0.min_size=10
hibernate.c3p0.max_size=50
hibernate.c3p0.timeout=600
hibernate.c3p0.max_statements=50
hibernate.show_sql=false
hibernate.format_sql=true
hibernate.hbm2ddl.auto=update
现在变得奇怪了。当我调整“databasePropertiesServerB”bean 中的“location”属性值以使用 databaseServerBlocal.properties 时,该应用程序可以连接到本地服务器并按预期执行操作。
但是(你知道有一个但是要来...)
当我调整“databasePropertiesServerB”bean 中的“location”属性值以使用 databaseServerBliveadmin.properties 时,我得到了可怕的结果
java.sql.SQLException: Access denied for user 'myadmin'@'localhost' (using password: YES)
错误消息。我可以手动登录到证明用户名和密码正确的远程服务器。我一直非常小心地在两个 .properties 文件中正确拼写用户名和密码值 - 没有尾随空格等。所以我在这一点上感到难过。有什么想法吗?
TIA,
仍在学习的史蒂夫
1 Câu trả lời
完整答案出现在后续问题中
cannot achieve connectivity with MySQL db on remote machine
基本上,关于 hibernate 属性文件的所有内容以及两个 MySQL 实例上的帐户和密码都是正确的 - 原因是没有在实体管理器工厂 bean 使用的 Atomikos 数据源 bean 中明确设置 xaProperties.server 属性- 如果没有明确设置它默认为“本地主机”,这当然不能在远程机器上工作,因为它试图以 xxxxx 身份登录。%
鬼鬼祟祟鬼鬼祟祟的。
结案
仍在学习史蒂夫
关于java 应用程序无法连接到远程 MySQL 数据库,但可以连接到本地 MySQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33048585/
Tôi đang phát triển một ứng dụng gọi điện thoại VoIP. Những gì tôi cần làm là đưa Activity lên phía trước khi nhận được cuộc gọi. Tôi đang sử dụng Twilio trong ứng dụng của mình và tôi bắt đầu cuộc gọi khi nhận được tin nhắn đẩy. Vấn đề là tôi đang cố gắng hiển thị Act khi có bất kỳ cuộc gọi nào được nhận
Tôi là một lập trình viên xuất sắc, rất giỏi!