I am trying to query a table called student in MySQL. This is the structure: Here is the java code which I use to query: This is the error message: Here is the image of the referenced libraries: Insertion into table is working correctly. Only querying isn’t. What is the error here? Please comment if extra information is needed. UPDATE:
Tag: jdbc
How to change id column type already registered in the database
I’m trying to change my Id column type from int to bigInt because the records are too big and I’m getting an error if I try to store more records but I’m not sure if it’s safe to just alter the table like this: I’m using Java Springboot to create the entities and Hibernate for persistence. What’s the best way
Can’t automatically obtain ID for a record in database
My entity is: Method to write a record to the database. I just want to send it to the database and automatically obtain an ID for every record in this table, but every time when I do this – “status”: 500, “error”: “Internal Server Error”. And nothing changing in table. My table is: Why it doesn’t work so? Answer You
Result set is empty but query works in Postgres
I’m trying to get some results from Postgres into my Java application. As of now, I always used PreparedStatements with ResultSets to get data from my database in memory. But today my code refuses to work, although I use the same code as usual. Here is my piece of code: Here is the log: The ArrayList explicitCollectionsIds is empty/not filled
Compiling a function or procedure using JDBC removes all records from all_statements view
After I execute/compile a stored procedure/function, I query the all_statements view to extract the statements that were in the stored procedure/function like below: However, one of my applications run the following code: Whenever this code is run, the all_statements view is cleared. Even if I execute this same function like below: There are no new entries in all_statements showing the
Java Melody does not show any sql data on xampp tomcat8
On Xampp Tomcat on Windows 11, I am trying to monitor java-web-app with java melody. However, sql data is not detected by java melody. Could you figure out what i am missing? I have created a library project, not to do same settings on every app Here is the projects code… pom.xml: TGS_ProfileServletUtils.java: TS_ProfileMelodyUtils.java: a helper class On another api,
Why can’t a bind variable be used from ojdbc with Oracle JSON_ARRAY() in the presence of FORMAT JSON
In Oracle, the following query: Produces the following JSON document: When I try to run this query with bind variables from JDBC like this: Then I’m getting: I’m using these versions: Database: Oracle Database 21c Express Edition Release 21.0.0.0.0 – Production ojdbc: com.oracle.database.jdbc:ojdbc11:21.5.0.0 Is this a bug? Can it be worked around? Answer In my opinion, it’s a bug in
List of Java Connection (JDBC) non-db specific properties?
Where can I find a good (maybe official) source (list) of non-db specific properties (keys)? Answer See the DriverManager.getConnection(String url, Properties info) Javadoc: info – a list of arbitrary string tag/value pairs as connection arguments; normally at least a “user” and “password” property should be included Other than that, neither the Java API documentation nor the JDBC 4.3 Specification make
Error when trying to set up JDBC connection with local MYSQL database in Java 17 with a spring boot project
My project is generated/downloaded from: https://start.spring.io/ I am now trying to connect to my local MYSQL database which actually has data in it and is fully functional. To do this I am using a springboot project where I want to set up a jdbc connection, as I was able to do before in Java 8. But now when I run
Should I avoid big transaction and exclude read-only queries from transaction
I’ve seen articles saying that we should try to limit the scope of transaction, e.g. instead of doing this: We should exclude queryData from the transaction by using Spring’s TransactionTemplate (or just move it out of the transactional method): But my understanding is that since JDBC will always need a transaction for all operations, if I use the second way,