gpt4 book ai didi

java - 为什么我得到 "format error: Property is ' v$session.program'"connecting to Oracle?

转载 作者:搜寻专家 更新时间:2023-11-01 02:40:15 32 4
gpt4 key购买 nike

我正在从 Java 应用程序连接到 Oracle 11g 数据库。我收到以下异常:

Caused by: java.sql.SQLException: Connection property: format error: Property is 'v$session.program' and value is '<My Maven application's name>'
at oracle.jdbc.driver.T4CConnection.validateConnectionProperties(T4CConnection.java:4540)
at oracle.jdbc.driver.PhysicalConnection.readConnectionProperties(PhysicalConnection.java:2345)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:517)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)
at oracle.ucp.jdbc.DataSourceConnectionFactoryAdapter.createConnection(DataSourceConnectionFactoryAdapter.java:100)

我该如何解决这个问题?

最佳答案

我们想通了。我们的应用程序名称太长了一个字符:它是 49 个字符,而不是 48 或更少。

这是 v$session 属性及其长度限制的列表:

  • v$session.machine:64
  • v$session.iname:无限制
  • v$session.ename:无限制
  • v$session.process:24
  • v$session.program:48
  • v$session.terminal:30
  • v$session.osuer:30

此外,没有任何属性可以匹配此正则表达式:.*[\00\(\)].*,我认为这意味着没有括号。

如果您遇到错误并想查看代码,只需在您的 IDE 中为 SQLException 添加一个异常断点。您应该在名为 T4CConnection.class 的类中结束。

这是方法 validateConnectionProperties() 的反编译代码:

void validateConnectionProperties() throws SQLException {
super.validateConnectionProperties();
String var1 = ".*[\\00\\(\\)].*";
SQLException var2;
if(this.thinVsessionOsuser == null || !this.thinVsessionOsuser.matches(var1) && this.thinVsessionOsuser.length() <= 30) {
if(this.thinVsessionTerminal == null || !this.thinVsessionTerminal.matches(var1) && this.thinVsessionTerminal.length() <= 30) {
if(this.thinVsessionMachine != null && (this.thinVsessionMachine.matches(var1) || this.thinVsessionMachine.length() > 64)) {
var2 = DatabaseError.createSqlException((OracleConnection)null, 190, "Property is \'v$session.machine\' and value is \'" + this.thinVsessionMachine + "\'");
var2.fillInStackTrace();
throw var2;
} else if(this.thinVsessionProgram == null || !this.thinVsessionProgram.matches(var1) && this.thinVsessionProgram.length() <= 48) {
if(this.thinVsessionProcess == null || !this.thinVsessionProcess.matches(var1) && this.thinVsessionProcess.length() <= 24) {
if(this.thinVsessionIname != null && this.thinVsessionIname.matches(var1)) {
var2 = DatabaseError.createSqlException((OracleConnection)null, 190, "Property is \'v$session.iname\' and value is \'" + this.thinVsessionIname + "\'");
var2.fillInStackTrace();
throw var2;
} else if(this.thinVsessionEname != null && this.thinVsessionEname.matches(var1)) {
var2 = DatabaseError.createSqlException((OracleConnection)null, 190, "Property is \'v$session.ename\' and value is \'" + this.thinVsessionEname + "\'");
var2.fillInStackTrace();
throw var2;
}
} else {
var2 = DatabaseError.createSqlException((OracleConnection)null, 190, "Property is \'v$session.process\' and value is \'" + this.thinVsessionProcess + "\'");
var2.fillInStackTrace();
throw var2;
}
} else {
var2 = DatabaseError.createSqlException((OracleConnection)null, 190, "Property is \'v$session.program\' and value is \'" + this.thinVsessionProgram + "\'");
var2.fillInStackTrace();
throw var2;
}
} else {
var2 = DatabaseError.createSqlException((OracleConnection)null, 190, "Property is \'v$session.terminal\' and value is \'" + this.thinVsessionTerminal + "\'");
var2.fillInStackTrace();
throw var2;
}
} else {
var2 = DatabaseError.createSqlException((OracleConnection)null, 190, "Property is \'v$session.osuser\' and value is \'" + this.thinVsessionOsuser + "\'");
var2.fillInStackTrace();
throw var2;
}
}

关于java - 为什么我得到 "format error: Property is ' v$session.program'"connecting to Oracle?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35072134/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com