[Rd] RJDBC

2007-03-05 Thread Jose Sierra
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"

And the function summary(drv) returns:
JDBCDriver
name = JDBC
driver.version = 0.1-1
DBI.version = 0.1-1
client.version = NA
max.connections = NA

Can you help me, please?

Another question:
I try to compile ROracle and RMysql for windows but i need Rdll.lib and 
it need R.exp. Can you give me one of this files?


Regards.
Jose Sierra



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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] RJDBC

2007-03-05 Thread Jose Sierra
Thank you Sean.

I send the message to R-help.

Sean Davis escribió:
> 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"
>>
>> And the function summary(drv) returns:
>> JDBCDriver
>> name = JDBC
>> driver.version = 0.1-1
>> DBI.version = 0.1-1
>> client.version = NA
>> max.connections = NA
>>
>> Can you help me, please?
>>   
> Jose,
>
> This message should go to the R-help or the R-SIG-DB list.  When you 
> send it, I suggest you include your Java version, the output of a call 
> to sessionInfo(), and let folks know whether you can connect from your 
> machine using JDBC in Java.  I don't use RJDBC, so I can't help 
> directly--sorry.
>
> Sean
>


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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] RJDBC

2007-03-05 Thread Jose Sierra
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"

And the function summary(drv) returns:
JDBCDriver
name = JDBC
driver.version = 0.1-1
DBI.version = 0.1-1
client.version = NA
max.connections = NA

Can you help me, please?

Another question: 

I try to compile ROracle and RMysql for windows but i need Rdll.lib and it need 
R.exp. Can you give me one of this files?

 
Regards.
Jose Sierra

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] RJDBC

2007-03-07 Thread Jose Sierra
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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Median

2007-05-08 Thread Jose Sierra
Hello.

I need calculate the median of several column of a data.frame, in a new 
column of this data frame, but the median operator only calculate from a 
vector.

I have made a functionc that calculate the median but it is very slow. 
Are there any method in any package to calculate this?

Best regards.
Jose Sierra.

   ABC
-0.01678042  -0.0003354948 -0.0003354948
 0.17320485   0.2359448911  0.4884204711
-0.76066019  -0.6024409891 -0.5814788340
-0.04365426  -0.0060560612 -0.0025470274
 0.01885735   0.0027792718  0.0184081858
-0.07275884  -0.0371542622 -0.0315041630
  0.05740122   0.0814235514  0.0468193512
 -0.05404834  -0.0590145580  0.0489612929
 -0.28197518  -0.1899247807 -0.2089076920
 -0.02465713  -0.512947 -0.2688619668

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel