Click here to Skip to main content
15,890,438 members
Everything / JDBC

JDBC

JDBC

Great Reads

by Bert O Neill
Query Hadoop using Microsoft oriented technologies (C#, SSIS, SQL Server, Excel etc.)
by Bogdan Marian
Ensure your Docker Compose services start in the correct order
by anshulskywalker
Understanding of Example Based Machine Translation (EBMT) system and how to create your own using exisiting tools
by V.
How to dynamically build a JQPlot graph through the code behind.

Latest Articles

by Bogdan Marian
Ensure your Docker Compose services start in the correct order
by Łukasz Bownik
A fluent JDBC wrapper written in 200 lines of code
by James A. Brannan
In this tutorial, we secure a simple Rest API. We begin with a simple example, progress to using a custom UserDetailsService, and finish by adding method level security.
by Han Bo Sun
In this tutorial, I will introduce the use of Spring JdbcTemplate in a Spring Boot web application. This tutorial will show how to create the necessary configuration for JdbcTemplate. And how it can be used for data insertion and retrieval.

All Articles

Sort by Updated

JDBC 

19 Dec 2009 by 0x3c0
This isn't a homework site. If you want source code, then use Rentacoder. If you've already got the foundations of the mailing system, then you need to ask specific questions related to any problems you have.
27 May 2012 by Abhinav S
You can do this by using a binary field.Here[^] is a link that could help you.This link[^] provides another tutorial as well.A similar question[^] was asked some time ago.
14 Jan 2014 by agha_ali22
i have a RECID,regionID, areaID ,UserID ,AppNo, NextAppNo(Accepts null)and data is as follow(NextApp is in the first row only)1,102,Ar-1,xyz,1,1 2,102,Ar-1,,erer,23,102,Ar-1,tyty,34,102,Ar-1,tyty,41)now i want to add another record what i am doing is first getting...
16 Jan 2014 by agha_ali22
i have a sql queryselect * from old table (update tbl set col1= 2)query works fine in command line but when used with jdbc it return the value correctly but does not update the valueshere is a code snippetResultSet rs = st.executeQuery(sql); i am...
21 Nov 2021 by Alex Darius
statement3.execute("CREATE TABLE accomodation_fare_relations (\n" + " id integer,\n" + " id_accomodation integer NOT NULL,\n" + " id_room_fare integer NOT NULL,\n" + " PRIMARY...
21 Dec 2012 by alexpandy1
I connected a MS Access database with java code and now I want only specific values in database must be set, else it must throw an error with the details of that field
15 Jul 2022 by Amey D
Below are my connection settings for Oracle SQL Developer with tnsnames.ora Imgur: The magic of the Internet[^] The pattern of jdbc string required is as below : jdbc:oracle:thin@:1521: What I have tried: I have tried the...
5 Jan 2013 by AmitGajjar
Hi,Incorrect spell Quote:VALAUESit should be values.best luck
13 Aug 2012 by Andrei Straut
To upload an image using Java (or any programming language, for that matter), you basically have two options:- Upload the picture as a blob (what you're trying to do, BUT, you need to turn the picture into a stream -> see example here[^] for instance), or:- Upload the picture to your server,...
14 Aug 2012 by Andrei Straut
I'm posting this as a solution, and not as a comment, because i think it is a larger explanation, and not a comment in itselfThis line: psmnt = con.prepareStatement("insert into INSTRUCTOR(INAME, ISURNAME, IMAGE, ITITLE) "+ "values(DEFAULT)");PreparedStatements don't work that way. You...
15 Aug 2012 by Andrei Straut
About the fileChooser - You don't display it directly, that's bad practice. You need a "Browse" button, and when your user presses that button, the you display the fileChooser in a modal window. Check below (working example, tested on my computer).First, declare and instantiate your file...
10 Aug 2010 by anshulskywalker
Understanding of Example Based Machine Translation (EBMT) system and how to create your own using exisiting tools
24 Apr 2012 by AprNgp
A simple code to map JDBC ResultSet to an Object using Annotations in a generic way
6 Apr 2009 by arnavguddu
This article demostrates how to access MS Access databases from Java.
29 Dec 2015 by Bert O Neill
Query Hadoop using Microsoft oriented technologies (C#, SSIS, SQL Server, Excel etc.)
23 Oct 2012 by Bhaskar Pathak
import java.util.*;import java.io.*;import java.sql.*;public class Stud{ public static void main(String args[]) { try { Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("Driver Registered"); Connection connection =...
6 Jul 2017 by Bilal Zafar
Hello all, I am very new to java, so please ignore if you think this question is stupid. A task has been assigned to me in which I have to extract data from h2 database table with **more than 1 crore rows (SAD) from one table.** And finally show that data into a j table with pagination. What i...
20 Mar 2023 by Bogdan Marian
Ensure your Docker Compose services start in the correct order
12 Dec 2011 by boude
Hi,I'm trying to get a connection via netbeans to a database server of mine. Problem is that when i try to make a connection, it just loads and never returns with an error or response. I've even tried creating a connection by using the services tab in netbeans. Can anyone help me with this...
1 Jun 2014 by Cesar Bretana Gonzalez
Hello, please, if anybody here knows how to install the 64 bits version of odbc, or where to found it, I need your help, I'm working in a project in Java, using Netbeans 7.3, and I need to link my project with a Microsoft Access 2013 Database (*.accdb), I just found the solution to this problem,...
6 Jun 2014 by Cesar Bretana Gonzalez
thanks, i have already solve the problem, anyway thanks for the time...
18 Jun 2013 by chandan kumar
I imported the project in the netbeans with some external packages but I am not able to solve two problem in package connectionManager.java & log.java. when I Open the file ConnectionManager.java.................................DBPool pool = DBPool.getPool(dbAlias);Error:method...
15 Jul 2011 by Chief894
Hello guys, I am a software engineering student in APIIT Malaysia and in less than two months I am expected to submit the final year project proposal. But I do not have any idea of what to do as my final year project. I am interested much in front-end graphical user interface design,...
5 Jan 2013 by Chiranthaka Sampath
When I am trying to insert data into a mysql database table I got the following error "Syntax error in your mysql statement near Values(". I don't know how to fix this matter. The source code is stated at the below. If you could please solve my problem!Thank You. private void...
5 Jan 2013 by Chiranthaka Sampath
The Correct MySQL statement is at below.sql = "INSERT INTO ITEMDETAILS(" + "ItemCode," + "ItemType," + "ItemSize," + "ItemName," + "ItemColour," + "InStock," +"ItemPrice)" + "VALUES(" + txtICode.getText() + ",'" + txtIType.getText() + "','" + txtISize.getText() + "','" +...
14 Jan 2014 by Christian Graus
You can't do that in one query. You CAN do it in one stored procedure, which can have as many operations in it as you like.
15 Jan 2014 by Christian Graus
Don't ask the same question twice. Edit your question."select * from old table (update tbl set col1= 2)"This is a retarded syntax. As I've told you already, write a stored procedure and do it in two steps. Or just try to execute this:update tbl set col1= 2 go select * from old...
16 Jan 2014 by Christian Graus
Ask a new question to ask a new question. This is confusing."when i delete let say "1,role1,3,tyty" will i have to reassign approvernum ,and the query when i will update the role?"Foreign keys should stop you from deleting values that are used in other tables. If not, fix your DB. ...
23 May 2013 by CPallini
Actually it isn't very difficult. It is a pretty 'typical' applicvation: Java GUI interating with SQL via JDBC drivers. As precondition you should study Java and SQL (and a bit of JDBC). Afterwards you might find many many examples of similar applications on the web.
25 Nov 2013 by CPallini
Yes, the documentation can tell tell you a lot of! I suggest you starting with a tutorial, just Google for[^].
18 Dec 2014 by DamithSL
check below similar questions and the answers:How do I get the size of a java.sql.ResultSet?[^]How to get row count using ResultSet in Java?[^]
16 Sep 2008 by daniel_at_work
Use Spring and Commons Configuration to load application properties from a database
2 Jul 2012 by DARSHAN MODANI
I havent given a shot but I think this is what the problem might be. You havnt specified Username and Password in connection string.So the connection string would be something like this:"jdbc:derby://localhost:1527/Lesson22;user=me;password=mine";
8 Jul 2015 by datta789
I want to display date calculation from oracle database on html form using jsp.I have expiry date and current date columns with date datatype in return table and want to show fine if current date is greater than expiry date using total days * 2 with date format 08-jul-15(dd-mon-yy) on html...
9 Jul 2015 by datta789
in jsp why we use arraylist to store simple javabean(not EJB) and what happens without using arraylist to use javabean in jsp during jdbc connectivity. in many source codes i have seen that javabean is stored in arraylist and then accessed in jsp.why we need to store data of database in...
1 Jan 2018 by daulmalikm
i want to work on a project based on image encryption application where i wish to use chaotic image encryption algorithm. does it will supprt all types of image formats? What I have tried: Basic guide and tutorial about encryption technique.
9 Mar 2014 by Davinder Singla
This tip is for solving out of memory issue for large result sets in MyBatis
3 Aug 2011 by DeepthiTanguturi
I am changing the value of max_allowed_packet value in my-medium.ini.But it cant updated.How can I solve this problem.
30 Dec 2012 by Devendra07
sir i want to add selected jcombo box value into ms access in perticular column??help me plzzzzzzzzi show in code error part??the other value is added in to the database but when i selected any value from combobox and try to saved it will not get saved or shown value of selected value in...
20 Apr 2019 by dhruv1707
Hello i have big data in my oracle 10g database and have to perform some calculations on every row of resultset. So i call a separate calculation class after fetching value of single row in the while(rs.next) loop. But this actually gives me multiple java.sql.SQLException: Closed Connection...
4 Feb 2015 by Dr. Song Li
This article presents an example to upload and download files with SQL server through JDBC in a Spring MVC application.
2 Jul 2012 by dsagner
Hello to all, Since I am very new to the community, I hope you will excuse my automatic question writing (can't seem to find an adequate answer). I am learning about JDBC, and ran against a wall in start. I managed to set up an example DB, called Lesson22, and added a table Employee with 3...
18 Apr 2012 by Duong Ba Hong Minh
In this article I want to give a solution to work with an Oracle database has a large number of Columns
8 Sep 2014 by erw_nda
The link above was dead, the new one is [IT] Connecting JSP with SQL Server 2008 R2 Express (JDBC).
29 Dec 2011 by Espen Harlinn
Can you connect to the server using http://www.mysql.com/products/workbench/[^]My guess is that you're having problems with a firewall.Best regardsEspen Harlinn
29 Jan 2018 by four systems
code for jdbc is , on run the error is java.sql.SQLSyntaxErrorException: Column 'ID' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a...
7 Feb 2018 by four systems
code for database records are added when the program runs, required however is the code which reads from text file and adds records on database package Rdbms; import java.sql.*; import java.io.*; class javardbms { public static void main(String args[])throws Exception{ ...
1 Feb 2018 by four systems
Code for values that are taken from user and inserted into database but gives error "java.sql.SQLException: The column position '45' is out of range. The number of columns for this ResultSet is '2'." when user enters 45 as number, the code takes that as column number which is 2 what must be...
1 Feb 2018 by four systems
Code for bulk insertion of values from file to database the error is "Syntax error: Encountered "load" at line 1, column 1. package Rdbms; import java.sql.DriverManager; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import...
13 Aug 2012 by FoxRoot
Hello everyone,I have a table "COURSES" in my JDBC database. I am adding some information via button.I created another button to view what "COURSES" include ? Could anybody show me some way ?I have created a form and put a table and a button inside it.
14 Aug 2012 by FoxRoot
Hello everyone,I am completing my project. That is last corner. But During the day(8 hours) I couldnt step a step. Please help me. I will explain clearly.I want to add instructors into my database which is an jdbc. I created database it is working there is no problem with...
24 Oct 2012 by FoxRoot
Hello everyone, I developed a java application but I need a database. So, I created table. ı couldn't use MySql so after my researches I decided to use 'JDBC'(which is under the part of Services at Netbeans). I have an ER diagram and a screenshot which represents the tables that I draw on...
30 Mar 2014 by gayan_priyankara
i Retrieve data from database and display it in tables in a jsp but i do not have an idea to how to display it on text feildseg-1. when i search a index number.2. the result (name , address, age) must come to the textfeilds which are in my jspif any one can give me a little sample...
6 Jun 2016 by George Jonsson
You could try to use AngularJS. Here is one starting point out of many:AngularJS Tutorial[^]And this one Angular JavaScript Framework: Interacting with Java Servlet Backend[^]
14 Jul 2021 by getrelax
I want to connect and access to HSQL DB from C#. I am trying to use JNI to invoke Java code in C# environment. The challenge is how to write java import statement in C# environment. What I have tried: I used the reference shown in this link...
29 Mar 2016 by Giancarlo Rhodes
ORM objects and basic CRUD operation procedures are first phase tasks that come after establishing a first version of the database. This java-based code generation tool builds those classes and stored procedures.
16 May 2013 by gryffin31
Hi,In my project I have two dropdowns in my jsp origin and destination .The first dropdown origin gets populated from databse and second one is dependent on first.Please provide the code without ajax using only jdbc and jsp . The data from database is in a resultset .The following code...
7 Aug 2017 by H.AL
I have created my first API using java httpServlet on netbeans. After days working I could finally connect it to this mySQL googleCloud database and get results locally. But once this API is published on google cloud using appengine, below error was thrown: Error...
17 Apr 2013 by H.Brydon
In java, the only way to split source code in different files is if the code exists in different classes. You can write a base class with certain behavior that is extended in a derived class (or classes).
9 Feb 2011 by hamityildirim
AddIn - AddOn programming and An Example for Outlook AddIn Regions, Views, Rules and Reports
3 Dec 2018 by Han Bo Sun
In this tutorial, I will introduce the use of Spring JdbcTemplate in a Spring Boot web application. This tutorial will show how to create the necessary configuration for JdbcTemplate. And how it can be used for data insertion and retrieval.
27 May 2012 by Harish PR
I am trying to do a mini Project.in my project i had to store the PDF,document,images in database and that i had display on a jsp page, and those file must able to download.can anyone say me how to store those files in Microsoft sql server. and how to connect the MIcrosoft SQL server...
10 Jun 2011 by hyperplus
I have a web application which only exposes web services. The web services are just a simple bridge for making stored procedure calls to the database.Currently I plan using Spring JDBC, but how do I inject the DataSource if I have no main function where instantiate it?My guess is the...
9 Apr 2018 by It is what it is
(1)first thing I would do is go into sql server config manager and enable the browser service (2)then open windows firewall and create new rule to allow UDP traffic through port 1434 see this article for more info: ...
25 Mar 2019 by James A. Brannan
In this tutorial, we secure a simple Rest API. We begin with a simple example, progress to using a custom UserDetailsService, and finish by adding method level security.
24 Jul 2014 by Jaswanth Reddy
How to perform an CRUD operations of employee details in a text file from stored procedure using oracle db by java programming....Please provide an solution.....Thanks a Ton in Advance......
20 Sep 2014 by JayantaChatterjee
Hi,I am trying to create a Database connection with MSAccess Database in JAVA. I am using JDK 8 & MSAccess 2010(.accdb).this code worked on JDK7 but the error occurred after I upgrade the JDK8.when i run my code its gives an error No suitable driver found for...
22 Jan 2010 by jazy_smith
Hi all, I have the store procedure as described below with four input fields and few output fields. I want to call this procedure from the method : dueDate(Request reqObj) { ... } I want to log the data that is there in reqObj. the input filed described in stored procedure are defined in the...
11 Nov 2012 by jhakas42
i am trying to Exceute this code:import java.sql.DatabaseMetaData;import java.sql.Connection;import java.sql.DriverManager; import java.sql.SQLException;public class ConnectionDemo{ public static void main(String args[])throws ClassNotFoundException,...
5 May 2015 by Jitendra_Jain04
IBM WebSphere Application Server V8.5 Liberty profile is a flexible and dynamic server profile of WAS which enables the WAS server to deploy only required custom features instead of deploying a big set of available JEE components.
29 Jan 2018 by Jochen Arndt
I don't know if this is the reason of the error but string parameters should be enclosed by quotes: stmt.execute("INSERT INTO " + tableName + " VALUES (" + id + ", '" + Name + "')"); Such problems can be avoided when using parameterised queries as already suggested. Another possible reason for...
8 Feb 2018 by Jochen Arndt
You already found one. Another one is Stack Overflow - Where Developers Learn, Share, & Build Careers[^]. There are also many sites for specific programming languages and frame works. So you might want to search for such instead by adding a specific language to your search query. If you are...
21 Oct 2022 by Joydeep Banerjee 2022
Create a database for a Student Result system consisting of the following two tables: Student (SID, name, ContactAddress) Results (SubjectID, SID, Marks) Develop and deploy a web based “Result Display System” using JSP, any database backend and...
13 Oct 2011 by Jörgen Andersson
It defines which character to use as command separator.On some systems the normally used character might be reserved for another purpose and therefore you're allowed to define it yourself.
27 Oct 2023 by Kanchana Gallage
I am doing implementation for this type of SELECT query in a Spring boot application using named parameter jdbc template. Database used is postgres. SELECT lp.*, gp.NAME, gp.description, FROM global_products gp...
6 Jul 2017 by KarstenK
Open a database and fetch data is expensive, so normally is a bunch of data fetched, stored in the data model and than displayed. I would fetch data set for at least two pages depending on the speed. A somehow similar example by fetching all data and storing it into the plain model array ("data").
7 Aug 2011 by Kim Togo
My guess is that you are using MySql, correct?my-medium.ini is ONLY a template on how to build up a active configuration.The active configuration is typical my.ini.And and change the value in my.ini file and restart the MySql to activate changes.
8 Feb 2012 by kirrri
connection to the database sql2005
24 May 2010 by komissar2007
hi i work with jdbc on javaand i use mysql,my question is: how can i create backup of my database?
14 Jan 2014 by Kush R
Hello,You can try committing the connection which will make sure that the data is being committed to the database.You can refer this link http://www.tutorialspoint.com/jdbc/commit-rollback.htm[^]
14 Jan 2014 by Kush R
Okay, Refer this link in detail : http://stackoverflow.com/questions/4682871/jdbc-lock-a-row-using-select-for-update-doesnt-work[^]
21 Sep 2012 by leejoyprakash
I am importing huge amount of data from CSV files into MSSQL Server 2008. I am using core JDBC (Without any ORM frameworks) and communicating with the DB using the driver 'sqljdbc4.jar' provided by Microsoft.As of now am importing the records one by one. Which takes considerable amount of...
22 May 2014 by Maciej Los
Not sure what exact problem do you have...Have a look here: ODBC Data Source Administrator[^] The Microsoft® ODBC Data Source Administrator manages database drivers and data sources. This application is located in the Windows Control Panel under Administrative Tools. Beginning in Windows...
25 Mar 2012 by Maheshsaini
I am making a online banking system in java.Can anyone suggest me to how make admin user interface(GUI)
16 Feb 2012 by mamba1988
I would be very gratefull if you could find where is my problem and how can I fix it. (java.lang.NullPointerException)here is my html from where I get a textfield and I upload 2 filesindex.html
17 Feb 2012 by mamba1988
OK, my problem is in line String idmarca = request.getParameter("rid"); it gets the text from the html textfield. Before adding this textfield I was able to save the file paths of the uploaded files
26 Sep 2011 by Marc A. Brown
You're closing the connection in pipe_calculations.pipe_parameters_costing(). Given that you're sharing a single connection between all classes (the connection in ConnectionManager is declared static), you're closing it for all objects.
17 Nov 2022 by Marc Brolly
I'm trying to get the primary auto incremented key from one table and store this in another using MySQL connector and JDBC. Although its giving me this error - 'statement.executeupdate() cannot issue statements that produce result sets.' I...
21 Nov 2022 by Marc Brolly
Each time I click on the JCombobox's arrow to show the list of exercises, it will continue to populate the combo box with duplicates entries shown in the image, made code is also inserted. I know its to know with the re-clicking of the arrow due...
21 Nov 2022 by Marc Brolly
Question was resolved by adding exerciseList.removeAllItems(); before the for loop public void popupMenuWillBecomeVisible(PopupMenuEvent e) { ArrayList nameList = new ArrayList(getComboValues()); ...
10 Aug 2011 by Marek Piechut
How to do J2EE JDBC based authentication with JPA Entities in Glassfish
24 Jan 2010 by Md. Marufuzzaman
Well nice question.... You need to use SqlParameter[] for executing this type of storedprocedure. The question is how this could be done... See the following code snippets..(i) Input / Calling the StoredProcedure:for (iCount = 0; iCount (ii) Executing the StoredProcedure:public...
21 Sep 2012 by Mehdi Gholam
If you are using SQL Server try using Bulk Insert...
14 Oct 2016 by Mehdi Gholam
Be friends with Google: GitHub - iryndin/jdbf: Java utility to read/write DBF files[^]JavaDBF Tutorial[^]GitHub - jamel/dbf: Java library for fast reading DBF-files.[^]...
8 Feb 2018 by Mehdi Gholam
Your question is too vague, hence the general answer of using Google. You can also try : Stack Overflow - Where Developers Learn, Share, & Build Careers[^]
23 May 2013 by Member 10040240
Develop a form based front end for a video rental system and inventorying database using a combination of JDBC commands, SQL, and Swing GUI components to allow users to query, insert, update and delete records using a simple graphical user interface. The basic system is composed of three linked...
10 Oct 2014 by Member 10843807
An example to illustrate how esProc Helps Process Structured Text in Java–Conditional Filtering
8 Jun 2014 by Member 10871499
I am trying to connect local db sqlserver 2012 but unable to connect. I am using the below code. Please help to solve this issue.String url = "jdbc:sqlserver://(localdb)\\v11.0;" + "databaseName=sakthi;user=sakthi;password=****;"; ...
9 Mar 2016 by Member 11408361
Im having difficulty connecting my sqlite database to my netbeans application. Once i run the code below i get the error /Users/lm/Library/Caches/NetBeans/8.1/executor-snippets/run.xml:48: Cancelled by user. BUILD FAILED (total time: 1 second)I have also imported the jar...
7 Feb 2016 by Member 12146841
Hello! Im trying to write some method, which will add a new record to date base.Code:public void insertToPlayList() { try { connecting(); stat6 = Connection.createStatement(); stat6.executeUpdate("INSERT INTO odtwarzane...