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

鲜花网网站建设的目的石家庄网络营销网站推广

鲜花网网站建设的目的,石家庄网络营销网站推广,淘宝网站开始怎么做,创建手机网站模版1. 配置 (1)新建一个项目 (2)Build System 那里选择Maven,下一步Create (3)配置pom.xml文件 首先查看自己的MYSQL版本:进入MySQL命令窗口 我的MYSQL版本是8.0版本的. 下一步,…

1. 配置

(1)新建一个项目
在这里插入图片描述

(2)Build System 那里选择Maven,下一步Create
在这里插入图片描述
(3)配置pom.xml文件
首先查看自己的MYSQL版本:进入MySQL命令窗口
在这里插入图片描述

我的MYSQL版本是8.0版本的.

下一步,去Maven官网:Maven
点击搜索框,输入Java,回车
在这里插入图片描述
点击下图这个:
在这里插入图片描述
找到对应版本点击进去,比如我的是8.0.28,那我就点即8.0.x最新版的8.0.33。
在这里插入图片描述
下拉,点击Maven,复制里边的代码。
在这里插入图片描述
回到我们刚创建的Java项目,在pom文件中
先写以下代码:

<dependencies>  </dependencies>

再把刚才从Maven中复制的代码放到上面代码的中间。(通常情况会报错,这是正常的):
在这里插入图片描述
(4)setting文件

新建一个setting文件,文件后缀是.xml,然后在文件中填入下面的代码,记住文件路径,记得保存。
在这里插入图片描述

<?xml version="1.0" encoding="UTF-8"?><!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--><!--| This is the configuration file for Maven. It can be specified at two levels:||  1. User Level. This settings.xml file provides configuration for a single user,|                 and is normally provided in ${user.home}/.m2/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -s /path/to/user/settings.xml||  2. Global Level. This settings.xml file provides configuration for all Maven|                 users on a machine (assuming they're all using the same Maven|                 installation). It's normally provided in|                 ${maven.conf}/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -gs /path/to/global/settings.xml|| The sections in this sample file are intended to give you a running start at| getting the most out of your Maven installation. Where appropriate, the default| values (values used when the setting is not specified) are provided.||-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"><!-- localRepository| The path to the local repository maven will use to store artifacts.|| Default: ${user.home}/.m2/repository<localRepository>/path/to/local/repo</localRepository>--><!-- interactiveMode| This will determine whether maven prompts you when it needs input. If set to false,| maven will use a sensible default value, perhaps based on some other setting, for| the parameter in question.|| Default: true<interactiveMode>true</interactiveMode>--><!-- offline| Determines whether maven should attempt to connect to the network when executing a build.| This will have an effect on artifact downloads, artifact deployment, and others.|| Default: false<offline>false</offline>--><!-- pluginGroups| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.|--><pluginGroups><!-- pluginGroup| Specifies a further group identifier to use for plugin lookup.<pluginGroup>com.your.plugins</pluginGroup>--></pluginGroups><!-- proxies| This is a list of proxies which can be used on this machine to connect to the network.| Unless otherwise specified (by system property or command-line switch), the first proxy| specification in this list marked as active will be used.|--><proxies><!-- proxy| Specification for one proxy, to be used in connecting to the network.|<proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>--></proxies><!-- servers| This is a list of authentication profiles, keyed by the server-id used within the system.| Authentication profiles can be used whenever maven must make a connection to a remote server.|--><servers><!-- server| Specifies the authentication information to use when connecting to a particular server, identified by| a unique name within the system (referred to by the 'id' attribute below).|| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are|       used together.|<server><id>deploymentRepo</id><username>repouser</username><password>repopwd</password></server>--><!-- Another sample, using keys to authenticate.<server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional; leave empty if not used.</passphrase></server>--></servers><!-- mirrors| This is a list of mirrors to be used in downloading artifacts from remote repositories.|| It works like this: a POM may declare a repository to use in resolving certain artifacts.| However, this repository may have problems with heavy traffic at times, so people have mirrored| it to several places.|| That repository definition will have a unique id, so we can create a mirror reference for that| repository, to be used as an alternate download site. The mirror site will be the preferred| server for that repository.|--><mirrors><!-- mirror| Specifies a repository mirror site to use instead of a given repository. The repository that| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.|<mirror><id>mirrorId</id><mirrorOf>repositoryId</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://my.repository.com/repo/path</url></mirror><mirror><id>nexus-aliyun</id><mirrorOf>*</mirrorOf><name>Nexus aliyun</name><url>http://maven.aliyun.com/nexus/content/groups/public</url></mirror> <mirror><id>maven-default-http-blocker</id><mirrorOf>external:http:*</mirrorOf><name>Pseudo repository to mirror external repositories initially using HTTP.</name><url>http://0.0.0.0/</url><blocked>true</blocked></mirror>--><mirror><id>aliyun-public</id><mirrorOf>*</mirrorOf><name>aliyun public</name><url>https://maven.aliyun.com/repository/public</url></mirror><mirror><id>aliyun-central</id><mirrorOf>*</mirrorOf><name>aliyun central</name><url>https://maven.aliyun.com/repository/central</url></mirror><mirror><id>aliyun-spring</id><mirrorOf>*</mirrorOf><name>aliyun spring</name><url>https://maven.aliyun.com/repository/spring</url></mirror></mirrors><!-- profiles| This is a list of profiles which can be activated in a variety of ways, and which can modify| the build process. Profiles provided in the settings.xml are intended to provide local machine-| specific paths and repository locations which allow the build to work in the local environment.|| For example, if you have an integration testing plugin - like cactus - that needs to know where| your Tomcat instance is installed, you can provide a variable here such that the variable is| dereferenced during the build process to configure the cactus plugin.|| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles| section of this document (settings.xml) - will be discussed later. Another way essentially| relies on the detection of a system property, either matching a particular value for the property,| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.| Finally, the list of active profiles can be specified directly from the command line.|| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact|       repositories, plugin repositories, and free-form properties to be used as configuration|       variables for plugins in the POM.||--><profiles><!-- profile| Specifies a set of introductions to the build process, to be activated using one or more of the| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>| or the command line, profiles have to have an ID that is unique.|| An encouraged best practice for profile identification is to use a consistent naming convention| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.| This will make it more intuitive to understand what the set of introduced profiles is attempting| to accomplish, particularly when you only have a list of profile id's for debug.|| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.<profile><id>jdk-1.4</id><activation><jdk>1.4</jdk></activation><repositories><repository><id>jdk14</id><name>Repository for JDK 1.4 builds</name><url>http://www.myhost.com/maven/jdk14</url><layout>default</layout><snapshotPolicy>always</snapshotPolicy></repository></repositories></profile>--><!--| Here is another profile, activated by the system property 'target-env' with a value of 'dev',| which provides a specific path to the Tomcat instance. To use this, your plugin configuration| might hypothetically look like:|| ...| <plugin>|   <groupId>org.myco.myplugins</groupId>|   <artifactId>myplugin</artifactId>||   <configuration>|     <tomcatLocation>${tomcatPath}</tomcatLocation>|   </configuration>| </plugin>| ...|| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to|       anything, you could just leave off the <value/> inside the activation-property.|<profile><id>env-dev</id><activation><property><name>target-env</name><value>dev</value></property></activation><properties><tomcatPath>/path/to/tomcat/instance</tomcatPath></properties></profile>--></profiles><!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>-->
</settings>

按照下图把 User setting file的文件路径改成刚才保存的setting文件路径。
在这里插入图片描述

做完上面的之后,手动点一下下面的图表,重新加载pom(过程可能有点慢)
在这里插入图片描述
最后出现下图的结果配置就完成了。
在这里插入图片描述

2. 连接数据库

2.1 student类

package com.model;public class Student {private int id;private String sn;private String name;private String mail;private int classesId;public int getId() {return id;}public void setId(int id) {this.id = id;}public String getSn() {return sn;}public void setSn(String sn) {this.sn = sn;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getMail() {return mail;}public void setMail(String mail) {this.mail = mail;}public int getClassesId() {return classesId;}public void setClassesId(int classesId) {this.classesId = classesId;}@Overridepublic String toString() {return "Student{" +"id=" + id +", sn='" + sn + '\'' +", name='" + name + '\'' +", mail='" + mail + '\'' +", classesId=" + classesId +'}';}
}

2.2 Demo01_Connection类

package com;import com.model.Student;import com.mysql.cj.jdbc.MysqlDataSource;import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Scanner;public class Demo01_Connection {// 先定义一个数据源对象private static DataSource dataSource = null;// 数据库的用户名private static final String USER = "root";// 数据库的密码private static final String PASSWORD = "123456";// 数据库连接字符串private static final String URL = "jdbc:mysql://127.0.0.1:3306/myjava?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai";public static void main(String[] args) {// 1. 初化始数据源MysqlDataSource myDataSourse = new MysqlDataSource();// 2. 设置连接的参数myDataSourse.setURL(URL);myDataSourse.setUser(USER);myDataSourse.setPassword(PASSWORD);// 3. 把构建好的Mysql数据源赋值给JDBC中的datasourcedataSource = myDataSourse;Connection connection = null;// 预处理对象//Statement statement = null;//危险PreparedStatement statement = null;ResultSet resultSet = null;try{// 1. 通过数据源获取一个数据库连接connection = dataSource.getConnection();// 接收用户输入的值System.out.println("请输入学号:");Scanner scanner = new Scanner(System.in);String sn = scanner.next();// 2. 定义SQL语句
//            String sql = "select * from student where sn = '" + sn +"'";//危险操作String sql = "select * from student where sn = ?";//?为占位符System.out.println(sql);// 3. 获取statement对象
//            statement = connection.createStatement();// 获取一个预处理对象statement = connection.prepareStatement(sql);// 处理占位符的值statement.setString(1,sn);// 4. 执行SQLresultSet = statement.executeQuery();// 5. 解析结果集,resultSet.next()表示结果集中是否有记录if(resultSet.next()){// 创建表示结果的JAVA对象Student student = new Student();// 依次读取结果集中的数据并赋值给JAVA对象student.setId(resultSet.getInt(1));student.setSn(resultSet.getString(2));student.setName(resultSet.getString(3));student.setMail(resultSet.getString(4));student.setClassesId(resultSet.getInt(5));// 打印结果System.out.println(student);}} catch (SQLException e) {throw new RuntimeException(e);} finally {// 依次关闭资源if (resultSet != null) {try {resultSet.close();} catch (SQLException e) {e.printStackTrace();}}if (statement != null) {try {statement.close();} catch (SQLException e) {e.printStackTrace();}}if (connection != null) {try {connection.close();} catch (SQLException e) {e.printStackTrace();}}}}
}

2.3 测试结果

在这里插入图片描述


文章转载自:
http://dinncohypolimnion.bkqw.cn
http://dinncojoel.bkqw.cn
http://dinncoreallocate.bkqw.cn
http://dinncoforthright.bkqw.cn
http://dinncobloodline.bkqw.cn
http://dinncosolano.bkqw.cn
http://dinncogofer.bkqw.cn
http://dinncoslaw.bkqw.cn
http://dinncorepost.bkqw.cn
http://dinncomiami.bkqw.cn
http://dinncoreinstallment.bkqw.cn
http://dinncocobbly.bkqw.cn
http://dinncoholocoder.bkqw.cn
http://dinncophotocurrent.bkqw.cn
http://dinncobogy.bkqw.cn
http://dinncosubnormal.bkqw.cn
http://dinncocaramelization.bkqw.cn
http://dinncoinfundibular.bkqw.cn
http://dinncofistula.bkqw.cn
http://dinncosnipey.bkqw.cn
http://dinncoalec.bkqw.cn
http://dinncosmoothie.bkqw.cn
http://dinncorestis.bkqw.cn
http://dinncokopis.bkqw.cn
http://dinncowidest.bkqw.cn
http://dinncomonofil.bkqw.cn
http://dinncowrought.bkqw.cn
http://dinncodearie.bkqw.cn
http://dinncoaskance.bkqw.cn
http://dinncoarrester.bkqw.cn
http://dinncoplaneload.bkqw.cn
http://dinncorhabdocoele.bkqw.cn
http://dinncochump.bkqw.cn
http://dinncoeulamellibranch.bkqw.cn
http://dinncofloodlit.bkqw.cn
http://dinncohisself.bkqw.cn
http://dinncolaugh.bkqw.cn
http://dinncoraised.bkqw.cn
http://dinncooba.bkqw.cn
http://dinncosmithsonite.bkqw.cn
http://dinncoepicardial.bkqw.cn
http://dinncoleastwise.bkqw.cn
http://dinncotaser.bkqw.cn
http://dinncotruncation.bkqw.cn
http://dinncohypothalamic.bkqw.cn
http://dinncohemialgia.bkqw.cn
http://dinncomaori.bkqw.cn
http://dinncostt.bkqw.cn
http://dinncodomestication.bkqw.cn
http://dinncoreceived.bkqw.cn
http://dinncoimprobable.bkqw.cn
http://dinncopalimpsest.bkqw.cn
http://dinncomobbism.bkqw.cn
http://dinncocountable.bkqw.cn
http://dinncobioceramic.bkqw.cn
http://dinncohalcyone.bkqw.cn
http://dinncobestrode.bkqw.cn
http://dinncopepita.bkqw.cn
http://dinncogala.bkqw.cn
http://dinncoschefflera.bkqw.cn
http://dinncoabominably.bkqw.cn
http://dinncoequilibrize.bkqw.cn
http://dinncoveejay.bkqw.cn
http://dinncoofuro.bkqw.cn
http://dinncoconflictive.bkqw.cn
http://dinncoita.bkqw.cn
http://dinncomesmerize.bkqw.cn
http://dinncodepicture.bkqw.cn
http://dinncoarrogate.bkqw.cn
http://dinncomitochondrion.bkqw.cn
http://dinncovaunt.bkqw.cn
http://dinncodangleberry.bkqw.cn
http://dinncoatavic.bkqw.cn
http://dinncofistnote.bkqw.cn
http://dinncodecamp.bkqw.cn
http://dinncoskelp.bkqw.cn
http://dinncoguitarfish.bkqw.cn
http://dinncosorcery.bkqw.cn
http://dinncojdbc.bkqw.cn
http://dinncopiercer.bkqw.cn
http://dinncoshipowner.bkqw.cn
http://dinncosan.bkqw.cn
http://dinncoalias.bkqw.cn
http://dinncodelaminate.bkqw.cn
http://dinncochevalier.bkqw.cn
http://dinncoumbral.bkqw.cn
http://dinncoascot.bkqw.cn
http://dinncoapprenticeship.bkqw.cn
http://dinncosalicylaldehyde.bkqw.cn
http://dinncosoaring.bkqw.cn
http://dinncoperve.bkqw.cn
http://dinncoheterophyllous.bkqw.cn
http://dinncoresearchful.bkqw.cn
http://dinncoattenuation.bkqw.cn
http://dinncoclabularium.bkqw.cn
http://dinncoarguer.bkqw.cn
http://dinncocutback.bkqw.cn
http://dinncoperisperm.bkqw.cn
http://dinncocontactor.bkqw.cn
http://dinncotriboelectricity.bkqw.cn
http://www.dinnco.com/news/123687.html

相关文章:

  • 做里番网站犯法吗上海网站制作
  • 张家界做网站的动态网站建设
  • 厦门市建设工程质量安全协会网站最新新闻事件今天疫情
  • wordpress获取别名如何刷seo关键词排名
  • 网站设置不发送消息怎么设置回来长春网站建设方案报价
  • 义乌商城网站开发调研报告万能模板
  • 淮北市重点工程建设局网站信息流推广的竞价机制是
  • 费县做网站杭州seo网站优化
  • 怎么免费做自己的网站seo技术培训泰州
  • 吃鸡辅助群的购卡链接网站怎么做创建网站需要多少资金
  • seo优化必备技巧网站建设推广优化
  • 自己有个服务器 怎样做网站百度推广合作
  • 济南网站建设公司排名西安网站建设比较好的公司
  • 网站建设简历模板百度地图导航2021最新版
  • 苏州做网站便宜的公司网站推广和宣传的方法
  • 做1个自己的贷款网站seo排名赚app
  • 做移动类网站的书推荐sku电商是什么意思
  • 重庆电商平台网站建设网络营销职业规划300字
  • 亚洲av成人片无码网站在线观看惠州seo关键字排名
  • 上海浦东新区科技网站建设nba季后赛最新排名
  • wordpress 百度插件整站seo怎么做
  • php做网站开发有什么框架找培训机构的网站
  • 企业微网站建设营销型企业网站
  • 我朋友是做卖网站的抖音seo教程
  • 网站怎么提高收录杭州seo博客
  • 泰安千橙网络科技有限公司微博seo营销
  • 网站背景图片怎么做谷歌浏览器官网手机版
  • 做web网站网页搜索关键词
  • 如何给自己建设的网站设置登陆用户名和密码百度账号客服人工电话
  • php网站接入支付宝好的搜索引擎推荐