Results 1 to 2 of 2
- 02-01-2008, 01:12 PM #1
Member
- Join Date
- Feb 2008
- Posts
- 1
- Rep Power
- 0
Plz help ... retreiving data from an access database table....
i think there is some problem with the execute query statement.......
plz help...
import java.sql.*;
import java.io.*;
public class new2
{
public static void main(String args[])
{
if(args.length!=1)
{
System.out.println("syntax:give filename");
return;
}
java.sql.Connection conn = null;
try
{
conn=AccessJDBCUtil.getAccessDBConnection(args[0]);
Statement stmt = conn.createStatement();
ResultSet rs=null;
//stmt.execute(args[1]);
rs=stmt.executeQuery("select name2 from table1 where name1=derik");
//outputResultSet(rs);
stmt.close();
}
catch(SQLException s)
{
System.out.println(s);
}
finally
{
if(conn != null)
{
try
{
conn.close();
}
catch(SQLException ignore) {}
}
}
}
/*private static void outputResultSet(ResultSet rs) throws SQLException
{
ResultSetMetaData rsMetaData=rs.getMetaData();
int numberofcolumns=rsMetaData.getColumnCount();
while(rs.next())
{
for(int i=1; i<(numberofcolumns+1); i++)
System.out.print(rs.getString(i) + " ");
System.out.println();
}
rs.close();
}*/
}
- 02-01-2008, 01:21 PM #2
Similar Threads
-
Upload excel data to access database
By ravikumar.achi in forum New To JavaReplies: 20Last Post: 01-19-2012, 11:30 AM -
Problem with jTable that is binded with a table in MySQL Database
By rajkenneth in forum NetBeansReplies: 0Last Post: 03-29-2008, 03:36 PM -
Deleting records from database table using PreparedStatement
By Java Tip in forum Java TipReplies: 0Last Post: 02-09-2008, 08:31 PM -
Modifying data in database table using PreparedStatement
By Java Tip in forum Java TipReplies: 0Last Post: 02-09-2008, 08:22 PM -
Help with access a database using Microsoft Access
By cachi in forum JDBCReplies: 1Last Post: 08-07-2007, 07:51 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks