my librarybean
i dont know how to write where clause with a variable passed eg author
should it be -
resultset = statement.executeQuery("SELECT * " +
-
"from books WHERE author = "+author+" ORDER BY name");
-
or -
resultset = statement.executeQuery("SELECT * " +
-
"from books WHERE author = :author ORDER BY name");
because my app doesnt display records after a search
i checked jdbc with mysql first and it worked
do i need to set up a new connection pool in jdbc?
5 2007
when i run it from bat i get
D:\JAVA_P~1\ZAD5_K~1\JAVACL~1>runClient.bat
D:\JAVA_P~1\ZAD5_K~1\JAVACL~1>java -cp .;C:SunSDKbin/lib/appserv-rt.jar;C:SunSDK
bin/lib/javaee.jar; library.client.LibraryClient JAVA_CLIENT
javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(N amingManager.java:6
45)
at javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:288
)
at javax.naming.InitialContext.getURLOrDefaultInitCtx (InitialContext.jav
a:325)
at javax.naming.InitialContext.lookup(InitialContext. java:392)
at library.client.LibraryClient.init(LibraryClient.ja va)
at library.client.LibraryClient.<init>(LibraryClient. java)
at library.client.LibraryClient.main(LibraryClient.ja va)
java.lang.NullPointerException
at library.client.LibraryClient.actionPerformed(Libra ryClient.java)
at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:19
95)
at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.jav
a:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel
.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:242
)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonL
istener.java:236)
at java.awt.Component.processMouseEvent(Component.jav a:6038)
at javax.swing.JComponent.processMouseEvent(JComponen t.java:3260)
at java.awt.Component.processEvent(Component.java:580 3)
at java.awt.Container.processEvent(Container.java:205 8)
at java.awt.Component.dispatchEventImpl(Component.jav a:4410)
at java.awt.Container.dispatchEventImpl(Container.jav a:2116)
at java.awt.Component.dispatchEvent(Component.java:42 40)
at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4322
)
at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3916)
at java.awt.Container.dispatchEventImpl(Container.jav a:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429 )
at java.awt.Component.dispatchEvent(Component.java:42 40)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 599)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThre
ad.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.
java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThre
ad.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:121)
D:\JAVA_P~1\ZAD5_K~1\JAVACL~1>
when i run it from bat i get
D:\JAVA_P~1\ZAD5_K~1\JAVACL~1>runClient.bat
D:\JAVA_P~1\ZAD5_K~1\JAVACL~1>java -cp .;C:SunSDKbin/lib/appserv-rt.jar;C:SunSDK
bin/lib/javaee.jar; library.client.LibraryClient JAVA_CLIENT
javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(N amingManager.java:6
45)
at javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:288
)
at javax.naming.InitialContext.getURLOrDefaultInitCtx (InitialContext.jav
a:325)
at javax.naming.InitialContext.lookup(InitialContext. java:392)
at library.client.LibraryClient.init(LibraryClient.ja va)
at library.client.LibraryClient.<init>(LibraryClient. java)
at library.client.LibraryClient.main(LibraryClient.ja va)
java.lang.NullPointerException
at library.client.LibraryClient.actionPerformed(Libra ryClient.java)
at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:19
95)
at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.jav
a:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel
.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:242
)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonL
istener.java:236)
at java.awt.Component.processMouseEvent(Component.jav a:6038)
at javax.swing.JComponent.processMouseEvent(JComponen t.java:3260)
at java.awt.Component.processEvent(Component.java:580 3)
at java.awt.Container.processEvent(Container.java:205 8)
at java.awt.Component.dispatchEventImpl(Component.jav a:4410)
at java.awt.Container.dispatchEventImpl(Container.jav a:2116)
at java.awt.Component.dispatchEvent(Component.java:42 40)
at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4322
)
at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3916)
at java.awt.Container.dispatchEventImpl(Container.jav a:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429 )
at java.awt.Component.dispatchEvent(Component.java:42 40)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 599)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThre
ad.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.
java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThre
ad.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:121)
D:\JAVA_P~1\ZAD5_K~1\JAVACL~1>
But the exception you are getting is for something else.
It says NoInitialContextException meaning your beans are never found anyway.
so what am i doing wrong?
so what am i doing wrong?
The LibrayClient class is the one throwing the exception. Check how you got your context in it
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ron |
last post by:
this code is giving me an excption and I cannot tell why could someone who
is familiar with jdbc help me out, I am using mysql with jdbc, although the
exception does not look like it is getting far...
|
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...
|
by: sridhar nagabhurshana |
last post by:
hello
I am trying to connect to mysql database using connector/J jdbc driver
this is my code
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
|
by: Robert Mazur |
last post by:
MySQL 5.0 alpha (binary install) on
Solaris 9 -or- RedHat 8.0
mysql-connector-java-3.0.8-stable
-----------------------
Is there something different going on with JDBC and the alpha version...
|
by: ak1dnar |
last post by:
I have downloaded and copied the this Connector/j to lib directory of my java installation dir.
and this Jsp page is working with that.
<%@ page language="java" import="java.sql.*" %>
<%...
|
by: delram |
last post by:
Hello All!
I've been struggling with this problem for a while.
I have a database from which I need to read and display some data on a browser. (The database is set up for remote access).
...
|
by: bevis |
last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you...
|
by: IvanJ2EE |
last post by:
Hello partners.
I have an issue using jdbc and a DB in MySQL.
The problem is that I want to make a seach using the Last Name of a person stored in a MySQL DB, from a JSP
The problem is that I...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |