[Mono-dev] Mono Sybase client
Quandary
quandary82 at hailmail.net
Tue Nov 16 18:30:34 EST 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Does mono 2.4 or 2.6 on Linux really work with Sybase ASE (I use 15.5)?
I just tested with the below code, and I am not able to establish a
connection to my ASE 15.5 database. Connection refused.
Since sa had a blank password, I thought it might be the pw, so I
created an additional user, but that didn't help.
But I can without problem connect to the DB using SybaseCentral with
exactly this username + pw + port + hostname.
I get an exception right at dbcon.open
using System;
using System.Web;
using System.Web.UI;
namespace TestGridView
{
public partial class Default : System.Web.UI.Page
{
public void SybaseTest()
{
string connectionString =
"Server=IS1300,5000;" +
"Database=master;" +
"User ID=SomeUser;" +
"Password=SomePassword;";
// from connectionstrings.com. doesn't work either
connectionString = "Data
Source='IS1300';Port=5000;Database=master;Uid=SomeUser;Pwd=SomePassword;";
//System.Data.IDbConnection dbcon;
Mono.Data.SybaseClient.SybaseConnection dbcon;
dbcon = new Mono.Data.SybaseClient.SybaseConnection(connectionString);
try
{
dbcon.Open();
System.Data.IDbCommand dbcmd = dbcon.CreateCommand();
string sql =
"SELECT name " +
"FROM master.dbo.sysobjects";
dbcmd.CommandText = sql;
System.Data.IDataReader reader = dbcmd.ExecuteReader();
System.Data.DataSet ds = new System.Data.DataSet();
System.Data.DataTable dt = new System.Data.DataTable();
Mono.Data.SybaseClient.SybaseDataAdapter myad = new
Mono.Data.SybaseClient.SybaseDataAdapter(sql, dbcon);
//myad.SelectCommand.CommandText = sql ;
myad.Fill(dt);
GridView1.DataSource = dt.DefaultView;
GridView1.DataBind();
while(reader.Read())
{
string objName = reader["name"].ToString();
Console.WriteLine("Name: " + objName);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
catch(Exception ex)
{
Response.Write("error: " + ex.Message);
}
}
public virtual void button1Clicked (object sender, EventArgs args)
{
SybaseTest();
button1.Text = "You clicked me";
/*
System.Data.DataSet myds = new System.Data.DataSet();
string strConnectionString ="";
Mono.Data.SybaseClient.SybaseConnection xxx = new
Mono.Data.SybaseClient.SybaseConnection(strConnectionString);
//Mono.Data.SqliteClient.SqliteConnection xxx = new
Mono.Data.SqliteClient.SqliteConnection(strConnectionString);
//System.Data.SqlClient.SqlConnection = new
System.Data.SqlClient.SqlConnection(strConnectionString);
//GridView1.DataSource =
*/
}
}
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJM4xQTAAoJEKkS8c1rnvHc1WkH/3eSTEF60LgPS8mv01ajDrS+
JGITR3dAzxjXidfUFDVoMS8JsWTtSaGEGhtr6W87NeVv4Oev+X/3TqEY0TnP6hB/
SMFrblvELNb76MA2opUoki2h/WQwAjQljLFd3HkfYxXzfkmM9tL4w4GY4bt1M4fL
odpHKBvzndwmrhavfoWVbxHAnNxCcE3S+8VYPVRtam0tul11RgSsXycHJkY3CDIO
rQShRO514VzAhUhkCw+gUS5q3Trpcb7QDuXAw4p9L3etQz8E4X7sFqOs5ccqzXwV
sbFZALHtwCZeMbccsuD2YUVK0ycRJPHdKs69aiH4tn88E7Z25h4rahv+tu8pjlc=
=5NEy
-----END PGP SIGNATURE-----
More information about the Mono-devel-list
mailing list