Home > Software design >  DataSource connection to a custom jdbc connection succeeds with wrong details
DataSource connection to a custom jdbc connection succeeds with wrong details

Time:04-20

I am currently trying to establish a connection to a custom JDBC url(here JIRA in my case). I have downloaded the jars for JIRA drivers(cdata.jdbc.jira.jar) and placed it in required directory.

The key thing I observe here is the connection is successful even with wrong details.

Connection conn = DriverManager.getConnection("jdbc:jira:Url=random.com","abc","pass");

Can someone tell me where I am missing?

CodePudding user response:

Could you try with this code?

Connection conn = DriverManager.getConnection("jdbc:jira://random.com","abc","pass");

I don't think Url= is correct syntax

CodePudding user response:

I think there is some issue with the driver which you have installed. However, as a workaround, we can do executeQuery() on top of the connection to verify the connection.

Connection conn = DriverManager.getConnection("jdbc:jira:Url=random.com","abc","pass");
Statement stmt = conn.createStatement();
stmt.executeQuery("select * from DUMMY_TABLE;"); 
//Please use preparedStatement to avoid SQL attacks.

This will throw an exception for wrong details.

  • Related