jdbc.properties Must be defined in the target file. As follows:
If not, you can import it manually.
jdbc.properties Must be defined in the target file. As follows:
If not, you can import it manually.
1、 Questions
Error in starting batch task:
ERROR [com.alibaba.druid.pool.DruidDataSource]
- {dataSource-1} init error java.sql.SQLException: oracle.jdbc.OracleDriver
2、 Solution
1. The reason is that I don’t have the jar package driven by JDBC, so I found a few on the Internet and asked me to download Ojdbc14 or ojdbc7. 14 is finished, but it’s useless. Ojdbc7 is the wrong version. Later, I opened the library and found that there are problems with both downloads;
You can only delete these invalid jar packages, and then find a JDBC 6 jar package to put on. The result is OK;
1、 Questions
Recently, I’ve been building the batch framework of spring, and frequent errors have been reported. It’s a trip to the pit;
Cannot convert value of type 'java.lang.String' to
required type 'javax.sql.DataSource' for property 'dataSource':
no matching editors or conversion strategy found
2、 Solution
The reason is that [ref] is wrongly written as [value] in the XML configuration of persistence layer;
Top35: Server returns invalid timezone. Need to set ‘ServerTimezone’ property.
Error content error cause solution
Content of the error
Error reason
Server returns invalid timezone. Need to set ‘ServerTimezone’ property.
The server returning an invalid time zone needs to set the ‘ServerTimeZone’ property.
reasons: MySQL driver jar package the default time zone was UTC
the UTC is the representative of a global standard time, but we use time is Beijing time zone that is east eight area, UTC eight hours ahead.
The solution
Joining together?ServerTimeZon =UTC
HQL uses query.List () as a null pointer exception, but the database can detect the result
Solutions:
Check that the database dialect is configured correctly in hibernate configuration
org.hibernate.dialect.OracleDialect
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="dynamic-update">true</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
</props>
</property>
Give common database dialects
RDBMS th> | dialect th> tr> |
---|---|
DB2 td> | org. Hibernate. The dialect. DB2Dialect td> tr> |
DB2 AS/400 | org.hibernate.dialect.DB2400Dialect |
DB2 OS390 | org.hibernate.dialect.DB2390Dialect |
PostgreSQL | org.hibernate.dialect.PostgreSQLDialect |
MySQL | org.hibernate.dialect.MySQLDialect |
MySQL with InnoDB | org.hibernate.dialect.MySQLInnoDBDialect |
MySQL with MyISAM | org.hibernate.dialect.MySQLMyISAMDialect |
Oracle (any version) | org.hibernate.dialect.OracleDialect |
Oracle 9i/10g | org.hibernate.dialect.Oracle9Dialect |
Sybase | org.hibernate.dialect.SybaseDialect |
Sybase Anywhere | org.hibernate.dialect.SybaseAnywhereDialect |
Microsoft SQL Server | org.hibernate.dialect.SQLServerDialect |
SAP DB | org.hibernate.dialect.SAPDBDialect |
Informix | org.hibernate.dialect.InformixDialect |
HypersonicSQL | org.hibernate.dialect.HSQLDialect |
Ingres | org.hibernate.dialect.IngresDialect |
Progress | org.hibernate.dialect.ProgressDialect |
Mckoi SQL | org.hibernate.dialect.MckoiDialect |
Interbase | org.hibernate.dialect.InterbaseDialect |
Pointbase | org.hibernate.dialect.PointbaseDialect |
FrontBase | org.hibernate.dialect.FrontbaseDialect |
Firebird | org.hibernate.dialect.FirebirdDialect |
Have you ever made such a mistake?
The TCP/IP connection to the host localhost, port 1433 has failed.
com.microsoft.sqlserver.jdbc.SQLServerException:
The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect.
Verify the connection properties.
Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port.
Make sure that TCP connections to the port are not blocked by a firewall.".
Solutions:
1. Select the computer – & GT; Right click management – & GT; Computer management — & GT; Service and application
(1) first check SQL server
service whether
has been enabled to — > SQL Server configuration Manager — & GT; SQL Server service, make sure local SQL Server
service is enabled.
(2) then check SQL server
network configuration
to — > SQL Server configuration Manager — & GT; SQL Server network configuration ensures that the Named Pipes
and TCP/IP
protocols are enabled.
2. If we run the program again, it may appear that the connection is still unsuccessful, so we can continue to solve the problem:
or code> SQL server network configuration
to — > SQL Server configuration Manager — & GT; SQL Server network configuration, Named Pipes
and TCP/IP
protocol is enabled, select TCP/IP
right click – > Property – & gt; IP address, scroll down to see if IPALL
in TCP port
is 1433, no, then change to 1433
.
finally, restart SQL Server
service, then run the program again, successful, comfortable!
this problem is in the database connection failure, looked up from the Internet, the solution is varied, there are configuration files, and change the code. But everyone makes the same mistake for different reasons.
will be stupid, suddenly realized that the database can not connect, either url, or a user name or password. Turning back, the real cause was found…
error code:
String url="jdbc:mysql://localhost:3306/jdbcstudy?useUnicode=true&characterEncoding=utf8&useSSL=true";
String username="root";
String password="123456";
remove (with warning) or change to false after url:
String url="jdbc:mysql://localhost:3306/jdbcstudy?useUnicode=true&characterEncoding=utf8&useSSL=false";
String username="root";
String password="123456";
is not an error, you can query out.
p>