jdbc

UCanAccess: No suitable driver found

余生长醉 提交于 2021-01-28 20:22:02
问题 I keep getting the 'No suitable driver found' in my database and I can't pin down what's wrong with my connect class? Any help? I've got all 5 jars in. I want to connect to a Microsoft Access Database. import java.sql.*; public class Connect { public Connection con; Statement st; public Connect() { try { Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); Connection con=DriverManager.getConnection("jdbc:ucanaccess:E://EclipsePortable//Data//workspace//ThisWillWork//res//Railway.accdb");

The column name is not valid - error

妖精的绣舞 提交于 2021-01-28 19:22:16
问题 I am getting this error while I am fetching value from resultset. Error : com.microsoft.sqlserver.jdbc.SQLServerException: The column name company.short_name is not valid CASE 1 : select company.short_Name,location_name from company,location; this query is executing fine on SQL Server but in my java code when I trying to retrieve value like resultset.getString("company.short_name"); that time this give the above error. CASE 2 : select company.short_Name short_name,location_name from company

Logstash exception Expected one of #, input, filter, output at line 1, column 1

主宰稳场 提交于 2021-01-28 19:02:15
问题 When I insert the new data in my database (MySQL), Logstash doesn't add it dynamically : Below you will see logstash.conf (it's the file who connected elasticsearch with mysql) input { jdbc { jdbc_connection_string => "jdbc:mysql://localhost:3306/blog" #Accès à la base de données jdbc_user => "root" jdbc_password => "" jdbc_driver_library => "C:\Users\saidb\Downloads\mysql-connector-java-5.1.47\mysql-connector-java-5.1.47.jar" jdbc_driver_class => "com.mysql.jdbc.Driver" schedule => "* * * *

java.lang.NoClassDefFoundError: com/google/cloud/sql/core/CoreSocketFactory

 ̄綄美尐妖づ 提交于 2021-01-28 17:57:28
问题 I keep getting this error when I try to run a script that connects to a google cloud instance via jdbc. Not really sure at all how to fix it: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/cloud/sql/core/CoreSocketFactory at com.google.cloud.sql.postgres.SocketFactory.createSocket(SocketFactory.java:73) at org.postgresql.core.PGStream.<init>(PGStream.java:73) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:93) at org.postgresql.core

Generate default values for new rows in H2 database by calling a Java method

不问归期 提交于 2021-01-28 12:44:40
问题 When generating test data, I want a field in new rows to default to a value of gibberish generated by lorem, a Lorem Ipsum generator for Java. Calling the lorem tool in Java looks like this: String lorem = LoremIpsum.getInstance().getWords( 100 , 120 ); I tried this SQL as my table definition: String sql = """ CREATE ALIAS LOREM FOR "com.thedeanda.lorem.LoremIpsum.getInstance().getWords( 100 , 120 )"; CREATE TABLE IF NOT EXISTS thing_ ( nonsense_ text NOT NULL , row_created_ TIMESTAMP WITH

Generate default values for new rows in H2 database by calling a Java method

扶醉桌前 提交于 2021-01-28 12:40:22
问题 When generating test data, I want a field in new rows to default to a value of gibberish generated by lorem, a Lorem Ipsum generator for Java. Calling the lorem tool in Java looks like this: String lorem = LoremIpsum.getInstance().getWords( 100 , 120 ); I tried this SQL as my table definition: String sql = """ CREATE ALIAS LOREM FOR "com.thedeanda.lorem.LoremIpsum.getInstance().getWords( 100 , 120 )"; CREATE TABLE IF NOT EXISTS thing_ ( nonsense_ text NOT NULL , row_created_ TIMESTAMP WITH

Cannot connect/query from Presto on AWS EMR with Java JDBC

南笙酒味 提交于 2021-01-28 12:22:20
问题 If I ssh onto the master node of my presto emr cluster, I can run queries. However, I would like to be able to run queries from java source code on my local machine that connects to the emr cluster. I set up my presto emr cluster with default configurations. I have tried port forwarding, but it still does not seem to work. When I create the connection, I print it out and it is "com.facebook.presto.jdbc.PrestoConnection@XXXXXXX" but I still have doubts if it is actually connected since I can't

Is that possible that access to a sql table with question mark?

扶醉桌前 提交于 2021-01-28 11:44:19
问题 I have 3 sql tables customer, employee and manager. I want to access dynamically to my tables. I had a statement like this, "update customer set AMOUNT where ID= ?" But int this situation i can only access to customer. I need to access all of the tables for different operations. Is that possible that write this, "update ? set AMOUNT where ID=?" or what can i do to access for example employee for a different class. 回答1: The parameters can be used only in the place where you could otherwise use

JDBC Batch INSERT, RETURNING IDs

╄→гoц情女王★ 提交于 2021-01-28 09:13:24
问题 is there any way to get the values of affected rows using RETURNING INTO ? I have to insert the same rows x times and get the ids of inserted rows. The query looks like below: public static final String QUERY_FOR_SAVE = "DECLARE " + " resultId NUMBER ; " + "BEGIN " + " INSERT INTO x " + " (a, b, c, d, e, f, g, h, i, j, k, l, m) " + " values (sequence.nextVal, :a, :b, :c, :d, :e, :f, :g, :h, :i, :j, :k, :l) " + " RETURNING a INTO :resultId;" + "END;"; Now i can add thise query to batch, in

JDBC Batch INSERT, RETURNING IDs

北慕城南 提交于 2021-01-28 09:07:02
问题 is there any way to get the values of affected rows using RETURNING INTO ? I have to insert the same rows x times and get the ids of inserted rows. The query looks like below: public static final String QUERY_FOR_SAVE = "DECLARE " + " resultId NUMBER ; " + "BEGIN " + " INSERT INTO x " + " (a, b, c, d, e, f, g, h, i, j, k, l, m) " + " values (sequence.nextVal, :a, :b, :c, :d, :e, :f, :g, :h, :i, :j, :k, :l) " + " RETURNING a INTO :resultId;" + "END;"; Now i can add thise query to batch, in