Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load driver #74

Open
mauro-miatello opened this issue May 10, 2018 · 4 comments
Open

load driver #74

mauro-miatello opened this issue May 10, 2018 · 4 comments

Comments

@mauro-miatello
Copy link

i've installed sqlline 1.0.2-5 in my ubuntu
i launch it, write !scan and it give me:
yes 2.3 org.hsqldb.jdbc.JDBCDriver
yes 2.3 org.hsqldb.jdbcDriver
in /usr/share/java i also have
ojdbc6-11.2.0.4.jar
ojdbc.jar
what i've to do, or where i've to put, my oracle driver?
thanks

@mauro-miatello
Copy link
Author

mauro-miatello commented May 10, 2018

i've removed sqlline 1.0.2 and installed from here
when i launch sqlline it says "unabel to find class sqlline.SqlLine"
in home page is written to copy sqlline, sqlline....jar and jdbc driver, but where is .jar file? i've to compile it?
thanks

@julianhyde
Copy link
Owner

I'd edit the sqlline shell script and add a classpath. If there's a line that starts exec java change it to exec java -cp /usr/share/java.

@eostermueller
Copy link

eostermueller commented Jan 7, 2019

It was a pain to do it this way, but I'm trying to use jar files and the following approach worked for me:

$JAVA_HOME/bin/java -cp $HOME/sqlline/jline-1.0.jar:$HOME/sqlline/ojdbc5-11.2.0.1.0.jar:$HOME/sqlline/sqlline-1_0_2.jar sqlline.SqlLine -d oracle.jdbc.OracleDriver 

@eostermueller
Copy link

eostermueller commented Jul 17, 2024

Wow, 5 years later and this is still a problem with sqlline.
Let's say that we launch sqlLine with "java -jar" and we try to add a JDBC jar file in the -cp classpath like this:

java -cp /path/to/my/jdbcDriver.jar -jar sqlline-1.13.0-SNAPSHOT-jar-with-dependencies.jar    

The above won't work because the "-jar" option restricts the classpath to ONLY those files in the jar file that comes after the -jar parameter. see [1] below that says

You use either -jar or -cp, you can't combine the two. 

Alternatively, if you omit the jdbcDriver.jar from the classpath, sqlLine will be unable to locate the driver, even if the driver is in the exact same folder as the sqlline jar....try it out, I did.

You can get this to work if you rebuild the sqlline jar file with your own drivers (specified as additional dependencies in the pom.xml, of course), but what fun is that? We work with a gazillion different drivers and don't know which one you'll need on any given day.

My point is that my comment above from Jan 7, 2019 still holds true....sure seems like this should be front-and-center in the documentation but I sure don't see it.

[1] https://stackoverflow.com/a/15930980/2377579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants