File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes ERROR: java.sql.SQLException: No data found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "ERROR: java.sql.SQLException: No data found" Watch "ERROR: java.sql.SQLException: No data found" New topic

ERROR: java.sql.SQLException: No data found

rakshini nithya
Ranch Hand

Joined: Jun 15, 2006
Posts: 39
am trying to create a table in ms-access

but am getting this error while running the code

i have created the datasource name (userloginTable)
and created a driver (microsoft access driver(*.mdb))

can You please help me in this problem
Here is my code

* Created on Jul 10, 2006
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
package com.cts.dbconn;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

* @author 133474
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
public class DBconn {
public static void main(String args[])

try {
String dataSourceName ="userlogintable";
String dbURL = "jdbcdbc:" + dataSourceName;
Connection con = DriverManager.getConnection(dbURL, "","");
Statement s = con.createStatement();
s.execute("create table TEST(username integer,password char[6])");
s.execute("insert into TEST values(133484,'abc')");
s.execute("insert into TEST values(133474,'def')");
s.execute("insert into TEST values(133484,'ghi')");
s.execute("select username,password from TEST");
ResultSet rs = s.getResultSet();
if (rs != null)

while ( )
System.out.println("Data from username: " + rs.getString(1) );
System.out.println("Data from password: " + rs.getString(2) );
catch (Exception err) {
System.out.println("ERROR: " + err);


Ash Kondhalkar
Ranch Hand

Joined: Jun 14, 2006
Posts: 43
I think the create statement needs to be changed to as below,

"create table TEST(username integer,password text)"

and it will work. (text to be substitued in place of char[6])...

I agree. Here's the link:
subject: ERROR: java.sql.SQLException: No data found
It's not a secret anymore!