Jeesite how to properly connect to a SQL SERVER database

Source: Internet
Author: User
Tags microsoft sql server mssql

Jeesite How to properly connect to a SQL SERVER database

Jeesite Introduction

Thanks to the author of the Jeesite Project thinkgem.

I'm not going to change this data source without you. The nen big strength,,, the giggle Hee said much.

Jeesite is an open source Java EE Rapid development platform based on a number of outstanding open source projects that are highly integrated and packaged with high efficiency, high performance and strong security .

jeesite jeesite java platform, jeesite

jeesite is in spring Framework based on a java Span style= "font-family: Arial" > Basic development platform, with spring MVC for Model View Controller, mybatis apache Shiro is the authorization layer for permissions, ehcahe activit is the workflow engine. is the best integration of javaee

server middleware: in Java EE 5 specification ( servlet 2.5 jsp 2.1 ) development, support application Server middleware has tomcat 6+ , jboss 7+ weblogic + + websphere 8+

Database support: currently only available MYSQL or Oracle database support, but not limited to the database, the platform has other database support interface, you can easily change to other databases, such as:SQL Server , MYSQL 5.5 , H2 wait

Development Environment: Java,Eclipse java EE 4.3,Maven 3.1,Git

Connecting to a data source SQL SERVER

first of all, your MySQL is normally connected by default. Here can be Niang. Inside the pits, there are also related introductions. Not much to say.

jeesite frame construction (MySQL database) :

http://blog.csdn.net/qq_16415157/article/details/50501374

http://blog.163.com/tang98989_com/blog/static/245863031201661410275153/

Text:

JDK Installation and configuration

This step is omitted, self-degree Niang installation.


MAVEN Installation and Configuration

Jeesite in the installation documentation.

Eclipse Configuration

General Eclipse has its own MAVEN plugin, Windows-Preferences, MyEclipse, maven4myeclipse, installations settings, no self-degree niang.

Run the Jeesite source code and change the data source to SQL Server.

One To change the configuration file jeesite.properties

Set Data source:src/main/resources/ Jeesite.properties, according to choose the different database comment out the relevant information and modify the database name and account password, the default is MySQL, I take mssql2008 as an example, here default is not mssql2008 but mssql2000!!

will be inside MySQL and Oracle configuration note (ctrl+/)

#oracle Database Settings

#jdbc. type=oracle

#jdbc. Driver=oracle.jdbc.driver.oracledriver

#jdbc. url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL

#jdbc. username=jeesite

#jdbc. password=123456

#MySQL database setting

#jdbc. type=MySQL

#jdbc. Driver=com.mysql.jdbc.driver

#jdbc. url=jdbc:mysql://localhost: 3306/jeesite? useunicode=true&characterencoding=UTF -8

#jdbc. Username=root

#jdbc. password=123456

#MSSQL Database Settings

#SQL sever2005 above, please configure the driver package, the following configuration

Jdbc.type=MSSQL

Jdbc.driver=com.microsoft.sqlserver.jdbc.sqlserverdriver

Jdbc.url=jdbc:sqlserver://127.0.0.1:1433;databasename=Jeesite

Jdbc.username=SA

# DatabaseName according to its own, password username needs to be SQL Server identity (mixed identity)

jdbc.password=123789

#MSSQL Database Settings

#SQL SERVER2000 Configuration

#jdbc. type=MSSQL

#jdbc. Driver=net.sourceforge.jtds.jdbc.driver

#jdbc. url=jdbc:jtds:sqlserver://localhost: 1433/jeesite

#jdbc. username=SA

#jdbc. password=SA

if Dual Object Error,

jdbc.testsql=select ' x '

#jdbc. Testsql=select ' x ' from DUAL

Two. Open the source configuration Pom.xml

Remember to open the note here, and don't forget.

<!--MySQL

<property name= "Dbunit.datatype" value= "Org.dbunit.ext.mysql.MySqlDataTypeFactory"/>-->

<!--MSSQL---

<property name="Dbunit.datatype" value="org.dbunit.ext.mssql.MsSqlDataTypeFactory" />

<!--Oracle

<property name= "Dbunit.datatype" value= "Org.dbunit.ext.oracle.Oracle10DataTypeFactory"/>--

three sqljdbc41.jar driver Import

Download the driver package first, if it is directly configured.

Http://www.microsoft.com/downloads/details.aspx?FamilyID=a737000d-68d0-4531-b65d-da0f2a735707&displayLang=zh-cn

Jar

Description

sqljdbc.jar

The Sqljdbc.jar   Class Library provides support for JDBC 3.0. The

Sqljdbc.jar   Class library requires the use of version 5.0 of the Java Runtime Environment (JRE). When connecting to a database, use   on JRE 6.0; Sqljdbc.jar   throws an exception.

Note: &NBSP;JDBC Driver 2.0 does not support JRE 1.4. When using JDBC Driver 2.0, you must upgrade JRE 1.4 to JRE 5.0 or later. In some cases, you may need to recompile your application because it may be incompatible with JDK 5.0 or later. For more information, please refer to the documentation on the Sun Microsystems website.

Sqljdbc4.jar

The Sqljdbc4.jar class Library provides support for JDBC 4.0. It includes not only all the features of Sqljdbc.jar , but also the new JDBC 4.0 method.

The Sqljdbc4.jar class library requires a Java runtime environment (JRE) of version 6.0 or later. Using Sqljdbc4.jar on JRE 1.4 or 5.0 throws an exception.

Note: If the application must be running on JRE 6.0, use Sqljdbc4.jareven if the application does not use the JDBC 4.0 feature.

here if it is SQL SERVER2000 and the following can be used directly with Sqljdbc.jar

I use it here. SQL Server, using Sqljdbc4.jar mainly.

How to use:

after downloading , put Sqljdbc4.jar under your D:\java\jdk1.7\jre\lib\ext folder.

Then load the Sqljdbc4.jar into your Web-inf lib.

Then select sqljdbc41.jar bulib path add to import into your maven repository.

Rack Package Import Success ...

Four SQL SERVER service

Open SQL Server Configuration Manager

All IP here needs to be started,,,ipall port is selected as 1433,and of course you can set it for yourself, but it needs to be configured well, port open.

and then restart SQL SERVER Service ,,,

Open Way: protocol for SQL Server network configuration---MSSQLSERVER, configuration tools, SQL Server Configuration Manager, Microsoft SQL Server profile--Right TCP/IP, setting up LAN ip:19 2.168.x.x or local ip:127.0.0.1, modify no active, settings started as Yes! Otherwise you will never connect (MSSQL default port of 1433 can be seen in the figure, want to modify into another port also line), finally in the service to restart the SQL Server is good.

Five, some maven,,, the update of Tomcat,,, , etc., do not repeat.

I go to the pit some let oneself collapse, hope you don't go nen many pits.

If you have any questions, please contact qq:1004051821 or email [email protected]

Jeesite how to properly connect to a SQL SERVER database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.