I am trying to create a simple web application in J2EE.
I am getting the following error:
exception:
javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get
connection,
DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/qweDS"
root cause:
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid:
"java.sql.SQLException: No suitable driver found for jdbc/qweDS"
added thee resource, created the connection pool, checked the connection.. enabled the driver.. checked web.xml file and glassfish-resources.xml
Any idea what am I doing wrong. or where to set the driver.
You need to download a suitable JDBC driver depending on your database, then right-click on the project on Netbeans and click Add Library. After that choose the JDBC.jar file you downloaded and try again.
You have notincluded driver jar file. According to your database you have to include driver jar file like in Mysql you have to include mysql-connector-java-(version).jar
You can download from internet
Related
I have created a heroku posgresql database and I am trying to connect my Android app to this database. I am using Android Studio for making the Android app. I have used the following code for creating the connection:
try {
Class.forName("org.postgresql.Driver");
Connection db = DriverManager.getConnection(dbUrl);
}
catch(Exception e){
//handles exception
}
When I execute this code I get the following error: Something unusual has occurred tot cause the driver to fail. Please report this exception.
This is the driver I use: posgresql-42.2.12
The heroku database has version 12.2
Android studio has java version 1.8
I am not sure if the driver is in the classpath and I am not sure how to check this. I added the driver to the project this way: app > New > Module > Import .JAR/.AAR Package (here I selected the driver).
To check if the Driver is registered in DriverManager I used this code:
Enumeration<Driver> drivers = DriverManager.getDrivers();
drivers.nextElement().getClass().getName();
This gives: org.postgresql.Driver
To check if the Driver understandes the URL I used this code:
DriverManager.getDriver(dbUrl).getClass().getName();
This also gives org.posgresql.Driver so I think the Driver is registered to the DriverManager and should be able to connect to the database using the URL. I just really don't know why I keep getting an error when I try to connect with the database.
So why does the error occur and how can I resolve the issue?
My first guess would be a malformed connection string. Are you using a proper JDBC URL (i.e. it starts with jdbc:) for dbUrl? Also make sure you include sslmode=require.
In addition, please be aware that the database URL is managed by Heroku and will change under certain circumstances. You can read more about using Heroku Postgres from outside of Heroku in this DevCenter article.
I use I-net designer 16 with a Oracle 12.2 Database Source. In report Designer i have no problem to view the report results ('ve put ojdbc8.jar into the driver path of Clear Reports) but, when I try to launch that report on my web-application (deployed on Apache Tomcat) that give me this error:
[Pool Manager] Cannot load specified driver: oracle.jdbc.driver.OracleDriver
; i've also copied the .jar file into the driver path on Clear-reports server.
Anyone have solved this problem?
Thanks
I'm trying to evaluate icCube and I have a problem when I try to connect a PostgreSQL datasource. When I test the connection I get an error message about PostgreSQL driver missing:
Failed to establish the connection due to the error: JDBC driver class 'org.postgresql.Driver' not found in the classpath
I've checked the lib directory of icCube and it has postgresql-9.4.1207.jre7.jar bundled in the release, is there anything I'm missing?
To fix this, I had to add the PostgreSQL JDBC driver to bin/icCube.sh in the JDBC section:
CLASSPATH="$CLASSPATH:$ICCUBE/lib/postgresql-9.4.1207.jre7.jar"
I am new to Sybase ,I'm developing a web application with sybase and jboss, my app connect with the Sybase database. I have put the jconn4.jar in same directory with war file in deployments directory . My config in standalone.xml like this
<connection-url>jdbc:jtds:sybase://<myserver>:<myport>/<mydb></connection-url>
<driver-class>com.sybase.jdbc4.jdbc.SybDriver</driver-class>
<!--<driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class> -->
<driver>jconn4.jar</driver>
and when i use com.sybase.jdbc4.jdbc.SybDriver got the error message
javax.resource.ResourceException: Wrong driver class [class com.sybase.jdbc4.jdbc.SybDriver] for this connection URL [jdbc:jtds:sybase://<myhost>:<myport>/<mydb>
...
when i use net.sourceforge.jtds.jdbc.Driver i got the message
java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver from [Module "deployment.jconn4.jar:main" from Service Module Loader]
I don't know what driver-class suitable for driver class jconn4.jar
You are using the driver url of the open source jTDS driver, but you are trying to use the Sybase driver. Use the right JDBC url for the Sybase driver: Check the documentation included with the Sybase driver for details (I can't be more specific because the Sybase documentation is usually hard to find online without access to the support portal). Or switch to jTDS, in which case you need to deploy it as a module to JBoss and reference the right driver module in the config.
Edited: I checked the log file, and the URL message is:
Cannot create JDBC driver of class 'org.postgresql.Driver' for connect URL 'postgresql://adminxxxxxxx:xxxxxxxxx#10.1o.1o.10:5432'
I get the following error with postgres on openshift (9.x)
java.sql.SQLException: No suitable driver
java.sql.DriverManager.getDriver(DriverManager.java:278)
My URL is ${OPENSHIFT_POSTGRESQL_DB_URL}
This exact build works on my local host (different URL, of course), and I can see the openshift jar in the correct place in the war file
Any ideas?
Turns out the URL in the environment variable on Openshift does not work.
See here:
http://mikeski.net/blog/index.php?/archives/17-Postgres-and-JBoss-on-openshift.html