Comments (19)
from schemacrawler.
Hello, I solved this problem. When it comes to database name contains Uppercase, it returns with extra "" ,for example, ""User"". That was the problem. Thanks a lot. Hope you have a great day.
from schemacrawler.
If the database reports that that object names are case-sensitive, SchemaCrawler will enclose the names with double-quotes. Please provide more details of the actual command-line you are using.
from schemacrawler.
The database doesn't report any messages. I'm using it as a library, and it just returns that there is no schema when I tried to get a schema from database which has capital letter in its name, although there is.
When I have a database name list in SQL Server, for example: ['user', 'user1', 'User2', 'user3'], and I want to get all the schemas from 'User2', the same thing happens like this:
The real schema name value is 'User2', but when it goes through the normalizeCatalogName function, it returns the name in lowercase. Then the returned value, which is 'user2', can't be found in the database name list in SQL Server, which I wrote as an example: ['user', 'user1', 'User2', 'user3']. I think it doesn't recognize the 'User2' with 'user2' then it means sql server is case-sensitivie when getting a schema.
It works okay with Oracle because Oracle is not case-sensitive. However, when it comes to SQL Server, if a user saves the database name as 'UserName', it will be saved exactly like that. So, I think the return value should be the exact same name as the real schema value, not the lowercase applied one.
This case can be reproduced easily just creating a database name in sql server with only lower case letter and one starts with a capital letter.
from schemacrawler.
Oh I accidently closed the issue.
from schemacrawler.
@pastelto I cannot read your code from the screenshot. Please could you paste that code snippet in text on this issue?
from schemacrawler.
Oh, Those screenshot are from https://github.com/schemacrawler/SchemaCrawler/issues/176#issuecomment-810962748. Because it was exactly same issue with mine.
I'm using library and so I can't debug deeper.. I can debug until here.
private void crawlSchemas() throws Exception {
SchemaRetriever retriever = new SchemaRetriever(this.retrieverConnection, this.catalog, this.options);
this.taskRunner.add("retrieveSchemas", () -> {
retriever.retrieveSchemas(this.options.getLimitOptions().get(DatabaseObjectRuleForInclusion.ruleForSchemaInclusion));
}, new SchemaInfoRetrieval[0]).submit();
this.taskRunner.add("filterAndSortSchemas", () -> {
this.catalog.reduce(Schema.class, ReducerFactory.getSchemaReducer(this.options));
}, new SchemaInfoRetrieval[0]).submit();
**NamedObjectList<SchemaReference> schemas = retriever.getAllSchemas();**
if (schemas.isEmpty()) {
throw new ExecutionRuntimeException("No matching schemas found");
} else {
LOGGER.log(Level.INFO, new StringFormat("Retrieved %d schemas", new Object[]{schemas.size()}));
}
}
and those bold code is where I get a error. All the data are correct until there and then after "retriever.getAllSchemas()" I can't get the schema and I do have tables and column in that database. It works okay perfectly with all lower case database name but it doesn't work when database name has a single captial letter. I tested a lot with database name.
from schemacrawler.
@pastelto I will need your code, so I can see what you are doing, and try to reproduce it. Can you create some sample code in a GitHub Gist, and send me a link? I will debug through the SchemaCrawler code once I have a test case set up.
from schemacrawler.
https://gist.github.com/pastelto/00b530b025aabaf43263147cd733131a
Thanks for waiting. Here is the code!
It's not working in sql server only when database name starts with capital letter or has a capital letter in the database.
from schemacrawler.
@pastelto Thanks for your code. I have included in an Apache Maven project to try and reproduce the issue. I cannot reproduce it.
Please clone https://github.com/sualeh/schemacrawler-issue1460 and follow the instructions in the README exactly. You will need Docker available to run the code.
from schemacrawler.
@pastelto Please let me know if you have tried the sample code I provided.
from schemacrawler.
Hello. I started testing the code you provided today. However I followed the ReadMe instructions, but it's not working properly. It seems to be a problem caused by my lack of knowledge about Docker, because it's my first time using docker, so I'm currently researching Docker-related issues.
us.fatehi.utility.SQLRuntimeException: Could not connect to <jdbc:sqlserver://localhost:1433;DatabaseName=AdventureWorks;encrypt=false>, for <user 'SA'>, with properties <{}> at us.fatehi.utility.datasource.AbstractDatabaseConnectionSource.getConnection(AbstractDatabaseConnectionSource.java:126) at us.fatehi.utility.datasource.SimpleDatabaseConnectionSource.get(SimpleDatabaseConnectionSource.java:113) at us.fatehi.utility.datasource.SimpleDatabaseConnectionSource.get(SimpleDatabaseConnectionSource.java:49) at schemacrawler.tools.utility.SchemaCrawlerUtility.matchSchemaRetrievalOptions(SchemaCrawlerUtility.java:144) at schemacrawler.tools.utility.SchemaCrawlerUtility.getCatalog(SchemaCrawlerUtility.java:80) at com.example.Main.main(Main.java:48)
from schemacrawler.
Hello, I've tried to run the sample code, but I couldn't connect to the docker database. I just want to check if there is anything I need to change the provided database url to run the main.java? like changing localhost to another ip address?? <jdbc:sqlserver://localhost:1433~
Thanks
from schemacrawler.
@pastelto Please look at the Docker documentation, since I am using an image that is publicly available. Please tweak the code as needed.
from schemacrawler.
Related Issues (20)
- Schemacrawler not able to retrieve constraints HOT 1
- SQLite test failing on it_IT.UTF8 system locale HOT 2
- Optimize Oracle Foreign Key Retrieval SQL Statement HOT 5
- SchemaCrawler for Oracle is running for too long! HOT 26
- Allow table types to be filtered in the config file HOT 1
- Publish early-release Docker images
- I found that using schemacrawler I can't get the constraints HOT 3
- Add MariaDB connector for Java in Docker image
- Postgres Trigger getActionStatement not returning expected body HOT 4
- Primary keys created using index not registered as primary keys in schemacrawler output HOT 4
- Filter views by pattern HOT 2
- Cannot extract check constraints in oracle HOT 4
- GraphViz 9.0 relation rendering HOT 3
- Add test for foreign keys to unique indexes
- Cannot retrieve DB2 server information HOT 2
- Few enhancement requests
- Wrong version of dependency in download.cmd/sh
- Column fetch extremely slow HOT 5
- Link to examples is hard to follow HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from schemacrawler.