jdbc

Statement cancelled due to timeout or client request

佐手、 提交于 2021-02-17 06:21:30
问题 I am trying to add data to my Google Cloud SQL database using Google App Script. My code was working fine last night when I finished but when I ran it this morning it is now giving me the error "statement cancelled due to timeout or client request", the error I am getting in the cloud console is "Got an error reading communication packets". Last night it was processing about 1,600 lines of data. I have played around with it and narrowed it down that the error will occur when there is more the

“Package not accessible” error trying to import SQL Server JDBC package in project

霸气de小男生 提交于 2021-02-17 05:13:10
问题 I'm trying to use the SQL Server JDBC package in my Java project. I'm getting a The package com.microsoft.sqlserver.jdbc is not accessible error in my import statement. I've already added the MSSQL JDBC driver to the appropriate classpath (see attached image). I have another project set up exactly the same way that works just fine. The driver used is the same and the import statements match. Here are my import statements: package Main; import java.io.BufferedReader; import java.io

“Package not accessible” error trying to import SQL Server JDBC package in project

早过忘川 提交于 2021-02-17 05:12:13
问题 I'm trying to use the SQL Server JDBC package in my Java project. I'm getting a The package com.microsoft.sqlserver.jdbc is not accessible error in my import statement. I've already added the MSSQL JDBC driver to the appropriate classpath (see attached image). I have another project set up exactly the same way that works just fine. The driver used is the same and the import statements match. Here are my import statements: package Main; import java.io.BufferedReader; import java.io

Datetime behind an hour after insertion. Daylight savings

落爺英雄遲暮 提交于 2021-02-17 03:43:25
问题 I've noticed that my MySql database is subtracting an hour from my DateTime objects when I insert certain dates to my tables. Example: Insert: 2021-03-29 11:44:14.938 Result: 2021-03-29 10:44:14.938 I am inserting Java.Sql.Timestamp object ( timestamp below) using JdbcTemplate.update: jdbcTemplate.update(new PreparedStatementCreator() { @Override public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement stmt = con.prepareStatement( "INSERT INTO

Datetime behind an hour after insertion. Daylight savings

喜夏-厌秋 提交于 2021-02-17 03:40:06
问题 I've noticed that my MySql database is subtracting an hour from my DateTime objects when I insert certain dates to my tables. Example: Insert: 2021-03-29 11:44:14.938 Result: 2021-03-29 10:44:14.938 I am inserting Java.Sql.Timestamp object ( timestamp below) using JdbcTemplate.update: jdbcTemplate.update(new PreparedStatementCreator() { @Override public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement stmt = con.prepareStatement( "INSERT INTO

Changes to database session context persists with pooled connection reuse

流过昼夜 提交于 2021-02-17 02:47:45
问题 In my application, I have a connection pool that I use to obtain connections to Oracle database. I need to execute statements that call stored procedures that might affect the database session context/variables so that these changes affect only the current use of the connection. When I close the connection and obtain another connection from the pool, I want it like a new connection/session at which the effect of the procedure doesn't exist. Unfortunately, this doesn't happen. So I obtain a

Pyspark connection to the Microsoft SQL server?

大憨熊 提交于 2021-02-17 02:47:40
问题 I have a huge dataset in SQL server, I want to Connect the SQL server with python, then use pyspark to run the query. I've seen the JDBC driver but I don't find the way to do it, I did it with PYODBC but not with a spark. Any help would be appreciated. 回答1: Please use the following to connect to Microsoft SQL: def connect_to_sql( spark, jdbc_hostname, jdbc_port, database, data_table, username, password ): jdbc_url = "jdbc:sqlserver://{0}:{1}/{2}".format(jdbc_hostname, jdbc_port, database)

Pyspark connection to the Microsoft SQL server?

廉价感情. 提交于 2021-02-17 02:47:29
问题 I have a huge dataset in SQL server, I want to Connect the SQL server with python, then use pyspark to run the query. I've seen the JDBC driver but I don't find the way to do it, I did it with PYODBC but not with a spark. Any help would be appreciated. 回答1: Please use the following to connect to Microsoft SQL: def connect_to_sql( spark, jdbc_hostname, jdbc_port, database, data_table, username, password ): jdbc_url = "jdbc:sqlserver://{0}:{1}/{2}".format(jdbc_hostname, jdbc_port, database)

NLS_DATE_FORMAT with JDBC

和自甴很熟 提交于 2021-02-16 19:00:40
问题 I tried to set NLS_DATE_FORMAT inside jdbc, it didn't seem to have any effect. My code : //... Connection conn = ods.getConnection(); Statement stat = conn.createStatement(); stat.execute("alter session set NLS_DATE_FORMAT='YYYY-DD-MM'"); ResultSet rs = stat.executeQuery("select date_column from test_table"); System.out.println(rs.getString(1)); // *** new format not effective here *** //... After some reading. I understand that NLS_DATE_FORMAT is hard coded in JDBC Drivers. is this correct ?

ClassNotFoundException in JDBC program despite of adding driver's JAR file [duplicate]

蹲街弑〆低调 提交于 2021-02-16 14:20:51
问题 This question already has answers here : Connect Java to a MySQL database (14 answers) Closed 10 days ago . I am writing a simple program in Java using to demonstrate insertion of data in MySQL table using JDBC. But the program is generating ClassNotFoundException while registering driver. import java.sql.*; public class test { public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e) { System.out.println("ClassNotFoundException: