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

Struggling to connect to teradata #34

Closed
r-richmond opened this issue Feb 28, 2017 · 5 comments
Closed

Struggling to connect to teradata #34

r-richmond opened this issue Feb 28, 2017 · 5 comments

Comments

@r-richmond
Copy link

r-richmond commented Feb 28, 2017

import jaydebeapi

conn = jaydebeapi.connect('com.teradata.jdbc.TeraDriver',
                          ['server','user','password'],
                          ['/Users/user/drivers/tdgssconfig.jar',
                           '/Users/user/drivers/terajdbc4.jar'])

returns

  File "/usr/local/lib/python3.6/site-packages/jaydebeapi/__init__.py", line 380, in connect
    jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
  File "/usr/local/lib/python3.6/site-packages/jaydebeapi/__init__.py", line 190, in _jdbc_connect_jpype
    jpype.JClass(jclassname)
  File "/usr/local/lib/python3.6/site-packages/jpype/_jclass.py", line 55, in JClass
    raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)
jpype._jexception.java.lang.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class com.teradata.jdbc.TeraDriver not found

installed packages

Package             Version
------------------- -------
appdirs             1.4.2  
JayDeBeApi          1.0.0  
JPype1              0.6.2  

env | grep JAVA_HOME

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home

tried

  1. version 0.2.0
  2. connection string from Problem creating two connections #1 which has a teradata connection
@r-richmond
Copy link
Author

r-richmond commented Feb 28, 2017

Note: I got this working by editing my connection code to the following

conn = jaydebeapi.connect(jclassname="com.teradata.jdbc.TeraDriver",
                          url="jdbc:teradata://server/",
                          driver_args=['user','password'],
                          jars=['/Users/user/drivers/tdgssconfig.jar','/Users/user/drivers/terajdbc4.jar'])

@dsalmela-palominodb
Copy link

named parameters solved it for me too. Thanks !

@alishazy
Copy link

alishazy commented May 9, 2018

Thanks a ton! It worked for me after using named params.

@Thuruv
Copy link

Thuruv commented Nov 18, 2019

I get this is too late to post this. but this is the closest I've come with the error I have. and I'm trying to use jaydebeapi to connect to Teradata under Zeppelin's notebook with py3.7 in backend.

exec(code, _zcUserQueryNameSpace) File "<stdin>", line 4, in <module> File "/home/c_thv/.local/lib/python3.7/site-packages/jaydebeapi/__init__.py", line 381, in connect jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs) File "/home/c_thv/.local/lib/python3.7/site-packages/jaydebeapi/__init__.py", line 183, in _jdbc_connect_jpype types_map[i.getName()] = i.getStaticAttribute() AttributeError: '_jpype.PyJPField' object has no attribute 'getStaticAttribute'

@mady143
Copy link

mady143 commented Dec 4, 2020

Hi @dsalmela-palominodb @Thuruv @r-richmond @alishazy @baztian

from pyspark.sql import SparkSession
import findspark
import jaydebeapi
findspark.add_packages('mysql:mysql-connector-java:8.0.22')
spark = SparkSession.builder.appName('local').getOrCreate()
connection_String = 'jdbc:mysql://localhost:3306/employee?allowPublicKeyRetrieval=true&useSSL=false'
jdbc_driver_name='com.mysql.jdbc.Driver'
jarFile='C:\spark-2.3.4\jars\mysql-connector-java:8.0.22.jar'
username='admin'
password='admin123'
conn = jaydebeapi.connect(jclassname=jdbc_driver_name, url=connection_String, driver_args={'user': username, 'password': password},jars=jarFile)

my code is this but i am getting an error like TypeError: Class com.mysql.jdbc.Driver is not found

i was so confused can anyone help me to resolve this

Thanks and Regards,
Manikantha Sehar.

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

5 participants