我使用此代码创建到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
有谁能够帮我?提前致谢
我正在扩展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)
这就是结果

有谁能够帮助我?
我想将这样的东西发送到服务器
{
"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)
我有两个问题:
Map<String, Object>但它返回相同的结果。谢谢