I have a small HSQLDB program to test bits of SQL. I am getting this error:
A pre-version 2.0 client attempted to connect. We rejected them.
Yet the only JDBC driver I have is the HSQLDB v2.3 in the most recent download:
hsqldb/lib/hsqldb.jar
I'm using this string to load the JDBC driver:
Class.forName("org.hsqldb.jdbcDriver");
And the connection string is:
connectionStr = "jdbc:hsqldb:hsql://localhost/tmp_db";
user=sa, password=
Default values. My HSQLDB server seems to have started OK with a database as follows:
server.dbname.0=**tmp_db**
server.database.0=file:r:/.data/hsqldb/**tmp_db/tmp**
[Server#372f7a8d]: Database [index=2, id=2, db=file:r:/.data/hsqldb/**tmp_db/tmp**, alias=tmp_db] opened sucessfully in 26 ms.
I'm using Netbeans and when I connect via the Services tab, the database seems to be opening OK. Wouldn't Netbeans be using the same driver? Can I check that?
The big question is how do we specify the version 2 client connection, driver or parameters? Must I get a different JAR for the correct driver?
One last thing. The test program works fine if I use a file based connection, such as:
jdbc:hsqldb:db_file
Frustratingly too, the server connection string seemed to be working earlier today. At least I could drop/create tables while I was making changes.
You must use the same jars (or at least recent, compatible versions) on the client and server.
The error shows you are using the 2.x version jar on the server but a 1.8 jar on the client. Check NetBeans to see if some extension you have loaded has the old driver. You can use the correct jar in your NetBeans project by adding it as a library.
If the error is not from NetBeans, check your application's classpath and make sure you have the latest jar in it.
Related
I downloaded the latest Bitnami Jaspersoft (7.1.1) appliance, and when creating a PostgreSQL (JDBC) Data Source to a PostgreSQL via the Jaspersoft web front-end, the "Test Connection" button always fails with an error message "Connection failed". I downloaded the appliance as an OVM, I'm running it as a VirtualBox VM.
To ensure it's not due to networking issues, I installed psql in the appliance (it's a Debian box) to ensure it can actually connect to my PostgreSQL database (it's a separate server), and it connects well via command-line psql, so I assume the problem is a JDBC issue. I also tried opening port-forwarding 5432 via ssh, so that I can connect to my database via localhost.
My question is, how can debug connection problems in Jaspersoft, or identify what is causing the failure? Jaspersoft 7.1.1 appliance comes with MySQL and PostgreSQL JDBC drivers already installed, and I was able to create and successfully test a new Data Source to the local standard MySQL database, so that driver definitely works. I couldn't find any log files that would output any error messages when testing the connection.
The appliance comes with the following JDBC driver: /opt/bitnami/apache-tomcat/lib/postgresql-9.1-903.jdbc4.jar. It also includes the following files:
/opt/bitnami/apps/jasperserver/buildomatic/conf_source/db/postgresql/jdbc/postgresql-9.4-1210.jdbc41.jar
/opt/bitnami/apps/jasperserver/buildomatic/conf_source/db/postgresql/jdbc/postgresql-9.4-1210.jdbc42.jar
/opt/bitnami/apps/jasperserver/buildomatic/conf_source/db/app-srv-jdbc-drivers/postgresql-9.4-1210.jdbc41.jar
/opt/bitnami/apps/jasperserver/buildomatic/conf_source/ieCe/lib/postgresql-9.4-1210.jdbc41.jar
I'm unfamiliar with Tomcat, and although I understand java code, I'm not a full-stack java developer. How can I debug this problem?
After hacking on it for a while, I tried replacing the file /opt/bitnami/apache-tomcat/lib/postgresql-9.1-903.jdbc4.jar with the latest jdbc driver from jdbc.postgresql.org, and restarted the server. This did the trick! I wonder why the latest Jaspersoft Server appliance comes pre-installed with such an old jdbc driver. Also, installing it via the web-based interface as per the documentation didn't work either.
Answering my own question here just in case anyone else gets stuck with the same problem!
Postgresq by default is not allow connection from remote hosts. It possible if you running postgresql and jaspersoft on different hosts.
How to Allow Remote Access to PostgreSQL database
I am using Eclipse Oxygen with Glassfish 5. I am Trying to connect to Derby. After selecting Derby from connection profile types I did next and my driver was empty (Specify a Driver and Connection Details) So I clicked on new driver definition
In properties there is no localhost or Port. And the Connection URL does not has it either
Connection Test is successful. I did changed the connection URL so it has port and Host but then Connection test failed. I'm learning Java EE and in tutorial it has host and port while i don't so i'm confused. Any Help ?
Host and port are used with the client driver, not with the embedded driver.
If your deployment approach is to deploy the Derby Network Server and then connect to it with one or more client applications that you are writing, then go back to the first step of your question and pick the Derby Client Driver, from derbyclient.jar.
By the way, I hope you are not really using Derby versions 10.1, 10.2, etc. Those are extremely old versions. Try to use Derby version 10.14 if you can, it's the most recent. You can download the latest Derby release from here: https://db.apache.org/derby/derby_downloads.html After you have downloaded Derby, and unzipped it into a folder on your laptop, load the latest 'derbyclient.jar' and 'derby.jar' into Eclipse so that you can work with the up-to-date JDBC drivers.
For some basic information about the difference between the client-server and embedded configurations of Derby, look here: https://db.apache.org/derby/docs/10.14/getstart/cgsquck70629.html
Many more details about the client-server configuration are explained here: https://db.apache.org/derby/docs/10.14/adminguide/index.html
While if you really do want to use the embedded Derby configuration, but were just confused about why you don't need a host and port for that configuration, try looking here: https://db.apache.org/derby/docs/10.14/devguide/cdevdvlp39409.html
When running the Java web service I'm building on Local Host, everything runs smoothly, however when I attempt to run the exact same code on a different host, such as on AWS, it fails.
I have narrowed the cause down to the fact that the database connection driver "oracle.jdbc.driver.OracleDriver" is absent when the application is not hosted locally, which means that the SQL queries are failing to execute for the obvious reason that they aren't being sent anywhere since the connection is failing to open.
How do I build my project such that the driver is included? Everything else should be fine as it runs as expected on localhost, however I can't run the web service locally, it isn't an option.
You should consider the way you are deploying your webservice. I will give you a checklist, so make sure everything is done.
Insert the oracle jdbc driver inside the libraries folder on your app -- you should consider java jvm version you are running, since your deployment environment may be different from your dev/testing environment;
2nd option: insert the oracle jdbc driver inside your container or application server libraries folder;
Add to your $CLASSPATH or %CLASSPATH% environment variable the right option for your oracle jdbc driver
I have a server with Windows Server 2003 SP2 and third party application developed with Java SE version 5.0. This app connecting to external database server via configured ODBC source.
In my ODBC sources I have configured source to external MS SQL server. As I can say it uses this driver: SQLSRV32.DLL Version: 2000.86.3959.00. When I configure this source and test conenction it says that connection is successfull.
Many years external DB server runned under MS SQL Server 2008 and all was OK. But now they migrated to MS SQL Server 2012 and my java app lost connection to it with exception like this:
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The incoming
tabular data stream (TDS) remote procedure call (RPC) protocol stream
is incorrect. Parameter 1 (""): Data type 0x38 is unknown.
How can I fix connection? Is there any driver I need to install for Windows or Java?
You are using an outdated and obsolete driver version. The error is a result of a bug in the SQLServer 2000 driver
. To correct the issue you need to update the driver to a newer version. For more specific information on the cause and resolution of the error, see:
Microsoft KB Article 915834
To upgrade to later (2005+) drivers, you will be required update the jar files and the connection string used as described in the article. If you do not have access to the code to make a change, you will need to contact Microsoft and request an available hotfix that fixes the bug in the 2000 drivers as described in the KB and shown here:
To resolve this problem immediately, contact Microsoft Product Support
Services to obtain the hotfix. For a complete list of Microsoft
Product Support Services telephone numbers and information about
support costs, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support
It may also be possible to find a later 'patched' version of the driver .dll file. I was able to find an example of the download at this URL: Sqlsrv32.dll 2000.086.4412.00 which is a later version than the one you are using and may correct the issue. If that doesn't work search around for downloads later than this one, which as you can see is build #4412. If you download from a site other than Microsoft,make sure you do a virus scan of the file before using it.
Moved a bunch of databases from sql server 2000 to 2008. One of the
applications is on JBoss 3.2.2 and is now failing to connect to the
database. The particular error is "The incoming tabular data stream
(TDS) remote procedure call (RPC) protocol stream is incorect.
Parameter 1 (""): Data type 0x38 is unknown."
I looked around google for a while have determined this is because I'm
using MS SQL Server 2000 Driver for JDBC and this driver will not work
with MSSql server 2008. It will connect but will not work.
So my question is how do I get Jboss to use the new MSSql server JDBC
driver version 2.
I'm not familiar with JBoss at all. The new driver comes with a JAR
file but I'm not sure how to tell JBoss to use that instead of the old
driver.
Thank you in advance for all your help.
Most often , to make the JDBC driver class available to JBoss, the driver's jar is copied to the lib directory of the default server configuration (assuming that is the configuration you are running, of course).
So, in order to make JBoss use the new driver, remove the old jar from the lib directory (if it's not there look at the startup script and find from where it's added to the $CLASSPATH), replace it with the new driver, update your mssql-ds.xml if required (especially the <connection-url> and <driver-class>, check the driver documentation), restart Jboss.