Raspberry pi database connection (monodevelop C#) - database-connection

I got on my raspberry pi a database.
Commandline:
mysql -u root -p
pwd:******
create database raspberrypidb;
use raspberrypidb;
create table users(.....);
Then in monodevelop I got this:
SqlDataAdapter objDA= new SqlDataAdapter("SELECT * FROM users","SERVER=192.168.1.100;
DATABASE=raspberrypidb:uid=root:pwd=******;");
Is this correct? What must I type by SERVER?
also a ERROR by
DataSet objDS=new DataSet(); // the type system.xmlSerialization ... is defined in an assembly that is not referer

Related

How to run presto queries in python using pyhive?

I am trying to run presto query in python using pyhive library but max retries error is coming. I am running it in jupyter notebook locally(laptop). I think its not able to connect to presto node. I am using Azure hdinsight cluster and installed presto application on head node(using starburst distribution). I have used cluster user name and password and also i have tried head node ssh user and password but nothing is working. Below is my code:
from pyhive import presto
conn= presto.connect(
host='clustername-ssh.azurehdinsight.net',
port=8085,
username='sshuser'
password='sshpassword',
protocol='https'
).cursor()
conn.execute('SELECT * FROM hive.default.parquettest limit 1')
The error i am getting is:
ConnectionError:
HTTPConnectionPool(host='sm-hdinsight01-ssh.azurehdinsight.net',
port=8085): Max retries exceeded with url: /v1/statement (Caused by
NewConnectionError(': Failed to establish a new connection: [Errno 110]
Connection timed out',))
But when i am running it in terminal of head node it works:
from pyhive import presto
conn= presto.connect(
host='localhost',
port=8085).cursor()
conn.execute('SELECT * FROM hive.default.parquettest limit 1')
I think i am missing some crucial thing here. please help.
sounds like an permission/authentification problem. i am currently using a jupyter notebook on my local machine t query the company presto cluster like this using the prestodb library.
so basically:
import prestodb
conn=prestodb.dbapi.connect(
host='presto.bar.foo.com',
port=80, user='foo',
password='bar'
catalog='hive',
schema='default',
)
cur = conn.cursor()
cur.execute(
'SELECT * FROM "schema"."db" limit 10')
records = cur.fetchall()
print(records[0])

i installed FreeRADIUS , Mysql inside docker Container

I installed FreeRADIUS , Mysql inside docker Container
I exposed ports 1812 , 1813 , 3306 outside .
I imported Database to mysql .
I inserted this rows to databases
INSERT INTO nas VALUES (NULL , '0.0.0.0/0', 'myNAS', 'other', NULL , 'mysecret', NULL , NULL , 'RADIUS Client');
INSERT INTO radcheck (username, attribute, op, value) VALUES ('thisuser', 'User-Password', ':=', 'thispassword');
INSERT INTO radusergroup (username, groupname, priority) VALUES ('thisuser', 'thisgroup', '1');
INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('thisgroup', 'Service-Type', ':=', 'Framed-User'), ('thisgroup', 'Framed-Protocol', ':=', 'PPP'), ('thisgroup', 'Framed-Compression', ':=', 'Van-Jacobsen-TCP-IP');
and i stopped freeradius ==> service freeradius stop
and iam using debug mode ==> freeradius -X
And when using this Command in another terminal for the same container ==> radtest thisuser thispassword 127.0.0.1 0 mysecret
Output: Server Accepted the request
But When the previous Command in another machine
Server does not see the request and output in the other machine is " No response "
Notes in the IN etc IN freeradius IN radiusd.conf file :
listen {
type = auth
ipaddr = *
port = 0 }
listen {
ipaddr = *
port = 0
type = acct }
How can i fix it ?
Adding the rows to the sql database is insufficient. You need to configure your sql instance in mods-available/sql to match your local database, uncomment read_clients in mods-available/sql, and list the sql module in the instantiate section in radiusd.conf to ensure it's loaded if it's not referenced elsewhere in one of the virtual servers.
After making these changes, restart the server. The SQL module should then read the clients list in on startup. Check the debug output freeradius -X to ensure the SQL module can connect to your database, and read the NAS entries in successfully.
The reason why your local connections work is because there's a client entry included for localhost in the clients.conf file that ships with the server.
I fixed this Issue by expose Ports in UDP Protocol -p 1813:1813/udp -p 1812:1812/udp

Connecting to MSSQL server in Spark shell and running a stored procedure

How can I connect to a sql server using jdbc in spark-shell and then query the database using a stored procedure?
I have seen this code:
val url =
"jdbc:mysql://yourIP:yourPort/test?
user=yourUsername; password=yourPassword"
val df = sqlContext
.read
.format("jdbc")
.option("url", url)
.option("dbtable", "people")
.load()
But I need to run a stored procedure.
When I use exec command for the dbtable option above, it gives me this error:
com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near
the keyword 'exec'.

Using UnixODBC and FreeTDS to connect to Pervasive SQL server in ubuntu?

I am trying to connect to a Pervasive Sql Server which is running on Windows 10 from an Ubuntu 14.04.4 server.
I am using the following services to try connect to the server:
FreeTDS
unixODBC
Before starting I tried to ping the host machine from the vm console with success.
I then run the following command to check FreeTDS has installed correctly;
tsql -C
Which returned:
Compile-time settings (established with the "configure" script)
Version: freetds v0.95.95
freetds.conf directory: /usr/local/etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 5.0
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: no
OpenSSL: no
GnuTLS: no
[freetds.conf] located in [/usr/local/etc] contains:
[PSQLServer]
host = **IP**
port = **PORT**
tds version = 8.0
[odbc.ini] located in [/usr/local/etc] contains:
[PSQLClient]
Description = Pervasive SQL Client Settings
Driver = FreeTDS
ServerName = PSQLServer
Database = **DBNAME**
Trace = No
UID = **USERNAME**
PWD = **PASSWORD**
TDS_Version = 8.0
[odbcinst.ini] located in [/usr/local/etc] contains:
[FreeTDS]
Description = FreeTDS unixODBC Driver
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
TDS_Version = 8.0
I tired using the tsql command adding [TDSVER=*] for each of the possible driver versions resulting in the same error message for each TDSVER.
*[5.0], *[6.0], *[7.0], *[7.1], *[7.2], *[7.3], *[7.4], *[8.0]
When testing the connection using the following command:
TDSVER=8.0 tsql -S PSQLClient -U **USERNAME** -P **PASSWORD**
Which returns the following errors:
Error 20012 (severity 2):
Server name not found in configuration files.
locale is "en_ZA.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20013 (severity 2):
Unknown host machine name.
There was a problem connecting to the server
After trying the above, I then tried to the isql command:
isql -v PSQLClient **USERNAME** **PASSWORD**
Which returns the following error messages:
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS][SQL Server]Unknown host machine name.
[ISQL]ERROR: Could not SQLConnect
Is it even possible to connect to [Pervasive SQL] via [node-odbc] and if so what am I doing wrong?
Any assistance would be greatly appreciated!
Most recent versions of Pervasive / Actian PSQL support Linux clients and have an ODBC driver for Linux. Since you're using Windows 10, you should probably be using PSQL v12. If you use v12, you can download the Linux client at http://www.pervasive.com/database/Home/Products/PSQLv12.aspx. There is an RPM and TAR available.

Can't connect java client to Marklogic database

I've just installed a MarkLogic nosql database out of the box on a windows machine.
I wrote a simple javaclient to put data in to the database but I get this error:
org.apache.http.conn.HttpHostConnectException: Connection to http://my.caci.local:8003 refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158)
The Marklogic database is started. This is the code :
DatabaseClient client = DatabaseClientFactory.newClient("localhost", 8003, "admin", "admin", Authentication.DIGEST);
XMLDocumentManager docMgr = client.newXMLDocumentManager(); BinaryDocumentManager binMgr = client.newBinaryDocumentManager();
DOMHandle handle = new DOMHandle(); for (int i = 0; i < AANT_PERSONEN; i++) {
Document document = createDocument(i);
String docId = "/zaak/" + 20;
handle.set(document);
docMgr.write(docId, handle); }
....
The Marklogic console reports the following ports to be active on my.caci.local:
Default :: Admin : 8001 [HTTP]
Default :: App-Services : 8000 [HTTP]
Default :: HealthCheck : 7997 [HTTP]
Default :: Manage : 8002 [HTTP]
I'm new to marklogic and this is my question:
- what port should I use to connect to from my java client?
In agreement with MystyxMac, I notice the console does not report a REST server on 8003.
Here's the documentation for setting up a REST server:
http://docs.marklogic.com/guide/rest-dev/intro#id_97899
You should also add users for the rest-reader, rest-writer, and rest-admin roles.
Hoping that helps,
Erik Hennum
For testing purposes you can simply switch the port you are using to 8000.
From the documentation:
When you install MarkLogic Server, a pre-configured REST API instance
is available on port 8000. This instance uses the Documents database
as the content database and the Modules database as the modules
database.
The instance on port 8000 is convenient for getting started, but you
will usually create a dedicated instance for production purposes.
http://docs.marklogic.com/guide/rest-dev/service#id_15309

Resources