You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "xgl1991714 (JIRA)" <ji...@apache.org> on 2014/11/17 05:04:33 UTC
[jira] [Created] (METAMODEL-97) getDefaultSchema() indexOf()
xgl1991714 created METAMODEL-97:
-----------------------------------
Summary: getDefaultSchema() indexOf()
Key: METAMODEL-97
URL: https://issues.apache.org/jira/browse/METAMODEL-97
Project: Metamodel
Issue Type: Bug
Affects Versions: 4.2.0-incubating, 4.1.0-incubating
Reporter: xgl1991714
There are two databases:'mydb' and 'mydb2'
But when I run:
{quote}
Class.forName({color:blue}"com.mysql.jdbc.Driver"{color});
Connection conn = DriverManager.getConnection({color:blue}"jdbc:mysql://localhost:3306/mydb2?user=root&password=xxxx"{color});
DataContext dataContext=DataContextFactory.createJdbcDataContext(conn);
System.out.println({color:blue}"default schema is:"{color}+dataContext.getDefaultSchema());
{quote}
The reslut is:
{quote}
default schema is:mydb
{quote}
the code of method getDefaultSchema() in JdbcDataContext:
{quote}
...
for (int i = 0; i < schemaNames.length && !found; i++) {
String schemaName=schemaNames\[i];
if(lastToken.{color:red}indexOf{color}(schemaName) != -1) {
result = schemaName;
found = true;
}
}
...
{quote}
the lastToken is {color:blue}'mydb2?user=root&password=xxxx'{color} and the schemaName is {color:blue}'mydb'{color}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)