1
import android.os.AsyncTask
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.transactions.transaction

class DatabaseConnect : AsyncTask<Void, Void, String>() {

    object Users : Table() {
        val id = uuid("ID").autoIncrement().primaryKey() // Column<uuid>
        val email = varchar("Email", 50) // Column<String>

    }

    override fun doInBackground(vararg params: Void?): String? {
        try {
            val db = Database.connect("jdbc:sqlserver://192.168.100.200;integratedSecurity=false;encrypt=false; trustServerCertificate=true;",
                "com.microsoft.sqlserver.jdbc.SQLServerDriver",
                user = "<myuser>", password = "<mypassword>")

            transaction(db) {
            for (u in Users.selectAll()) {
                    var i: Int = 0
                    val j = i++
                }
            }
        } catch (exception: Exception){
            print(exception)
        }
        return null
    }
}

当我运行应用程序时,会发生以下异常:

E/AndroidRuntime:致命异常:AsyncTask #1 进程:hu.kovax.empmobile,PID:28856 java.lang.RuntimeException:在 android.os.AsyncTask$4.done(AsyncTask.java:399 执行 doInBackground() 时出错) 在 java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) ... ... 引起:java.net.SocketException:套接字在 com.android.org.conscrypt.NativeSsl.doHandshake(NativeSsl .java:385) 在 com.android.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(ConscryptFileDescriptorSocket.java:226) 在 com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1802)

SQLSERVER 已启动并处于活动状态。

我找到了可能相关的其他问题的答案,有人建议以某种方式禁用 conscrypt 层: https ://github.com/GoogleCloudPlatform/dataproc-initialization-actions/issues/177

有没有办法在 Exposed 中禁用 conscrypt 层?

4

0 回答 0