| | |
Plz solve the error
Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Aug 2008
Posts: 16
Reputation:
Solved Threads: 0
java Syntax (Toggle Plain Text)
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Programs; import java.util.ArrayList; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; import javax.ws.rs.Consumes; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.GET; import javax.ws.rs.Produces; import java.util.List; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; /** * REST Web Service * * @author Dhanya_Kurup */ @Path("ProgramList") public class ProgramListResource { @Context private UriInfo context; private Logger logger = Logger.getLogger(this.getClass().getName()); /** Creates a new instance of ProgramListResource */ public ProgramListResource() { } /** * Retrieves representation of an instance of Programs.ProgramListResource * @return an instance of java.lang.String */ @GET @Produces("application/xml") public ProgramDetailsList getXml() { //TODO return proper representation object //throw new UnsupportedOperationException(); //String Strqry; Connection connection = null ; String connectionURL = "jdbc:mysql://localhost:3306/test"; ProgramDetailsList Details = new ProgramDetailsList(); try { ResultSet programResults = null; Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = (Connection) DriverManager.getConnection(connectionURL, "root", "bharani"); logger.log(Level.INFO, "conncetion: " + connection); Statement stmt = connection.createStatement(); stmt.setQueryTimeout(120); programResults = stmt.executeQuery("select * from programlist"); //programResults=Strqry; System.out.println("hii"); List<String> programName=new ArrayList<String>(); //programName=null; List<String> duration=new ArrayList<String>(); List<String> days=new ArrayList<String>(); List<String> programType=new ArrayList<String>(); List<String> description=new ArrayList<String>(); while(programResults.next()) { programName.add(programResults.getString("ProgramName")); duration.add(programResults.getString("Duration")); days.add(programResults.getString("Days")); programType.add(programResults.getString("ProgramType")); description.add(programResults.getString("Description")); } int length=programName.size(); List<ProgramDetails> program_list=new ArrayList<ProgramDetails>(); for(int k=0;k<length;k++) { ProgramDetails program = new ProgramDetails(); program.ProgramName=programName.get(k); program.Duration=duration.get(k); program.Days=days.get(k); program.ProgramType=programType.get(k); program.Description=description.get(k); program_list.add(program); } Details.programDetailsList=program_list; stmt.close(); programResults.close(); } catch (Exception ex) { Logger.getLogger(ProgramListResource.class.getName()).log(Level.SEVERE, null, ex); } finally { try { connection.close(); } catch (SQLException ex) { Logger.getLogger(ProgramListResource.class.getName()).log(Level.SEVERE, null, ex); } } return Details; } /** * PUT method for updating or creating an instance of ProgramListResource * @param content representation for the resource * @return an HTTP response with content of the updated or created resource. */ @PUT @Consumes("application/xml") public void putXml(String content) { } }
this is the code that i have written....
bt its not executing
Please help...
Last edited by Ezzaral; Oct 16th, 2009 at 1:32 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
-1
#2 Oct 17th, 2009
Problem description is missing, how we are supposed to know what sort of errors you getting. Plus there is no chance to second-guess what you trying to achieve...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Aug 2008
Posts: 16
Reputation:
Solved Threads: 0
0
#3 Oct 19th, 2009
Sorry for that....
I have written the cod ein net beans....here am trying to connect to MYsql database and retrieve data from there...........
The errors that iam receiving are
com.mysql.jdbc.JDBC4Connection@c58418
Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@12a74c7, cause: org/apache/log4j/LogManager
I have written the cod ein net beans....here am trying to connect to MYsql database and retrieve data from there...........
The errors that iam receiving are
com.mysql.jdbc.JDBC4Connection@c58418
Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@12a74c7, cause: org/apache/log4j/LogManager
-1
#5 Oct 20th, 2009
•
•
•
•
Sorry for that....
I have written the cod ein net beans....here am trying to connect to MYsql database and retrieve data from there...........
The errors that iam receiving are
com.mysql.jdbc.JDBC4Connection@c58418
Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@12a74c7, cause: org/apache/log4j/LogManager
java Syntax (Toggle Plain Text)
import org.jboss.logging.Logger;
EDIT:
You actually tried but did it wrong
import java.util.logging.Logger; Full error description as given by compiler plus relevant coding need to see what is going on. You should know this... Last edited by peter_budo; Oct 20th, 2009 at 7:56 am. Reason: EDIT
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Aug 2008
Posts: 16
Reputation:
Solved Threads: 0
0
#6 Oct 22nd, 2009
•
•
•
•
You did not imported Logger into your code as other packages
Full JBoss documentation on topic herejava Syntax (Toggle Plain Text)
import org.jboss.logging.Logger;
EDIT:
You actually tried but did it wrong
import java.util.logging.Logger;
Full error description as given by compiler plus relevant coding need to see what is going on. You should know this...
Thanks a lot for spotting my error
-1
#7 Oct 22nd, 2009
So is this solved now or there is something else you want to ask?
If it is solved, please mark it as solved by clicking on "Mark as Solved" bellow last post.
If it is solved, please mark it as solved by clicking on "Mark as Solved" bellow last post.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- plz solve this (C++)
- solve this error plz (Kernels and Modules)
- MEnu Item Disable (VB.NET)
- Error...plz help me solve it (VB.NET)
- plz any one help me to solve this problem in c++ (C++)
- friend plz help me to solve this problem (C++)
- plz help to solve this prob (ASP.NET)
- MERGED: Deleting duplicates in an array (plz help me out!!!!!!!) (C)
Other Threads in the RSS, Web Services and SOAP Forum
| Thread Tools | Search this Thread |
.htaccess 301 accept access alltop api authentication binarysecuritytoken blog card collaboration credit data development ebay email evernote flash google government highrise htaccess intel internet legal live netbeans patent paypal php podcast proxy redirect rss rssfeeds searchmonkey server service soap software swappingxmlfromflash swappingxmlnodes url web webservices webservicesecurity wiki wikipedia xerces xml xslt y!os yahoo ydn






