java - Java 插入到其他 Schema 中的表中
问题描述
在 SQL Developer 中使用 INSERT 和 SELECT 到其他模式时,由于 Synonym,我可以毫无问题地进行 INSERT 和 SELECT,但是如果我尝试在 java 代码中执行相同操作,它会说:
ORA-00942: 表或视图不存在
连接是通过
Class.forName("oracle.jdbc.driver.OracleDriver");
从 app.properties 文件加载的属性
InputStream in = this.getClass().getClassLoader().getResourceAsStream("app.properties");
解决方案
它将通过带有 includeSynonyms = true 的属性连接来工作
java.util.Properties info = new java.util.Properties();
info.put("user", user);
info.put("password", pwd);
info.put ("includeSynonyms", "true");
然后通过使用属性进行连接
conn = DriverManager.getConnection(url, info);
这样它就可以工作了
推荐阅读
- python - 如何使用 Django 中的选择 - 如何显示特定内容?
- android - 该位置没有 XML:http://schemas.android.com/apk/res/android
- ruby-on-rails - 如何从静态站点向 Rails 应用程序发布请求?
- javascript - firebase.fireStore() 不是函数
- c# - 使用音频剪辑获取 1 秒的样本?
- mysql - 如何从 MySQL 中删除自定义帖子类型?
- bash - sh 脚本捕获文本并添加到空格分隔的变量
- php - 使用为移动应用程序构建的 REST API 创建 Web 前端
- sql - SQL - 使用另一个表的列作为条件搜索表
- spring-mvc - centos上的Tomcat与mac上的tomcat表现不同?