I have a java program that uses SQL queries. The goal is to send them from my home PC to a workstation on a different network elsewhere. The SQL server is on Windows Server and I opened port 1433 for …
Tag: jdbc
Return primary key value generated by default in H2 database upon INSERT of new row, for UUID type column
When using a UUID data type as the primary key of a table, and asking H2 to generate each UUID value by default upon INSERT of a new record, how does one access the value of the newly generated UUID value? I am using plain JDBC 4.x in a Java app, if that helps with a solution. I know SCOPE_IDENTITY
java netbean inserting data to db does not work
I’m trying to insert data to data base by my own interface using java netbean But I’m stuck with insert query doesn’t work here is my code segment st.executeUpdate(query) mark as wrong. Answer Ok, let me explain your problem. You don’t have configured jdbc driver. Don’t need to cast anything! You have question mark ‘?’ In your query, and you
Java JDBC – PreparedStatement executeUpdate() always returns 1
Currently I’m working on a code in java that retrieves data from XML files located in various folders and then uploads the file itself and the data retrieved to a SQL-server Database. I don’t want to upload any repeated XML file to database but since the files can have random names I’m checking using the Hash from each file I’m
“NoClassDefFoundError: javax/xml/bind/DatatypeConverter” with SQL Server JDBC
I recently switched to intellij but I’m finding it hard to connect to my localDB. The same code worked on eclipse fine. Also I have already added the sqljdbc42.jar as a module dependency. Error produced: Any help would be greatly appreciated. I’ve also tried the overloaded DriverManager.getConnection(url, user, pass) method and same error. Answer For Java 9+ compatibility, you need
How to do SQL from Akka?
What is the idiomatic Akka way to issue SQL statements from an Akka application? Specifically, I have an Akka Http REST endpoint that wants to do SQL commands. Is there some official SQL support or async or message passing style SQL library? Answer Answering your specific question, “what is the idiomatic akka way to issue sql”, I would agree with
Spring Transient Data Access Resource Exception in jdbcTemplate update
I have a method to detect duplicate entry for a column: (I inject to jdbcTemplate correctly) But i got this exception in runtime: Answer We can use the queryForList() method of jdbcTemplate like this: Where results is a List<String>.
Class.forName(JDBC_DRIVER) no longer needed?
I’ve read here on SO that since java 6 you no longer need to register JDBC Driver using: Class.forName(JDBC_DRIVER); because DriverManager uses the path located in system property “jdbc.drivers” …
How to enable logging for SQL statements when using JDBC
I am trying to enable logs using my JDBC program by connecting to Oracle database in eclipse IDE. I have gone through this SO post JDBC logging to file then I have created below java program and running it from my eclipse IDE, but I was not able to see any logs generated by the JDBC driver classes. and I
Can’t insert Cyrillic symbols into MySQL with JDBC
I have a web app which uses com.mysql.jdbc.Driver to connect to MySQL database. Here are jdbcMySQL.properties: I create database like this: And the problem is: if I make then I have in my table BUT, if I make: I have in my table: Answer MySQL is a bit crazy w.r.t. encodings, try: Furthermore there is one more possible error cause: