Skip to content
Advertisement

Tag: jdbc

How to call a DB2 stored procedure passing a List as param?

Java version: Java1.8 JDBC: db2jcc4-11.1.1.1 Ant1.7 Websphere8.5 I am upgrading a service to allow for passing an array of currency codes (AA, BB, CC, DD) into a stored procedure. The NSP work has been completed and verified. Here is my code below. Mapper StringHandler During runtime, I am getting this error when submitting the change to my database: FATAL com.pseuplex.j2ee.ExceptionFilter

Unable to establish JDBC connection to Oracle DBMS in Eclipse

I’m using Oracle 18c Express edition and trying to connect to the same using the below code. And upon execution, there’s an exception: I am unable to figure out what’s wrong with the URL. Kindly help resolve this issue. TIA. Answer According to Oracle’s documentation the URL should be: Where user and password can be provided as connection properties: You

How to close com.microsoft.sqlserver.jdbc.SQLServerDataSource

I’m using sql server jdbc driver mssql-jdbc-9.2.1.jre8-sources.jar and create an object of com.microsoft.sqlserver.jdbc.SQLServerDataSource. After setting it up with host-credential-etc, opening Connection and closing Connection, how do I close SQLServerDataSource object itself, I could not find any method in API. https://javadoc.io/doc/com.microsoft.sqlserver/mssql-jdbc/9.2.1.jre8/com/microsoft/sqlserver/jdbc/SQLServerDataSource.html Note to closer: I’m NOT using C3P0 connection pool, that may have close option. Answer The SQLServerDataSource is a simple

Why is it not updating

I’m trying to update my database where in the Book copies will be updated to 5 depending on the Book code. The Book copies I initialize in the database was 10. For now, I have a fixed value of 5 to change it. My plan is to decrement the copies by 1 if users borrowed it. But for now, I’m

Find records not working Jdbc stored procedure

I’m a beginner of writing JDBC stored procedures. I created the stored procedure successfully. If I find the record, I couldn’t find it. I get the error: Check connectionjava.sql.SQLException: Can’t set IN parameter for return value of stored function call. I attached the code that I tried so far Stored procedure: Answer Your callable statement has three parameters (question marks).

JDBC Statement.closeOnCompletion() should close statement on next execution?

The JDBC API has the following note related to ResultSet: A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results. In the JDBC 4.3 Specification: 13.1.4 Closing Statement Objects Closing a Statement object will close and invalidate any instances of ResultSet

JDBC: Issue with rendering Danish specific characters: Ø,Å,Æ

Problem: Danish specific characters are displayed improperly(as non readable chars) Given: Database is Microsoft SQL server 2019, database collation is: Danish_Greenlandic_100_CS_AS. Data has been stored in Varchar column types, data has been already there; change collation or any data modification is not appropriate. I am not inserting data, only reading them(kind of report functionality). Everything is working fine on my

JPA Hibernate Annotation Issue

I have three Entities i’m modeling and am having issues with the associated annotations. I basically have a class that I intend on returning to the caller, a nested listed of Project’s and the Project can contain a nested list of Endpoint’s. It’s a top-level has-a one-to-many, then the nested one-to-many has two one-to-many’s. I’ve played with @JoinColumn annotations, i’ve

Advertisement