jdbc

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?' at line 1 [duplicate]

孤者浪人 提交于 2020-05-24 03:26:09
问题 This question already has answers here : MySQLSyntaxErrorException near “?” when trying to execute PreparedStatement (2 answers) Closed 3 days ago . I'm making an inventory system using Java and JDBC . I have got this error some how when querying a table. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?' at line 1 Below is the code public static

How can I close Oracle DbLinks in JDBC with XA datasources and transactions to avoid ORA-02020 errors?

浪子不回头ぞ 提交于 2020-05-15 03:40:05
问题 I have a JDBC-based application which uses XA datasources and transactions which span multiple connections, connected to an Oracle database. The app sometimes needs to make some queries using join with a table from another (Oracle) server using a shared DbLink. The request works if I don't do it too often, but after 4 or 5 requests in rapid succession I get an error (ORA-02020 - too many links in use). I did some research, and the suggested remedy is to call "ALTER SESSION CLOSE DATABASE LINK

Spring Security Acl object

一个人想着一个人 提交于 2020-05-14 09:06:04
问题 My service to create Acl is like this: @Autowired JdbcMutableAclService aclService; public void createAcl(AclDTO aclDTO) throws ClassNotFoundException { ObjectIdentity oi = new ObjectIdentityImpl(getClass().getClassLoader().loadClass(aclDTO.getClassPath()), aclDTO.getObjectIdentityId()); Sid sid = new PrincipalSid(aclDTO.getSid()); Permission p = getPermission(aclDTO.getPermissionDesc()); // Create or update the relevant ACL MutableAcl acl = null; try { acl = (MutableAcl) this.aclService

Spring Security Acl object

强颜欢笑 提交于 2020-05-14 08:59:50
问题 My service to create Acl is like this: @Autowired JdbcMutableAclService aclService; public void createAcl(AclDTO aclDTO) throws ClassNotFoundException { ObjectIdentity oi = new ObjectIdentityImpl(getClass().getClassLoader().loadClass(aclDTO.getClassPath()), aclDTO.getObjectIdentityId()); Sid sid = new PrincipalSid(aclDTO.getSid()); Permission p = getPermission(aclDTO.getPermissionDesc()); // Create or update the relevant ACL MutableAcl acl = null; try { acl = (MutableAcl) this.aclService

JPA column with incorrect underscore

≡放荡痞女 提交于 2020-05-10 03:42:44
问题 I use JPA for database access and annotated every column with the correct name. Now if I execute a query (e.g. findAll() ) it returns Unknown column 'program0_.program_id' in 'field list' The error message is correct program_id is unknown because the real name is programId . Models: Program @Entity @Table(name = "programs") @XmlRootElement public class Program implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "programId")

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'.

天涯浪子 提交于 2020-05-09 18:25:42
问题 This is the Warning im getting in console, Im confused with this warning Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 回答1: I resolved this problem by change application.properties of spring.datasource.driver-class-name=com.mysql.jdbc.Driver to spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver Hope it help

Docker, Springboot and Mysql : com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

一曲冷凌霜 提交于 2020-05-09 15:52:24
问题 I try to run a Springboot app with mysql connection on Docker. Without docker, it works well. But when I try to deploy on a container, I have com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure . I use this docker-compose: version: '3' services: nginx: container_name: nginx image: nginx:latest restart: always ports: - 80:80 - 443:443 volumes: - ./nginx/conf.d:/etc/nginx/conf.d depends_on: - spring-boot-app mysql: container_name: mysql image: mysql:latest environment

Docker, Springboot and Mysql : com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

梦想的初衷 提交于 2020-05-09 15:52:18
问题 I try to run a Springboot app with mysql connection on Docker. Without docker, it works well. But when I try to deploy on a container, I have com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure . I use this docker-compose: version: '3' services: nginx: container_name: nginx image: nginx:latest restart: always ports: - 80:80 - 443:443 volumes: - ./nginx/conf.d:/etc/nginx/conf.d depends_on: - spring-boot-app mysql: container_name: mysql image: mysql:latest environment

Calling stored procedure with named JDBC parameters raises exception

大城市里の小女人 提交于 2020-05-08 15:37:07
问题 package com.brookfieldres.operations; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.Date; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Properties; import java.util.ResourceBundle; import org.apache.log4j.Logger; import com.microsoft.sqlserver.jdbc.SQLServerDataSource; public class SQLConnection { private static Connection acon = null; private

SQLException: Access denied for user 'whatever'@'localhost'

佐手、 提交于 2020-05-07 08:20:16
问题 Credentials are correct, database name is correct, MySQL users are set correctly and have all the privileges, I have entries for 'username'@'%' as well as 'username'@'localhost', I can connect to this user via commandline correctly, as well as through mysql workbench. In other words, everything works as it should and is set as it should be, except my java app is unable to connect. I did about 3 clean uninstalls and installs of MySQL, with restarts, without restarts, tried to login through app