小编Moj*_*med的帖子

驱动程序无法使用安全套接字层(SSL)加密与SQL Server建立安全连接

我使用此代码创建到SQL Server的连接.

String connectionUrl = "jdbc:sqlserver://IP:1433;" +
        "databaseName=db;user=db;password=pwd";
    Connection con = null;
  try {
     // Establish the connection.
     Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
     con = DriverManager.getConnection(connectionUrl);
        return "true";
  }

  // Handle any errors that may have occurred.
  catch (Exception e) {
     e.printStackTrace();
  }
Run Code Online (Sandbox Code Playgroud)

但我得到了这个错误:

com.microsoft.sqlserver.jdbc.SQLServerException:驱动程序无法使用安全套接字层(SSL)加密与SQL Server建立安全连接.错误:"套接字已关闭".ClientConnectionId:5975fad5-8f8d-496A-a2bb-bff3a8d1a755

有谁能够帮我?提前致谢

java sql sql-server android sqljdbc

13
推荐指数
1
解决办法
3万
查看次数

扩展cardview类在卡片周围显示白色矩形

我正在扩展CardView类,因为我想为列表视图的每一行创建自定义视图。这是我的xml布局

<com.mojiapps.myquran.items.TranslationDownloadItemView  xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?selectableItemBackground"
android:gravity="right"
card_view:cardCornerRadius="3dp"
card_view:cardElevation="3dp"
card_view:cardPreventCornerOverlap="false">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">
...

</com.mojiapps.myquran.items.TranslationDownloadItemView>
Run Code Online (Sandbox Code Playgroud)

这是我的java类

public class TranslationDownloadItemView extends CardView {


public TranslationDownloadItemView(Context context) {
    super(context);
    init();
}

public TranslationDownloadItemView(Context context, AttributeSet attrs) {
    super(context, attrs);
}

private void init() {
    LayoutInflater inflater = LayoutInflater.from(getContext());

    inflater.inflate(R.layout.translation_type_row, this);
...
}
...
}
Run Code Online (Sandbox Code Playgroud)

这就是结果

在此处输入图片说明

有谁能够帮助我?

java android android-custom-view android-cardview

5
推荐指数
1
解决办法
762
查看次数

使用 Retrofit 发送 ArrayList&lt;Object&gt; POST 请求

我想将这样的东西发送到服务器

{
  "InoorPersonID": "",
  "Discount": 0,
  "DiscountDescription": "",
  "Description": "",
  "OrderDetailList": [
    {
      "ProductID": 0,
      "Amount": 0
    }
  ],
  "ClientId": "",
  "ClientSecret": ""
}
Run Code Online (Sandbox Code Playgroud)

这是我的服务接口

public interface StoreRetrofitSalesService {

    @FormUrlEncoded
    @POST(ServiceUrl.URL_ORDER_SET)
    Call<ServiceResult<Integer>> orderSet(@Field("OrderDetailList") ArrayList<OrderDetail> orderDetails,
                                          @Field("Discount") String discount,
                                          @Field("ClientId") String clientId,
                                          @Field("ClientSecret") String clientSecret,
                                          @Field("Description") String description,
                                          @Field("InoorPersonID") String inoorPersonId,
                                          @Field("DiscountDescription") String discountDescription);

}
Run Code Online (Sandbox Code Playgroud)

logcat 显示了这一点

OrderDetailList=org.crcis.noorreader.store.OrderDetail%408208296&Discount=0&...
Run Code Online (Sandbox Code Playgroud)

我有两个问题:

  1. 为什么 OrderDetailList 不能转换为 JSON。
  2. 我如何为这个参数使用@FieldMap。我最近测试Map<String, Object>但它返回相同的结果。

谢谢

android retrofit

3
推荐指数
1
解决办法
1万
查看次数