Skip to content

Tag: jdbc

“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

Use JDBC/Mysql Connector in intellij idea

I’m new in Java, and I need to establish a connection to a MySQL server (local), I have add the libraries in Intellij idea but it seems not work, the IDE can’t find the class i think… I become crazy I’m searching since two hours… I come from visual studio/c# dev environment and i think that i should miss something…

ArrayOutOfBoundsException on PreparedStatement

I’m at a loss here, can anyone see what’s wrong with this code? I’m using sqlite with this driver: https://bitbucket.org/xerial/sqlite-jdbc/downloads edit: fixed my initial error but have a similar one I get an exception at this line: stmt.setLong(1, tweet.getID()); The exception: This is how I created the table Answer As per the docs at http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html#setLong(int,%20long)

Spring boot not executing schema.sql script

I’m developing a Spring Boot web application and want to create a MySql database if it’s not already created. So I’ve done a dump of my current database in order to have an empty schema of it. Put it in /src/main/resources, so maven brings it to /WEB-INF/classes when building the war file. That’s how my application.properties is configured (according to

Returning ResultSet without close?

I would like to have a database connection managing class which I can use for simple SQL commands like SELECT, INSERT etc. by simple calling something like this (class below): This is class I’ve found on web: Is this way of returning ResultSet without closing it (and closing the statement) right? How can I return the ResultSet from the method?

Connecting to MySQL database using Java in command prompt

Since I don’t have netbeans right now, I am trying to connect to MySQL database from my Java code through command prompt. But it it is not taking the mysql-coonectivity.jar file. Does anyone know any way to run my program??? Please help. Answer Try executing the program as it is windows OS In case you don’t have the mysql-connector-java-[version].jar get