[ 
https://issues.apache.org/jira/browse/SOLR-10495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christian Harke updated SOLR-10495:
-----------------------------------
    Description: 
I'd like to access a postgres database from my custom SearchComponent but 
unfortunately, I get the following error:

{noformat}
java.sql.SQLException: No suitable driver found for postgres
        at java.sql.DriverManager.getConnection(DriverManager.java:689)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at 
ch.guidelines.util.SimpleDataSource.getConnection(SimpleDataSource.java:50)
...
{noformat}

... when I try to connect to the database using:

{code:title=SimpleDataSource.java}
private String dbUrl = "jdbc:postgresql://db/mydb";

public Connection getConnection(String dbUser, String dbPasswd) throws 
SQLException {
    this.dbUser = dbUser;
    this.dbPasswd = dbPasswd;
    this.conn = DriverManager.getConnection(dbUrl, dbUser, dbPasswd); // line 50
    return conn;
}
{code}

I already use the DataImportHandler using the Postgres JDBC driver 
successfully. I tried putting the driver's jar in different locations:
- /opt/solr/dist (with added <lib ... /> entry in solrconfig.xml)
- /opt/solr/lib
- /opt/solr/server/lib
- /opt/solr/server/lib/ext
- /opt/solr/server/solr/lib (lib-folder in the solr.solr.home directory)

But nothing worked so far... How can I get the driver loaded in my custom 
SearchComponent?

I'd really appreciate your help.

  was:
I'd like to access a postgres database from my custom SearchComponent but 
unfortunately, I get the following error:

{noformat}
java.sql.SQLException: No suitable driver found for postgres
        at java.sql.DriverManager.getConnection(DriverManager.java:689)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at 
ch.guidelines.util.SimpleDataSource.getConnection(SimpleDataSource.java:50)
...
{noformat}

... when I try to connect to the database using:

{code:title=SimpleDataSource.java}
public Connection getConnection(String dbUser, String dbPasswd) throws 
SQLException {
    this.dbUser = dbUser;
    this.dbPasswd = dbPasswd;
    this.conn = DriverManager.getConnection(dbUrl, dbUser, dbPasswd); // line 50
    return conn;
}
{code}

I already use the DataImportHandler using the Postgres JDBC driver 
successfully. I tried putting the driver's jar in different locations:
- /opt/solr/dist (with added <lib ... /> entry in solrconfig.xml)
- /opt/solr/lib
- /opt/solr/server/lib
- /opt/solr/server/lib/ext
- /opt/solr/server/solr/lib (lib-folder in the solr.solr.home directory)
But nothing worked so far... How can I get the driver loaded in my custom 
SearchComponent?

I'd really appreciate your help.


> Loading JDBC driver in custom SearchComponent
> ---------------------------------------------
>
>                 Key: SOLR-10495
>                 URL: https://issues.apache.org/jira/browse/SOLR-10495
>             Project: Solr
>          Issue Type: Wish
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SearchComponents - other
>    Affects Versions: 6.4.2
>         Environment: Docker Container (https://store.docker.com/images/solr)
>            Reporter: Christian Harke
>            Priority: Minor
>              Labels: newbie
>
> I'd like to access a postgres database from my custom SearchComponent but 
> unfortunately, I get the following error:
> {noformat}
> java.sql.SQLException: No suitable driver found for postgres
>         at java.sql.DriverManager.getConnection(DriverManager.java:689)
>       at java.sql.DriverManager.getConnection(DriverManager.java:247)
>       at 
> ch.guidelines.util.SimpleDataSource.getConnection(SimpleDataSource.java:50)
> ...
> {noformat}
> ... when I try to connect to the database using:
> {code:title=SimpleDataSource.java}
> private String dbUrl = "jdbc:postgresql://db/mydb";
> public Connection getConnection(String dbUser, String dbPasswd) throws 
> SQLException {
>     this.dbUser = dbUser;
>     this.dbPasswd = dbPasswd;
>     this.conn = DriverManager.getConnection(dbUrl, dbUser, dbPasswd); // line 
> 50
>     return conn;
> }
> {code}
> I already use the DataImportHandler using the Postgres JDBC driver 
> successfully. I tried putting the driver's jar in different locations:
> - /opt/solr/dist (with added <lib ... /> entry in solrconfig.xml)
> - /opt/solr/lib
> - /opt/solr/server/lib
> - /opt/solr/server/lib/ext
> - /opt/solr/server/solr/lib (lib-folder in the solr.solr.home directory)
> But nothing worked so far... How can I get the driver loaded in my custom 
> SearchComponent?
> I'd really appreciate your help.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to