无法访问 MacOS 上的所有冒险作品表

Posted

技术标签:

【中文标题】无法访问 MacOS 上的所有冒险作品表【英文标题】:Can't access all adventure works tables on MacOS 【发布时间】:2018-02-26 13:20:09 【问题描述】:

我在本地 docker 容器和 sql-server 上进行了冒险工作。当我尝试访问冒险作品时,我只有 3 张桌子。 在 Windows 上它可以工作。 我使用 DBeaver 和 DBvisualizer 进行连接。 Screen-shot

已解决:在新版本的 DBeaver 中已解决,这是来自 ms-sql 驱动程序的错误。但是在 DBvisualizer 中它仍然不起作用。

【问题讨论】:

这是一个普通的 AdventureWorks 数据库吗? IE 刚刚下载,没有做任何更改? 是的,它是香草.. 看图就是看dbo方案中的表。 AW有多种方案(可能docker上的版本只有dbo?)。 @CetinBasoz 我查看了所有方案。但实际上不在 docker 上,我在看 sql-server。当我在 ms sql management studio 上连接同一台服务器时,它具有所有表。 您的意思是 DBeaver 和 DBvisualizer 不显示它们?我不使用它们 :( 只需检查 T_SQL。我使用 Go 和 Go MSSQL 库从 Mac 访问 SQL Server 表没有问题。 【参考方案1】:

使用这个 docker 命令:

sudo docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'myStrongP@ssw0rd' -Q "select table_schema,table_name,table_type from AdventureWorks2012.Information_Schema.Tables order by table_type, table_schema, table_name" | tr -s ' '

这些是我得到的表格列表:

table_schema table_name table_type
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ----------
dbo AWBuildVersion BASE TABLE
dbo DatabaseLog BASE TABLE
dbo ErrorLog BASE TABLE
HumanResources Department BASE TABLE
HumanResources Employee BASE TABLE
HumanResources EmployeeDepartmentHistory BASE TABLE
HumanResources EmployeePayHistory BASE TABLE
HumanResources JobCandidate BASE TABLE
HumanResources Shift BASE TABLE
Person Address BASE TABLE
Person AddressType BASE TABLE
Person BusinessEntity BASE TABLE
Person BusinessEntityAddress BASE TABLE
Person BusinessEntityContact BASE TABLE
Person ContactType BASE TABLE
Person CountryRegion BASE TABLE
Person EmailAddress BASE TABLE
Person Password BASE TABLE
Person Person BASE TABLE
Person PersonPhone BASE TABLE
Person PhoneNumberType BASE TABLE
Person StateProvince BASE TABLE
Production BillOfMaterials BASE TABLE
Production Culture BASE TABLE
Production Document BASE TABLE
Production Illustration BASE TABLE
Production Location BASE TABLE
Production Product BASE TABLE
Production ProductCategory BASE TABLE
Production ProductCostHistory BASE TABLE
Production ProductDescription BASE TABLE
Production ProductDocument BASE TABLE
Production ProductInventory BASE TABLE
Production ProductListPriceHistory BASE TABLE
Production ProductModel BASE TABLE
Production ProductModelIllustration BASE TABLE
Production ProductModelProductDescriptionCulture BASE TABLE
Production ProductPhoto BASE TABLE
Production ProductProductPhoto BASE TABLE
Production ProductReview BASE TABLE
Production ProductSubcategory BASE TABLE
Production ScrapReason BASE TABLE
Production TransactionHistory BASE TABLE
Production TransactionHistoryArchive BASE TABLE
Production UnitMeasure BASE TABLE
Production WorkOrder BASE TABLE
Production WorkOrderRouting BASE TABLE
Purchasing ProductVendor BASE TABLE
Purchasing PurchaseOrderDetail BASE TABLE
Purchasing PurchaseOrderHeader BASE TABLE
Purchasing ShipMethod BASE TABLE
Purchasing Vendor BASE TABLE
Sales CountryRegionCurrency BASE TABLE
Sales CreditCard BASE TABLE
Sales Currency BASE TABLE
Sales CurrencyRate BASE TABLE
Sales Customer BASE TABLE
Sales PersonCreditCard BASE TABLE
Sales SalesOrderDetail BASE TABLE
Sales SalesOrderHeader BASE TABLE
Sales SalesOrderHeaderSalesReason BASE TABLE
Sales SalesPerson BASE TABLE
Sales SalesPersonQuotaHistory BASE TABLE
Sales SalesReason BASE TABLE
Sales SalesTaxRate BASE TABLE
Sales SalesTerritory BASE TABLE
Sales SalesTerritoryHistory BASE TABLE
Sales ShoppingCartItem BASE TABLE
Sales SpecialOffer BASE TABLE
Sales SpecialOfferProduct BASE TABLE
Sales Store BASE TABLE
HumanResources vEmployee VIEW 
HumanResources vEmployeeDepartment VIEW 
HumanResources vEmployeeDepartmentHistory VIEW 
HumanResources vJobCandidate VIEW 
HumanResources vJobCandidateEducation VIEW 
HumanResources vJobCandidateEmployment VIEW 
Person vAdditionalContactInfo VIEW 
Person vStateProvinceCountryRegion VIEW 
Production vProductAndDescription VIEW 
Production vProductModelCatalogDescription VIEW 
Production vProductModelInstructions VIEW 
Purchasing vVendorWithAddresses VIEW 
Purchasing vVendorWithContacts VIEW 
Sales vIndividualCustomer VIEW 
Sales vPersonDemographics VIEW 
Sales vSalesPerson VIEW 
Sales vSalesPersonSalesByFiscalYears VIEW 
Sales vStoreWithAddresses VIEW 
Sales vStoreWithContacts VIEW 
Sales vStoreWithDemographics VIEW

所有表都在 docker 容器中,在它们指定的模式下。

“我只需要上大学的冒险作品。我该如何使用这些库” 我不明白你这是什么意思。上面列出表格的 docker 命令是使用它的一种方式。您还可以使用 sqlcmd shell 从 docker 容器中运行它。也许你应该更好地解释你想要做什么。 Mac 或 Linux 上的 FWIW 我会简单地使用类似 postgreSQL 的东西。

【讨论】:

我们正在研究“选择”,我们不需要对冒险作品数据库进行任何更改。我必须做功课,但在家里我没有任何 Windows 电脑来学习使用 ms sql 管理工作室的选择指令。我需要在 mac os 上进行冒险作品。我尝试了 AdventureWorksDW,这个正在工作,我创建了自己的数据库并且它也可以工作。但我需要与 2012 / 2014 年的冒险作品合作。 OK 只需使用它,您就可以运行以下命令:从 HumanResources.Employee 中选择 *。从 docker image sqlcmd shell 中运行会更容易。 也许在您的工具中,也有显示其他模式的选项(即:在 Jetbrains datagrip 中,默认情况下使用 mysql jdbc 仅显示 dbo 模式)。 我在 DBeaver 中使用了连接,选项“显示所有模式”,我几乎没有新模式,但它们也是空的 ibb.co/nsgeTH 对不起,我一般不使用工具,只是简单地编写我的 SQL 命令。【参考方案2】:

我注意到在 MacOS 上使用 jTDS 驱动程序不会列出 SQL Server 数据库中的所有模式,所以我想这个问题也可能扩展到表。切换到 MS JDBC 驱动程序,看看是否能解决问题。

【讨论】:

以上是关于无法访问 MacOS 上的所有冒险作品表的主要内容,如果未能解决你的问题,请参考以下文章

Dreamfactory中突然无法访问mysql表

来自自制软件的mac os上的git:致命:无法访问

无法删除和更新访问链接表上的记录

如何访问在 MacOS/Monterey 上的 docker 中运行的本地 MS SQL 数据库

MacOS 软件版本更新Monterey12.1版之后L2TP无法正常访问内网服务解决方案

MacOS 软件版本更新Monterey12.1版之后L2TP无法正常访问内网服务解决方案