• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to connect project to database

 
Nikunj Aggarwal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am new to j2ee and i am doing netbeans E-commerce tutorial . But when i reach to "Connecting the Application to the Database" topic,i unable to connect project to database. I done all the things right but still when i am running "testDataSource.jsp" page it showing error in the browser.


exception

javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/affablebean"

root cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/affablebean"


This exception is coming. I read troubleshoot also but still no help. I want to know to add "reference resource " because in the tutorial is done differently and i am using netbeans 6.9.1
Please help me, in order to solve this problem.
 
Cesar Loachamin
Ranch Hand
Posts: 90
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nikunj.

It looks like your application server can't find the JDBC driver for you DataSource, you must read the documentation of your application server to determine the location of the libs, for example for oracle DataBase you need the ojdbc.jar that contains the necessary class to connect to oracle, and with glassfish you must put the ojdbc.jar in glassfish/domains/domain1/lib/ext so you application server can find the correct driver for you DataSource.

Or try to put your jdbc driver jar, on the lib folder of your web application, example WEB-INF/lib/ojdbc.jar

Regards

Cesar
 
Maurice Rogers
Greenhorn
Posts: 2
Firefox Browser Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you ever manage to find a solution to this problem?

I'm going through the tutorial right now and I'm experiencing the same issue.
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same error following the example. I think the problem is that Glassfish is not deploying the driver.


It doesn't appear Deploying driver in my console. I put the jar file in the same location. I also in the project's lib folder. Restarted the server but it didn't work.

Please. Someone help us.

My output:
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
Copying 1 file to /home/leandro/NetBeansProjects/AffableBean/build/web/WEB-INF/lib
library-inclusion-in-manifest:
compile:
compile-jsps:
Created dir: /home/leandro/NetBeansProjects/AffableBean/build/generated/src
Created dir: /home/leandro/NetBeansProjects/AffableBean/build/generated/classes
Compiling 1 source file to /home/leandro/NetBeansProjects/AffableBean/build/generated/classes
Starting GlassFish Server 3.x
GlassFish Server 3.x is running.
Incrementally deploying AffableBean
Completed incremental distribution of AffableBean
Incrementally redeploying AffableBean
Initializing...
run-deploy:
Browsing: http://localhost:8080/AffableBean/faces/test/testDataSource.jsp
run-display-browser:
run:
BUILD SUCCESSFUL (total time: 40 seconds)
 
Maurice Rogers
Greenhorn
Posts: 2
Firefox Browser Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the problem I was experiencing was due to a space in one of my configuration files.

Double check your xml config to make sure that the connection source is as it should be....
If you like I could probably connect to you via TeamViewer to offer some assistance.
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maurice Rogers wrote:I think the problem I was experiencing was due to a space in one of my configuration files.

Double check your xml config to make sure that the connection source is as it should be....

testDataSource.jsp


web.xml
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem SOLVED!!! YEAH! hehe

I had the AffableBeanPool in the JDBC Connections Pools, but didn't have jdbc/affablebean in JDBC Resources.
Glassfish Admin Console -> JDBC -> JDBC Resources -> New
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic