Hi Guy, I am using a JDBC connection to retrieve data and populate datasets. Having some problems with errors:
Error: java.sql.SQLExc eption: [Microsoft][ODBC Driver Manager] Invalid cursor state -
// now we can get the connection from the DriverManager
-
Connection con = DriverManager.getConnection(database ,"","");
-
-
//String searchPatients = G.PatientSearch.getText();
-
-
// We are connected, so lets create a statement to ask for names from our table "names"
-
Statement s = con.createStatement();
-
Statement s2 = con.createStatement();
-
-
-
s.execute("select Username from Usernames");
-
s2.execute("select Password from Usernames");
-
-
// Execute and get the results
-
-
//rs2 is to get the Ward of the patient
-
ResultSet rs = s.getResultSet();// Patient Name Verification
-
ResultSet rs2 = s2.getResultSet(); // Ward name
-
-
if (rs != null) {
-
// If we had results, loop through them...
-
while ( rs.next() )
-
{
-
-
-
-
// resultset1 = rs.getString(1);
-
String RS2,strUsername, strPassword;
-
-
RS1 = rs.getString("Username" );
-
RS2 = rs2.getString("Password" );
-
strUsername = txtUsername.getText();
-
strPassword = txtPassword.getText();
-
-
//SearchString = txtSearch.getText();
-
int rowNum;
-
int rowFind;
-
-
-
-
-
// Just prints out the values
-
if(RS1.equals(strUsername))// Filters by Name
-
{
-
//First check that the name is on the list
-
System.out.println(strUsername);// rints the name
-
-
// int rowrs1 = rs.getRow();// Get the row number of the successful entry
-
-
// the next part gets the Ward of the patient
-
// all depending on the row number of the first condition set
-
// with rs - the first result set.
-
// I got the row number of the set then
-
// when rs2 cycles through the database, if its row number
-
// is equal to the row number of the first rs - row number successful search
-
// it will print the details, eg ward and later on the room number
-
-
// int rowrs3 = rs3.getRow();// gets the row number of the 3rd result set
-
// while ( rs2.next() )
-
-
// {
-
// System.out.println("success");
-
-
// }// end of rs3 While statement
-
} //end of if on result set1 Name Filter
-
-
-
-
-
}
-
}
-
-
// Cleanup our statement and connection by closing them.
-
s.close();
-
con.close();
-
}
-
-
// If there was an error connection or querying, show the error.
-
catch (Exception e) {
-
System.out.println("Error: " + e);
-
}
-
-
-
-
-
-
return null;
-
-
}
-
Maybe there is something I am missing. any help would be greatly appreciated.
2 2343 JosAH 11,448
Recognized Expert MVP
Make your code print out the complete stack trace; it contains line numbers and all; in your catch clause do this:
... so you can see where exactly that exception was thrown.
kind regards,
Jos
Thanks Jos,
I'll implement that right away :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Nils Valentin |
last post by:
Hi MySQL Fans ;-),
Is it possible that the 3.08 series allows to connect to 4.0.14 versions but
not to the 4.1 alpha-versions ?
I get belows error when tryig to connect from DbVisualizer which was working
fine until a while ago. I haven't watched it recently, and haven't changed
anything I am aware off right now. After I realized the problem I tried many
3.08 versions with the same symptom. Watch were it says "Unknown system
variable...
|
by: Steve |
last post by:
Hi;
I went to the microsoft site to try to find a guide to the error
messages that the jdbc drivers give ( for sqlserver 2000 ).
I had no luck.
Does anyone know if there is such a guide?
I got this mysterious error message below in my logs ( nothing visible
|
by: global |
last post by:
Hi, can anyone help me
I'm on Linux with UDB Runtime-Client 8.1.4 and try to connect to
a windows udb-server 8.1.4 via Websphere and jdbc , and get this
error:
3e1a29e5 WebGroup E SRVE0026E:
-: java.lang.UnsatisfiedLinkError:
SQLConnect
at COM.ibm.db2.jdbc.app.DB2Connection.connect(DB2Connection.java:514)
at COM.ibm.db2.jdbc.app.DB2Connection.<init>(DB2Connection.java:436)
|
by: Bing |
last post by:
Hi,
I am configuring the same DB2 v8.1 JDBC universal driver (db2jcc.jar
and db2jcc_license_cisuz.jar) from DB2 SP5 fix pack under WSAD 5.1.x
environment and WebSphere application Server 5.0.2 on Windows 2000
machines. I configured a connection pool data source using type 4 for
a local test environment in WSAD 5.1.x, and a connection pool data
source on the WebSphere Server too. Both data sources are accessing
the same database.
|
by: John |
last post by:
Hi All
I'm new to set up DB2 though using JDBC for years.
my question is:
supposed there are 3 computers in local-net, named A,B,C (they are Windows
2000 families). DB2 installed in A (port is db2c_DB2 50000/tcp) which hosts
a web, named www.abc.com, using dynamic ip, like 1.2.3.4 for a week them
2.3.4.5 for another week
when using JDBC within local-net by using,
| |
by: deegs_ca |
last post by:
Here is my jdbc info
url = jdbc:db2://LXPP04913:60000/TEST
driver = COM.ibm.db2.jdbc.net.DB2Driver
For some reason as I'm importing data via a jdbc client Db2 gets
through a few rows and then crashes. Subsequent connections receive
the
Caused by: COM.ibm.db2.jdbc.DB2Exception:
|
by: Praveen |
last post by:
Hi,
I have installed WebSphere Portal on AIX and connected to DB2 on a
remote machine, Getting the followin errors when trying to get the
values from database thru applications installed on Portal.
Any Help Appreciated.
Thanks in advance.
Praveen Singh
|
by: Albretch |
last post by:
.. I am trying to create a database in a MS Access DB via JDBC drivers.
I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver
From some reason both drivers Exceptions tell me 'Syntax error in
CREATE TABLE statement' even though I am not creating a table, but a
Database
// - - - - - - - - - - - - sun.jdbc.odbc.JdbcOdbc
aSQL=CREATE DATABASE dbtest;
java.sql.SQLException:
|
by: Anoop |
last post by:
Is it true that there are no type 4 jdbc drivers to connect to a DB2
server v7.1? The DB2 server is hosted on ACF2 (OS/390). We would be
connecting from windows and solaris boxes.
If it is true, what are my options? Will I have to install db2 connect
on every client machine that needs to connect to the DB2 servers? Is
the DB2 Connect freely available or will we have to purchase it? I
have also read on this group that we can install DB2...
|
by: neuraljay |
last post by:
hi everyone. I am trying to build a jsp using webwork, hibernate and mysql. And right now I am doing its unit testing. Everytime I run the test I am getting this error:
Error JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |