首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure表存储:无法创建带有CloudTableClient实例的表

Azure表存储:无法创建带有CloudTableClient实例的表
EN

Stack Overflow用户
提问于 2012-10-01 05:59:27
回答 1查看 2.6K关注 0票数 2

下面是Azure关于Java的基本教程:https://www.windowsazure.com/en-us/develop/java/how-to-guides/table-service/#CreateTable

但遇到以下错误:

找不到符号 符号:方法createTableIfNotExists(java.lang.String) 位置: com.microsoft.windowsazure.services.table.client.CloudTableClient类

整个小程序(复制自Azure教程):

代码语言:javascript
复制
import com.microsoft.windowsazure.services.core.storage.*;
import com.microsoft.windowsazure.services.table.client.*;
import com.microsoft.windowsazure.services.table.client.TableQuery.*;

public class AzureTableWrite {
  public static void main(String[] args) {
    // Define the connection-string with your values
    final String storageConnectionString =
        "DefaultEndpointsProtocol=http;" +
        "AccountName=skivvy;" +
        "AccountKey=foobar";

    // Retrieve storage account from connection-string
    CloudStorageAccount storageAccount =
        CloudStorageAccount.parse(storageConnectionString);

    // Create the table client.
    CloudTableClient tableClient = storageAccount.createCloudTableClient();

    // Create the table if it doesn't exist.
    String tableName = "people";
    tableClient.createTableIfNotExists(tableName);
  }
}

有人遇到过同样的问题吗?任何帮助都是非常感谢的!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-10-01 16:13:40

正如我在MSDN论坛(http://social.msdn.microsoft.com/Forums/en-US/windowsazuredata/thread/78c12f97-4209-41a1-86d6-267f5e9f51f6)上的响应中提到的,您使用的示例似乎存在问题。

请用这个代替:

代码语言:javascript
复制
    CloudTableClient tableClient = storageAccount.createCloudTableClient();
    CloudTable table = tableClient.getTableReference("people");
    table.createIfNotExists();

希望这能有所帮助。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12668170

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档