From jose.sierra at integromics.com  Wed Mar  7 16:54:13 2007
From: jose.sierra at integromics.com (Jose Sierra)
Date: Wed, 07 Mar 2007 16:54:13 +0100
Subject: [Rd] RJDBC
In-Reply-To: <642D1D67-5003-4566-9FC5-81E01B8EB322@r-project.org>
References: <45EC0F6A.20309@integromics.com>
	<642D1D67-5003-4566-9FC5-81E01B8EB322@r-project.org>
Message-ID: <45EEE025.8020609@integromics.com>

Thank you Simon.

I have used your script with Oracle and Mysql and both returns

[1] "Java-Object{java.sql.SQLException: No suitable driver}"

My script is the next:

library('rJava')
library('DBI')
library('RJDBC')

drv <-  
JDBC("com.mysql.jdbc.Driver","C:\\Temporal\\mysql-connector-java-3.0.9-stable-bin.jar","'") 

dbCheck("jdbc:mysql://localhost/foo","user","pwd")

I can connect with Oracle and Mysql by JDBC from another applications 
with this jar. It contains com.mysql.jdbc.Driver.class or 
oracle.jdbc.driver.OracleDriver.class

Can you help me?

Simon Urbanek escribi?:
> Jose,
>
> On Mar 5, 2007, at 7:39 AM, Jose Sierra wrote:
>
>> I need help.
>>
>> I'm trying to connect with an Oracle DBMS and MySQL DBMS, I'm using
>> RJDBC package.
>>
>> My code is the next:
>>
>> library('rJava')
>> library('DBI')
>> library('RJDBC')
>>
>> //Mysql
>> drv <-
>> JDBC("com.mysql.jdbc.Driver","C:\\Temporal\\mysql-connector-java-3.0.9-stable-bin.jar","'") 
>>
>>
>> conn <- dbConnect(drv, "jdbc:mysql://localhost:3306/bd", "user",
>> "password")
>>
>> //Oracle
>> drv <-
>> JDBC("oracle.jdbc.driver.OracleDriver","C:\\Temporal\\classes12.jar","'") 
>>
>> conn <-
>> dbConnect(drv,"jdbc:oracle:thin:@192.168.1.70:1521:SDS22","user","password") 
>>
>>
>>
>> R always returns for oracle
>> "Error en .local(drv, ...) : Unable to connect JDBC to
>> jdbc:oracle:thin:@192.168.1.70:1521:SDS22"
>> and for mysql
>> "Error en .local(drv, ...) : Unable to connect JDBC to
>> jdbc:mysql://localhost:3306/bd"
>>
>
> It is very likely a problem with your DB connection or authentication. 
> I have tested it with MySQL (I don't have Oracle) and it worked 
> without problems. Please test it step-by-step to make sure that your 
> DB is configured properly.
>
> Unfortunately RJDBC doesn't pass non-fatal SQL errors back to the 
> user, so connection problems are not easy to debug, but you can try 
> this to show the connection problem:
>
> dbCheck = function(url, user='', pwd='') {
>  j = .jcall("java/sql/DriverManager", "Ljava/sql/Connection;", 
> "getConnection", url, user, pwd, check=FALSE)
>  x = .jgetEx()
>  .jcheck()
>  x
> }
>
> and use it like this:
>
> > dbCheck("jdbc:mysql://localhost/foo","user","pwd")
> [1] "Java-Object{java.sql.SQLException: Access denied for user 
> 'user'@'localhost' (using password: YES)}"
> >
> > dbCheck("jdbc:mysql://localhost/foo","root","")
> [1] "Java-Object{java.sql.SQLException: Unknown database 'foo'}"
> > dbCheck("jdbc:mysql://bar/foo","root","")
>
> I'll see if I can provide some more helpful response in the dbConnect 
> for the next release..
>
>
>> Another question:
>> I try to compile ROracle and RMysql for windows but i need Rdll.lib 
>> and  it need R.exp.
>
> No, you don't need those files, because R is linked directly. Simply 
> follow the instructions for building R packages on Windows.
>
> Cheers,
> Simon
>
>
>
>
>
>

		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y m?viles desde 1 c?ntimo por minuto. 
http://es.voice.yahoo.com



[Rd] RJDBC
Jose Sierra