how java interact with the Excplicit Cursor?

G

Garg

Hi All,

I am facing a small and i am not able to find the direction in which i
should move.

I am using IntraSystem Cache as a DataBase and declaired Explicit
cursor there.
I tried with the simple database connection as followes

String url = "jdbc:Cache://127.0.0.1:" + port + "/User/
log.txt";
String user = "_SYSTEM";
String password = "SYS";
String stQueryP = "{call ABC.XYZ_ByPQR}";

Class.forName ("com.intersys.jdbc.CacheDriver");
Connection dbconnection =
DriverManager.getConnection(url,user,password);
CallableStatement cstmt =
dbconnection.prepareCall(stQueryP);
int j = 0;
while (rs.next())
{
System.out.print(j);
System.out.println(" " + rs.getString(1) + " " +
rs.getString(2));
j++;
}

I am getting unlimited records and all are null only.

Can anyone please suggest me how should i move forward.

Should i need to declare cursor in java also.

Thanks
Tarun Garg
 
J

Joshua Cranmer

Garg said:
Hi All,

I am facing a small and i am not able to find the direction in which i
should move.

I am using IntraSystem Cache as a DataBase and declaired Explicit
cursor there.
I tried with the simple database connection as followes

String url = "jdbc:Cache://127.0.0.1:" + port + "/User/
log.txt";
String user = "_SYSTEM";
String password = "SYS";
String stQueryP = "{call ABC.XYZ_ByPQR}";

Class.forName ("com.intersys.jdbc.CacheDriver");
Connection dbconnection =
DriverManager.getConnection(url,user,password);
CallableStatement cstmt =
dbconnection.prepareCall(stQueryP);
int j = 0;
while (rs.next())
{
System.out.print(j);
System.out.println(" " + rs.getString(1) + " " +
rs.getString(2));
j++;
}

I am getting unlimited records and all are null only.

Can anyone please suggest me how should i move forward.

Should i need to declare cursor in java also.

Thanks
Tarun Garg

While I cannot answer your database question, I can answer your question
at the end: look around java.awt.Cursor to handle cursors.

As another note, *please* try to follow basic punctuation,
capitalization, spelling, and grammar. It makes answering questions easier.
 
D

Daniel Pitts

While I cannot answer your database question, I can answer your question
at the end: look around java.awt.Cursor to handle cursors.

As another note, *please* try to follow basic punctuation,
capitalization, spelling, and grammar. It makes answering questions easier.

Somehow I doubt that the concept of a Database Cursor and an Abstract
Windowing Toolkit Cursor are at all similar.
 
I

Ian Wilson

Garg said:
so their is not way to get this thing done.

tarun

I wouldn't draw that conclusion from what Daniel wrote!

You might get better help if you

1) Quote (the relevant parts of) what you are replying to.

2) Provide a complete compilable and runnable example program.

3) Explain String stQueryP = "{call ABC.XYZ_ByPQR}";
what exactly does "ABC.XYZ_ByPQR" do?

4) Explain why you haven't assigned rs
(e.g. ResultSet rs = cstmt.executeQuery();)
prior to using rs.next().
 
G

Garg

3) Explain String stQueryP = "{call ABC.XYZ_ByPQR}";
what exactly does "ABC.XYZ_ByPQR" do?

ABC.XYZ_ByPQR is a stored procedure in Cache DataBase(interSystems).
In this stored procedure i had declared the explicit cursor. But I am
not geting any record in the result set.
4) Explain why you haven't assigned rs
(e.g. ResultSet rs = cstmt.executeQuery();)
prior to using rs.next().

It's my fault i forget to paste that line.

String url = "jdbc:Cache://127.0.0.1:" + port + "/User/
log.txt";
String user = "_SYSTEM";
String password = "SYS";
String stQueryP = "{call ABC.XYZ_ByPQR}";

Class.forName ("com.intersys.jdbc.CacheDriver");
Connection dbconnection =
DriverManager.getConnection(url,user,password);
CallableStatement cstmt =
dbconnection.prepareCall(stQueryP);
cstmt.execute();
ResultSet rs = cstmt.getResultSet();
int j = 0;
while (rs.next())
{
System.out.print(j);
System.out.println(" " + rs.getString(1) + " " +
rs.getString(2));
j++;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top