I try to get iReport 2.0.4 connected to my database resulting in a ClassNotFound exception.
So I downloaded the MS JDBC drivers 4.1 and 4.0 for SQL server. (http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774)
I added the jdb jar file to the iReport Classpath:
I restarted iReport and tried to connect to the db again:
File > Report Wizard > Database JDBC connection > Next >
JDBC Driver (com.microsoft.jdbc.sqlserver.SQLServerDriver)
JDBC URL: jdbc:microsoft:sqlserver://(myIP):1433;DatabaseName=MYDATABASE
I am getting the same exception.
Could anyone please point me what I am doing wrong?
The problem is that the classname of the JDBC driver is incorrect. The correct classname is com.microsoft.sqlserver.jdbc.SQLServerDriver (notice the order of elements: sqlserver before jdbc).
I believe that one of the first Microsoft SQL Server JDBC driver did have the classname you tried, but it has since been replaced.
First make sure you are added sqljdbc4.jar in your class path .
--> Tools->Options->Classpath tab :
1 - In JDBC Driver : com.microsoft.sqlserver.jdbc.SQLServerDriver
2 - In JDBC URL : jdbc:sqlserver://localhost:1433 without database name only port
3 - Database username and password in credentials section
Related
So I am trying to add new connection to my Netbeans' database which is MySQL but I am getting Big Integer casting error can someone please help me?
In detail:
I right click on existing MySQL Server at localhost:3306 [root(disconnected) >> select connect and this pops up
Unable to connect to the MySQL server:
org.netbeans.api.db.explorer.DatabaseException: org.netbeans.api.db.explorer.DatabaseException: java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long.
The server may not be running or your MySQL connection properties may not be set correctly. Do you want to edit your MySQL connection properties?
And my basic and admin properties are OK.
And I tried this too: Right click on databases >> select New Connection >> Driver: MySQL(Connector/J driver), JDBC URL: jdbc:mysql://localhost:3306/mysql , but when I test the connection it gives me the same error.
**MySQL server is running.
Thank you.
This is a JDBC Driver problem
I had a similar problem in netbeans. I resolved by removing the default driver (Connector/J driver) from the driver list under databases/drivers as shown below.
This happened with jdbc v8.0.12 on mysql v8.0
So after removing the default jdbc driver, I add an old version of the driver mysql-connector-java-5.1.47.
The connection the succeeded.
What is the version of your MySQL driver and your MySQL? If you want to use MySQL 8, for example, you could try to use a MySQL driver which supports MySQL 8.
Try updating your mysql driver.
To install the driver:
1° Go to the services tab, just after databases.
2° Right click on the drivers folder and select add new driver.
3° Click add and look for the .jar of the driver you downloaded.
Remove and clean the jdbc connector jar files already come with netbeans.
Add a new connector jar file to the jdbc library.
(You can download ==> mysql-connector-java/8.0.11
Try again, connection is going to be ok now.
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'm trying to connect to SQLite db from Jaspersoft ireports. I was able to create a datasource successfully but when I create a report using the datasource it gives me below error message.
java.sql.SQLException: file is encrypted or is not a database
I'm using below JDBC drivers:
JDBC Driver: org.sqlite.JDBC
JDBC URL: jdbc:sqlite:C:\\Users\\IT\\Desktop\\sqllitejdbc\\spiceworks_prod.sqlite
Any help is greatly appreciated.
Thanks.
JDBC Driver: org.sqlite.JDBC
JDBC URL: jdbc:sqlite:C:\Users\IT\Desktop\sqllitejdbc\wwe.sqlite
this is how i gave the Driver and URL but it does not work before that i gave jre file(sqlitejdbc-v056) to the classpath
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.
I have to define a new Driver in the Netbeans "Services" Tab
Services->Databases->Drivers->new Driver...
because I want use the "Entity Classes from Database"-Wizard in context with UCanAccess.
1st step: "new Driver" does work (only declaration ;-) )
Driver File(s): f:\WorkspaceNetbeans\MSAccessDB\lib\UCanAccess-2.0.4-bin\ucanaccess-2.0.4.jar
Driver Class: net.ucanaccess.jdbc.UcanaccessDriver
Name:msaccess
2nd step: "Connect using..."
JDBC URL: jdbc:ucanaccess://F:/WorkspaceNetbeans/MSAccessDB/data/Datenbank2.accdb
"User Name" and "Password" leave blank
The "Test Connection"-Button results in Error Message:
Cannot establish a connection to
jdbc:ucanaccess://F:\WorkspaceNetbeans\MSAccessDB\data\Datenbank2.accdb using
net.ucanaccess.jdbc.UcanaccessDriver (Could not initialize class
net.ucanaccess.jdbc.UcanaccessDriver)
I've got the newest ucanaccess from http://ucanaccess.sourceforge.net/site.html
ucanaccess-2.0.4.jar, commons-lang-2.6.jar, commons-logging-1.0.4.jar, hsqldb.jar, jackcess-2.0.3.jar in the Netbeans Classpath.
The old fashion way to connect via jdbc to ucanaccess works fine.
public static void main(String[] args) throws ClassNotFoundException, SQLException {
String connectString = "jdbc:ucanaccess://" + "f:/WorkspaceNetbeans/MSAccessDB/data/Datenbank2.accdb";
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection conn = DriverManager.getConnection(connectString, "", "");
conn.createStatement().execute("CREATE TABLE example1 (id COUNTER PRIMARY KEY,descr text(400), number numeric(12,3), date0 datetime) ");
}
The same connection string also works fine make DBeaver able to connect to the MSAccess db.
My set up:
Windows 7 Professional 64 bit
Microsoft Office 2013
NetBeans IDE 8.0
Java 1.8
The problem is similar to: "Conflict between JT400 and UCanAccess?" Conflict between JT400 and UCanAccess?
but the answers there don't help with my problem.
Any ideas to solve my problem?
UCanAccess 2.0.4.1 has been released, now you can configure UCanAccess as NetBeans service.
As explained in the UCanAccess web site (tab 'jdbc client tools') you have to:
-in the field Driver File(s), add ucanaccess.jar and all dependencies. I've upgraded the commons-logging in the UCanAccess distribution to the 1.1.1, so you can use that jar with NetBeans8.
-use the following pattern for the jdbc url:
jdbc:ucanaccess://;showschema=true
Showschema connection property must be setted to true.
I was wrong, it wasn't a tricky task but...
To establish the connection you have to list in the Driver File(s) :
ucanaccess-2.0.4.jar,
commons-lang-2.6.jar,
hsqldb.jar,
jackcess-2.0.3.jar
AND
a different version of commons-logging that you can find it in NetBeans:
NetBeans 8.0\ide\modules\org-apache-commons-logging.jar (the commons-logging in the UCanAccess distribution is in conflict with that used by NetBeans)
But unfortunatly, after establishing the connection, you won't be able to execute queries through this IDE, because of a trivial bug in the UcanaccessDatabaseMetadata which hasn't effect with the other IDE jdbc clients I tested (Openoffice, Libreoffice, DBeaver, Squirrel, SQLeo and so on) .
So, to do this, you have to wait some days (I think I'll post a patched Ucanaccess 2.0.4.1 next week). Also, I'll add a note about UCanAccess configuration as NetBeans service in the UCanAccess web site.