Eclipse Database Connection Driver Definition - java

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

Related

Use SSL for JDBC Pool Connection to Oracle Database from Java Application Server

I'm currently trying to implement a SSL connection from the jdbc-pool of our java application server to our Oracle database.
We're using Payara (based on glassfish) as our application server. On there I created a JDBC-connection pool that offers a connection to the database. The goal ist to encrypt this connection.
The used ojdbc driver version is 11-21.1.0.0.
Sadly I only found guides on how to encrypt payara JDBC-pool connections to postgres or mysql databases, not to oracle ones.
The only thing I found was that apparently the pool has to talk to port 2484 on the database (link).
Does anyone have any experience with how to solve this problem?
What parameters, aside from port, do I have to set in the advanced properties of the jdbc-pool?
Any help would be highly appreciated!
Can you check the JDBC Developer's guide for security information?
Check out www.oracle.com/jdbc for other resources.

Problem creating new PostgreSQL Data Source in JasperSoft 7.1.1 Appliance

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

How do I make a HSQLDB 2 client program?

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.

connection cannot be made with derby client jdbc driver

im using Eclipse Helios Java EE IDE for Web Developers,Version: 1.3.0. connection with derby embeded jdbc driver is workin fine but i cannot make connection with derby client jdbc driver... what should i do to make it work,please help me...
connection with derby embeded jdbc driver is workin fine but i cannot make connection with derby client jdbc driver
Providing details (what you did, what didn't work, etc) is generally useful to get good answers. Here are some things to check though:
make sure derbyclient.jar is on the classpath
make sure you are using org.apache.derby.jdbc.ClientDriver as driver class
make sure the URL follows the following format jdbc:derby://<host>:<port>/<database>
make sure the network server has been started(!)

JBoss 3.2.2 and JDBC upgrade

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.

Categories