Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
juki918
Newbie


Joined: 02 Sep 2011
Posts: 1

PostPosted: Sat Oct 08, 2011 9:48 am   

Connect to oracle database and run plsql block
 
Hi there,
im trying to connect to local oracle database (XE) from CMUD, i coppied oci.dll from my oracle installation to CMUD directory and tried commands lide #SQLDB and %sqldb but with no success.

Can somebody please write simple CMUD script that connects to local oracle database ( listener on 127.0.0.1 port 1521 SID=XE) and run plsql block:
BEGIN
proc1('Hello');
END;

and closes connection? thanks

PS:
currently im trying to use
#SQLDB "dbConnection" "XE" "oracle" "127.0.0.1" "1521" "muduser" "mudpassword"
#CALL @dbConnection.Open
#CALL @dbConnection.Execute("BEGIN proc1('Hello');END;")
#CALL @dbConnection.Commit
#CALL @dbConnection.Close

it gives no error but also does not do anything
Reply with quote
ins0mnia
Novice


Joined: 23 Jan 2011
Posts: 42
Location: United States

PostPosted: Sat Oct 08, 2011 10:03 am   
 
Cmud Pro is required for 'remote' databases, I know that's local but I think the entire syntax is restricted

Other than that, I can't help much.. typing #SQLDB alone will show if a connection was made at all.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Oct 08, 2011 5:13 pm   
 
Regular CMud only allows you to connect to SQLite databases. CMud Pro lets you also connect to any other type of DB format.
_________________
EDIT: I didn't like my old signature
Reply with quote
juki919
Newbie


Joined: 08 Oct 2011
Posts: 6

PostPosted: Sat Oct 08, 2011 7:26 pm   
 
sorry my accout juki918 was banned for some reason (???) waiting to be recovered.

Yes, im using CMud Pro Version 3.33a purchased and with licence.

It appeares that i can connect using those #SQLDB command (simple #SQLDB shows dbConnection -> XE [oracle] (127.0.0.1:1521) connected).
I can also retrieve some data from SQL query using %sql function. Problem is that im not sure how to execute plsql block or run database procedure.

Is #CALL @dbConnection.Execute ("...") the right command for executing nonresultset command on database?
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sat Oct 08, 2011 7:47 pm   
 
I believe the problem is that the #SQLDB command doesn't actually set a dbConnection variable, dbConnection just becomes the name of the connection. Try something like this instead:
Code:
dbConnection = %sqldb( "XE", "oracle", "127.0.0.1", "1521", "muduser", "mudpassword")
#CALL @dbConnection.Open
#CALL @dbConnection.Execute("BEGIN proc1('Hello');END;")
#CALL @dbConnection.Commit
#CALL @dbConnection.Close
Reply with quote
juki919
Newbie


Joined: 08 Oct 2011
Posts: 6

PostPosted: Sat Oct 08, 2011 9:04 pm   
 
thank you guys, finaly it works as follows:

Code:

dbConnection = %sqldb( "dbConnection", "XE", "oracle", "127.0.0.1", "1521", "muduser", "mudpassword")
#CALL @dbConnection.Open
#CALL @dbConnection.Execute("BEGIN proc1('Hello');END;")
#CALL @dbConnection.Close
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net