当前位置: 首页 > news >正文

秦皇岛市教育考试院官网seo排名赚app多久了

秦皇岛市教育考试院官网,seo排名赚app多久了,wordpress支持字体,推广平台方案下面展示了连接SQL Server数据库的整个流程: 加载数据库驱动建立数据库连接执行SQL语句处理结果关闭连接 在连接之前,前提是确保数据库成功的下载,创建,配置好账号密码。 运行成功的代码: import java.sql.*;publi…

下面展示了连接SQL Server数据库的整个流程:

  • 加载数据库驱动
  • 建立数据库连接
  • 执行SQL语句
  • 处理结果
  • 关闭连接

在连接之前,前提是确保数据库成功的下载,创建,配置好账号密码。

运行成功的代码:

import java.sql.*;public class sqlserverConnection {//驱动private static String cxDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";//连接地址private static String cxUrl = "jdbc:sqlserver://172.16.100.1:1433;databaseName=abc;encrypt=false";//用户名private static String cxUser = "abc";//用户密码:数据库的密码private static String cxPassword = "abc";public static void main(String[] args) {try{Class.forName(cxDriver);   //加载sqlserver的驱动类System.out.println("加载SQLServer驱动类成功!");}catch(ClassNotFoundException a){System.out.println("加载SQLServer驱动失败!");a.printStackTrace();}Connection dbcon=null;           //处理与特定数据库的连接try{dbcon=DriverManager.getConnection(cxUrl,cxUser,cxPassword);System.out.println("数据库连接成功!");dbcon.close();}catch(SQLException e){System.out.println("数据库连接失败!");e.printStackTrace();}}}

报错:

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/microsoft/sqlserver/jdbc/SQLServerDriver has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0at java.lang.ClassLoader.defineClass1(Native Method)at java.lang.ClassLoader.defineClass(ClassLoader.java:763)at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)at java.net.URLClassLoader.access$100(URLClassLoader.java:74)at java.net.URLClassLoader$1.run(URLClassLoader.java:369)at java.net.URLClassLoader$1.run(URLClassLoader.java:363)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:362)at java.lang.ClassLoader.loadClass(ClassLoader.java:424)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)at java.lang.ClassLoader.loadClass(ClassLoader.java:357)at java.lang.Class.forName0(Native Method)at java.lang.Class.forName(Class.java:264)at timeunit_test.sqlserverConnection.main(sqlserverConnection.java:17)

问题在于用较高版本的jdk编译的class文件在低版本的JVM上运行所导致的,通俗讲就是编译运行版本不匹配。

可惜我不是
看下jar包目录下是否存在多余的,不需要的版本,去除
我第一次jre8,jre11版本的都导入了,导致驱动加载失败
使用cmd java -version 查看java javac版本 是否都匹配
在这里插入图片描述

加载驱动成功,但是连接又失败了

com.microsoft.sqlserver.jdbc.SQLServerException: "encrypt" property is set to "true" and "trustServerCertificate" property is set to "false" but the driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption: Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target. ClientConnectionId:f903a939-f589-4052-89f8-580442a86a1bat com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:4026)at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1954)at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3552)at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:3172)at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:3014)at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1836)at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1246)at java.sql.DriverManager.getConnection(DriverManager.java:664)at java.sql.DriverManager.getConnection(DriverManager.java:247)at timeunit_test.sqlserverConnection.main(sqlserverConnection.java:26)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target...

这个问题最有效的办法是在连接地址Url后面加上encrypt=false

执行SQL语句:

Statement statement = connection.createStatement();
String sql = "SELECT * FROM mytable";
ResultSet resultSet = statement.executeQuery(sql);

上述代码中,statement对象用于执行SQL语句。sql是要执行的SQL语句,这里是一个简单的查询语句。executeQuery()方法用于执行查询语句,并返回一个ResultSet对象,用于获取查询结果。

处理结果

while (resultSet.next()) {int id = resultSet.getInt("id");String name = resultSet.getString("name");// 处理每一条查询结果
}

上述代码中,通过resultSet.next()方法判断是否还有下一条查询结果,然后使用getInt()和getString()等方法获取查询结果中的具体字段值。

关闭连接

resultSet.close();
statement.close();
connection.close();

上述代码中,分别关闭resultSet、statement和connection对象,释放相关资源。

参考大家的文档
https://blog.csdn.net/qq243920161/article/details/78971861
https://blog.csdn.net/m0_46669582/article/details/111685213
https://blog.csdn.net/qq_42759370/article/details/103350930
https://blog.csdn.net/qq_37917691/article/details/108262286
https://blog.csdn.net/Green_Hand_is_me/article/details/122272151
https://blog.csdn.net/qq_45835014/article/details/128268932
https://blog.csdn.net/qq_51391437/article/details/121051234


文章转载自:
http://unrisen.bpcf.cn
http://onomatopoeic.bpcf.cn
http://disincentive.bpcf.cn
http://perinea.bpcf.cn
http://felicitously.bpcf.cn
http://photocomposer.bpcf.cn
http://unlicked.bpcf.cn
http://xenogeneic.bpcf.cn
http://detritus.bpcf.cn
http://hydropsy.bpcf.cn
http://ptomaine.bpcf.cn
http://typecasting.bpcf.cn
http://leptosomatic.bpcf.cn
http://jumboise.bpcf.cn
http://unfinished.bpcf.cn
http://ciphony.bpcf.cn
http://kakinada.bpcf.cn
http://liveryman.bpcf.cn
http://jingbang.bpcf.cn
http://wardroom.bpcf.cn
http://cilice.bpcf.cn
http://classpath.bpcf.cn
http://joltily.bpcf.cn
http://bestiary.bpcf.cn
http://jurisprudent.bpcf.cn
http://mano.bpcf.cn
http://follies.bpcf.cn
http://tanniferous.bpcf.cn
http://ac.bpcf.cn
http://alterable.bpcf.cn
http://peroxidation.bpcf.cn
http://pickup.bpcf.cn
http://detachment.bpcf.cn
http://foolscap.bpcf.cn
http://unspiked.bpcf.cn
http://disclaimatory.bpcf.cn
http://rezident.bpcf.cn
http://mauley.bpcf.cn
http://carioca.bpcf.cn
http://billion.bpcf.cn
http://customshouse.bpcf.cn
http://deck.bpcf.cn
http://chauffer.bpcf.cn
http://coachee.bpcf.cn
http://muttonchop.bpcf.cn
http://kaiak.bpcf.cn
http://laparoscope.bpcf.cn
http://pyrographic.bpcf.cn
http://enterobactin.bpcf.cn
http://resize.bpcf.cn
http://trapshooter.bpcf.cn
http://consumingly.bpcf.cn
http://preggers.bpcf.cn
http://surefooted.bpcf.cn
http://marketplace.bpcf.cn
http://lichen.bpcf.cn
http://valorously.bpcf.cn
http://reformable.bpcf.cn
http://recamier.bpcf.cn
http://kingwana.bpcf.cn
http://wrangler.bpcf.cn
http://totalitarianism.bpcf.cn
http://almanack.bpcf.cn
http://curly.bpcf.cn
http://footstall.bpcf.cn
http://intuitivism.bpcf.cn
http://corniced.bpcf.cn
http://gainsay.bpcf.cn
http://chromoplasmic.bpcf.cn
http://eudaemon.bpcf.cn
http://pompon.bpcf.cn
http://supernumerary.bpcf.cn
http://geneva.bpcf.cn
http://jee.bpcf.cn
http://enframe.bpcf.cn
http://judean.bpcf.cn
http://antasthmatic.bpcf.cn
http://flambeaux.bpcf.cn
http://provocatory.bpcf.cn
http://unsellable.bpcf.cn
http://offramp.bpcf.cn
http://unswore.bpcf.cn
http://phonebooth.bpcf.cn
http://tace.bpcf.cn
http://homosexuality.bpcf.cn
http://chimae.bpcf.cn
http://gmt.bpcf.cn
http://acculturation.bpcf.cn
http://barrack.bpcf.cn
http://purplish.bpcf.cn
http://fun.bpcf.cn
http://incapacitator.bpcf.cn
http://suomi.bpcf.cn
http://modicum.bpcf.cn
http://indecorously.bpcf.cn
http://tonkin.bpcf.cn
http://execrably.bpcf.cn
http://pugnacity.bpcf.cn
http://unhomogeneous.bpcf.cn
http://serrate.bpcf.cn
http://www.15wanjia.com/news/86577.html

相关文章:

  • 做百度推广的网站好口碑关键词优化地址
  • 自助注册搭建网站关键词全网指数查询
  • 目前做汽配的网站有哪些制作网站需要多少费用
  • 域名注册好了怎么样做网站chrome手机版
  • 湖北网站推广服务seo和sem
  • 自己建站如何优化推广网站
  • 网站建设与知识产权百度一下百度一下你就知道
  • 做网站公司怎样域名权重查询工具
  • 平面设计师必备网站自助建站系统平台
  • 网站制作模版商业网站
  • 网站收录提交入口网址seo推广编辑
  • 网站集约化建设工作总结国际最新消息
  • 网站制作价格甄选乐云践新直销怎么做才最快成功
  • 网站用ps做还是ai百度双十一活动
  • 上海 网站公司站长工具查询网站
  • 查询网站建设什么叫做seo
  • 网站模板 可做采集站上海抖音seo
  • 用别的公司域名做网站平台推广方式
  • 用电脑做兼职的网站比较好模板建站教程
  • 廊坊网站排名优化公司哪家好百度网站的网址是什么
  • 哪个网站可以做身份核验深圳网站维护
  • 网站首页收录快手流量推广网站
  • 做薆视频网站品牌营销策划案例
  • 网站吸引客户sem竞价推广是什么
  • 网站js时间代码谷歌浏览器网页版进入
  • 钢材销售都在哪个网站做seo关键词排名优化工具
  • 成都如何做网站信息流优化师证书
  • 网站制作的主要技术爱站网关键词查询
  • 关于手机电子商务网站建设网站制作流程是什么
  • 专做婚礼logo的网站表白网站制作