Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

Rajesh Kumar77

Greenhorn
+ Follow
since Sep 04, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rajesh Kumar77

Thankyou Very Much
I will implement this and get back to u
Thankyou once again
Respected Sir,
Thankyou for reply
I implemented the result set as scrollable result like as follows
st = myConusm1.con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
actually it has to show 6 records per page
but, Some times it is showing only 5 records in the first page when we came back to first page
and some times it is showing 6 records in first page when we came back to the first page from the end of record
I used jdbc odbc driver and jturbo driver
i am using jdk 1.3 in windows 2000 server with sql server 2000
pl give me solution
yours
Raj

[This message has been edited by Rajesh Kumar77 (edited September 06, 2001).]
to use rs.previous() method
you need to have jdk 1.3 in your system
pl check the following code in your system after giving jdbc connections
import java.sql.*;
public class MyConnection
{
Connection con;
MyConnection()
{
try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc dbc:dsnaccess","","");
}
catch(Exception e)
{
System.out.println(" in myconnection.java file " +e);
}
}
}

*********************************************
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class UserSearchMod extends Frame implements ActionListener
{
Label userIDLbl,userNameLbl;
TextField userIDTxt,userNameTxt;
Label lbUser[][];
Checkbox chUser[];
Button searchUser;
ScrollPane spUser;
Panel userPanel,recUserPanel[];
Button previous,next,reset,exit;
MyConnection myCon;
Statement st,st1,st2;
ResultSet rs,rs2;
int i;
boolean nextP,prev,ent;

UserSearchMod()
{
setLayout(null);
myCon = new MyConnection();

try
{
st = myCon.con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
st1 = myCon.con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
st2 = myCon.con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
}
catch(Exception e)
{
System.out.println("defining connection objects "+e);
}
userIDLbl = new Label("User ID");
userNameLbl = new Label("User Name");
userIDTxt = new TextField(15);
userNameTxt = new TextField(15);
searchUser = new Button("Search");
previous=new Button("Previous");
next=new Button("Next");
reset=new Button("Reset");
exit = new Button("Exit");
spUser = new ScrollPane();
userPanel = new Panel();
add(userIDLbl);
add(userIDTxt);
add(userNameLbl);
add(userNameTxt);
add(searchUser);
add(spUser);
spUser.add(userPanel);
add(previous);
add(next);
add(reset);
add(exit);
searchUser.addActionListener(this);
previous.addActionListener(this);
next.addActionListener(this);
reset.addActionListener(this);
exit.addActionListener(this);
userIDLbl.setBounds(150,30,50,25);
userIDTxt.setBounds(210,30,100,25);
userNameLbl.setBounds(335,30,65,25);
userNameTxt.setBounds(410,30,100,25);
searchUser.setBounds(550,30,75,25);
spUser.setBounds(50,60,500,200);
previous.setBounds(150,400,75,25);
next.setBounds(250,400,75,25);
reset.setBounds(350,400,75,25);
exit.setBounds(450,400,75,25);
/* previous.setBounds(150,530,75,25);
next.setBounds(250,530,75,25);
reset.setBounds(350,530,75,25);
exit.setBounds(450,530,75,25); */

setSize(600,450);
setLocation(0,0);
show();
}
public void nextRecords()
{
nextP=true;
userPanel.removeAll();
lbUser = new Label[6][5];
userPanel.setLayout(new GridLayout(6,1));
recUserPanel=new Panel[6];
System.out.println("Hello sop from next() before try ");
try
{
System.out.println("Hello sop 1 "+rs.getRow());
while(prev&&i<6)
{
rs.next();
i++;
}
i=0;
System.out.println("Hello sop 2 "+rs.getRow());
if(!rs.isFirst()&&prev)
{
rs.previous();
prev=false;
}
System.out.println("Hello sop 3 "+rs.getRow());
if(ent)
{
do
{
if(rs.isLast())
{
next.setEnabled(false);
}
recUserPanel[i] = new Panel();
recUserPanel[i].setLayout(new GridLayout(1,5));
System.out.println("Hello sop 4 "+rs.getRow());
for(int j=0;j<5;j++)
{
lbUser[i][j] = new Label(rs.getString(j+1));
lbUser[i][j].setSize(75,25);
recUserPanel[i].add(lbUser[i][j]);
}
userPanel.add(recUserPanel[i]);
i++;
}
while( i<6 && rs.next() );
System.out.println("Hello sop 5 "+rs.getRow());
}
else
{
while( i<6 && rs.next() )
{
if(rs.isLast())
{
next.setEnabled(false);
}
recUserPanel[i] = new Panel();
recUserPanel[i].setLayout(new GridLayout(1,5));

for(int j=0;j<5;j++)
{
lbUser[i][j] = new Label(rs.getString(j+1));
lbUser[i][j].setSize(75,25);
recUserPanel[i].add(lbUser[i][j]);
}
userPanel.add(recUserPanel[i]);
i++;
}
}
System.out.println("Hello sop 6 "+rs.getRow());
}
catch(Exception e)
{
System.out.println("Exception in next records () "+e);
}
}
public void prevRecords()
{
prev=true;
ent=true;
System.out.println("Previous..");
userPanel.removeAll();
lbUser = new Label[6][5];
userPanel.setLayout(new GridLayout(6,1));
recUserPanel=new Panel[6];
try
{
while(i>0)
{
rs.previous();
i--;
}
i=5;
while(i>=0 && rs.previous())
{
System.out.println(i);
if(rs.isFirst())
{
previous.setEnabled(false);
}
recUserPanel[i] = new Panel();
recUserPanel[i].setLayout(new GridLayout(1,5));

for(int j=0;j<5;j++)
{
lbUser[i][j] = new Label(rs.getString(j+1));
lbUser[i][j].setSize(75,25);
recUserPanel[i].add(lbUser[i][j]);
}
userPanel.add(recUserPanel[i]);
i--;
}
}
catch(Exception e)
{
System.out.println(e);
}
}
public void actionPerformed(ActionEvent ae)
{
String sqlString=null;
if(ae.getSource()==searchUser)
{
show();
next.setEnabled(true);
previous.setEnabled(false);
if(!(userIDTxt.getText().equals("") && userNameTxt.getText().equals("")))
{
sqlString = "select * from users where userid like '" + userIDTxt.getText() + "%' and name like '" + userNameTxt.getText() + "%'";
}
if(!(userIDTxt.getText().equals("")) && userNameTxt.getText().equals(""))
{
sqlString = "select * from users where userid like '" + userIDTxt.getText() + "%'";
}
if(userIDTxt.getText().equals("") && !(userNameTxt.getText().equals("")))
{
sqlString = "select * from users where name like '" + userNameTxt.getText() + "%'";
}
if(userIDTxt.getText().equals("") && userNameTxt.getText().equals(""))
{
sqlString = "select * from users";
}

show();
try
{
if(nextP)
{
rs.close();
nextP=false;
}
rs = st.executeQuery(sqlString);
nextP=true;
nextRecords();
}
catch(Exception e)
{
System.out.println(e);
}
System.out.println(sqlString);
show();
}
if(ae.getSource()==next)
{
previous.setEnabled(true);
nextRecords();
show();
}

if(ae.getSource()==previous)
{
next.setEnabled(true);
prevRecords();
show();
}

if(ae.getSource()==reset)
{
userPanel.removeAll();
userIDTxt.setText("");
userNameTxt.setText("");
}
if(ae.getSource()==exit)
{
System.exit(0);
}
}
public static void main(String args[])
{
new UserSearchMod();
}
}
******+
just try this program
and give me feed back
i am facing the pblm with sql server in the same situation even if i use jdk 1.3
help me
bye

hi
i want to make use of t d s driver for sql server 2000
but i am not able to create login and password in database
the server is also installe in same machine
server name is kumar and port no is 1433
String url="jdbc:inetdae7:kumar:1433";
String login="sagar";
String password="sagar";
Class.forName("com.inet.tds.TdsDriver").newInstance();
con=DriverManager.getConnection(url,login,password);
i am facing pblm while creating login in sql server
pl help me
Hi
How to create a new login in ms sql server 2000
i am not able to create using enterprise manager
thatswhy i am not able to pass the user and password arguments like in following way
String user="sa";
String password="secret";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc dbc:sqldsn",user,password);

pl help me how to create a new login in sql server
server is installed in the same machine
waiting for your replies
thankyou very much
yours
raj
Hi
I am developing awt database application using jdbc
pl give me help
i need a small sample program which uses rs.previous method to fetch the records from datbase in awt window
i am using sql server 2000
thankyou very much
bye
20 years ago
http://www.inetsoftware.de/English/produkte/JDBC2/Default.htm

check this site...u will get type 4 driver

give me feed back
and i will tell u how to use in programs
Respected Sir,
I am developing a awt with database application.
in that application i am using a screen which will fetch the records from database
i implemented rs.next() method to go for next page
but i am not able to implement rs.previous() method to come back from last page.
please help me in any of the way
i am using sql server 2000 database jdk 1.3 version
waithng for your replies
Thankyou Very Much
Yours
Raj
please contact jwalar@yahoo.com or ycs26@yahoo.com or rkanumala@yahoo.co.in or gakella@yahoo.com
give a mail to them
they will responed to your queries
Thankyou very much
yours
raj
Respected Sir,
Recently I installed ms sql server 2000 in windows 2000 server plat form.
server is in my system only.
i am able to enter to sqlserver with query analizer by using windows authentication
but when i am trying to create a new login to enter with sql server authorization ......it is not accepting.
i tried to create a new login in enterprise manager in sql server
it was created .
but query analizer is not acception that login and password
query analyzer is accepting only windows nt authorization.
pl help me
please help me how to create a new login in query analizer
Thankyou Very Much
Yours
Raj
Hai
When we use oracle...the default type 4 driver is thin driver
But now i am using sql server 2000. pl tell me what is the default type-4 driver for ms sql server 2000
Thankyou Verymuch,
Yours
Raj
Hai,
I am facing a lot of problems with sql server 2000 odbc drivers.
and the database
when i try a awt database application in ms access it is working perceftly
but is it not working in using sql server 2000 database
and some times i am getting the exception with sql server
java.sql.SQLException : [Microsoft] [ODBC SQL Server Driver] Connection is busy with results for another hstmt.

pl give me some solution to my problem
i am facing pblm from past 2 weeks
pl give me replies
Thankyou
Yours
Raj