对于想了解无法连接到我的SQL数据库的读者,本文将提供新的信息,我们将详细介绍无法连接到我的sql数据库怎么办,并且为您提供关于Alfresco4.2.c使用MySQL数据库连接,安装完成后无法登陆,
对于想了解无法连接到我的SQL数据库的读者,本文将提供新的信息,我们将详细介绍无法连接到我的sql数据库怎么办,并且为您提供关于Alfresco4.2.c使用MySQL数据库连接,安装完成后无法登陆,提示无法连接到远程服务器、android – 无法连接到我的Web服务、c# – 如何解决无法连接到SQL Server数据库?、c# – 无法连接到SQL Server会话数据库的有价值信息。
本文目录一览:- 无法连接到我的SQL数据库(无法连接到我的sql数据库怎么办)
- Alfresco4.2.c使用MySQL数据库连接,安装完成后无法登陆,提示无法连接到远程服务器
- android – 无法连接到我的Web服务
- c# – 如何解决无法连接到SQL Server数据库?
- c# – 无法连接到SQL Server会话数据库
无法连接到我的SQL数据库(无法连接到我的sql数据库怎么办)
所以我在用Java连接MySQL时遇到问题。这是我的代码:
import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;public class DBAccess { private String Host; private String User; private String Password; public DBAccess() throws ClassNotFoundException, SQLException{ Class.forName("com.mysql.jdbc.Driver"); Password = "password"; Host = "jdbc:mysql://localhost/worlddb"; User = "root"; @SuppressWarnings("unused") Connection connect = DriverManager.getConnection(Host,User,Password); System.out.println("Connected!"); } public void RetreiveData(){ } public void ChangeData(){ }}
我得到的错误是线程“ main”中的异常
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database ''worlddb''
http://postimg.org/image/593stjvjx/
在mySQL工作台中,我的连接名是“ worlddb”,主机名是Liquidus(是本地主机)
- 套接字是MySQL
- 端口:3306
为什么是这样?
答案1
小编典典图片中的模式与连接的名称和Database,try world , test 或 sakila的 名称之间有区别。
Alfresco4.2.c使用MySQL数据库连接,安装完成后无法登陆,提示无法连接到远程服务器
我的电脑是win7旗舰版64位,jdk1.7,tomcat7.0,MySQLjava驱动为5.1.26,这些东西应该是没问题,我觉得问题可能会出现在数据库连接上,可是我不知道要怎么去改。求各位大牛教育。android – 无法连接到我的Web服务
活动:
public class MainActivity extends Activity { final private String METHOD_NAME = "getMenuePlan"; final private String NAMESPACE = "http://webservice.kantine.de/"; final private String SOAP_ACTION = "\"" + NAMESPACE + METHOD_NAME + "\""; final private String URL = "http://10.0.2.2:8080/Kantine/MenuePlan?wsdl"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setoutputSoapObject(request); HttpTransportSE httpTransport = new HttpTransportSE(URL); SoapObject result = null; try { httpTransport.call(SOAP_ACTION,envelope); result = (SoapObject) envelope.getResponse(); } catch (SoapFault e) { Log.e("error","",e); } catch (IOException e) { Log.e("error",e); } catch (XmlPullParserException e) { Log.e("error",e); } if (result != null) { Log.i("Result",result.toString()); } else { Log.i("Result","null"); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main,menu); return true; }
}
WSDL:
<wsdl:deFinitions name="KantineWSImplService" targetNamespace="http://webservice.kantine.de/"><wsdl:types><xs:schema elementFormDefault="unqualified" targetNamespace="http://webservice.kantine.de/" version="1.0"><xs:element name="getMenuePlan" type="tns:getMenuePlan"/><xs:element name="getMenuePlanResponse" type="tns:getMenuePlanResponse"/><xs:complexType name="getMenuePlan"> [...]
例外:
7-19 10:58:10.287: E/AndroidRuntime(1008): FATAL EXCEPTION: main 07-19 10:58:10.287: E/AndroidRuntime(1008): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.wstest/com.example.wstest.MainActivity}: android.os.networkonmainthreadException 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:2059) 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.app.ActivityThread.access$600(ActivityThread.java:130) 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.os.Handler.dispatchMessage(Handler.java:99) 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.os.Looper.loop(Looper.java:137) 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.app.ActivityThread.main(ActivityThread.java:4745) 07-19 10:58:10.287: E/AndroidRuntime(1008): at java.lang.reflect.Method.invokeNative(Native Method) 07-19 10:58:10.287: E/AndroidRuntime(1008): at java.lang.reflect.Method.invoke(Method.java:511) 07-19 10:58:10.287: E/AndroidRuntime(1008): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 07-19 10:58:10.287: E/AndroidRuntime(1008): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 07-19 10:58:10.287: E/AndroidRuntime(1008): at dalvik.system.NativeStart.main(Native Method) 07-19 10:58:10.287: E/AndroidRuntime(1008): Caused by: android.os.networkonmainthreadException 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.io.IoBridge.connectErrno(IoBridge.java:144) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.io.IoBridge.connect(IoBridge.java:112) 07-19 10:58:10.287: E/AndroidRuntime(1008): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) 07-19 10:58:10.287: E/AndroidRuntime(1008): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459) 07-19 10:58:10.287: E/AndroidRuntime(1008): at java.net.socket.connect(Socket.java:842) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.httpconnection.<init>(httpconnection.java:76) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.httpconnection.<init>(httpconnection.java:50) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.httpconnection$Address.connect(httpconnection.java:341) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.httpconnectionPool.get(httpconnectionPool.java:87) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.httpconnection.connect(httpconnection.java:128) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.HttpEngine.connect(HttpEngine.java:310) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80) 07-19 10:58:10.287: E/AndroidRuntime(1008): at libcore.net.http.HttpURLConnectionImpl.getoutputStream(HttpURLConnectionImpl.java:188) 07-19 10:58:10.287: E/AndroidRuntime(1008): at org.ksoap2.transport.ServiceConnectionSE.openOutputStream(ServiceConnectionSE.java:109) 07-19 10:58:10.287: E/AndroidRuntime(1008): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:157) 07-19 10:58:10.287: E/AndroidRuntime(1008): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:96) 07-19 10:58:10.287: E/AndroidRuntime(1008): at com.example.wstest.MainActivity.onCreate(MainActivity.java:41) 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.app.Activity.performCreate(Activity.java:5008) 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 07-19 10:58:10.287: E/AndroidRuntime(1008): at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:2023) 07-19 10:58:10.287: E/AndroidRuntime(1008): ... 11 more
我已经添加到清单中了.
有什么建议?
解决方法
这是answer..
网络请求只能在ANDROID> = 3.0的背景线上进行
c# – 如何解决无法连接到SQL Server数据库?
问题是当我通过cmd运行IIS Express然后将地址放入浏览器时我被重定向到WSA工具但是当我点击安全选项卡或链接时,我收到此错误:
There is a problem with your selected data store. This can be caused by an invalid server name or credentials,or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.
以下消息可能有助于诊断问题:
Unable to connect to sql Server database
我的连接字符串如下所示:
<connectionStrings> <add name="DefaultConnection" connectionString="Data Source=.; Initial Catalog=aspnetdb; User Id=sa; Password=***********; Integrated Security=true" providerName="System.Data.sqlClient" /> </connectionStrings>
整个我的应用程序web.config如下:
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version=5.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> <connectionStrings> <add name="DefaultConnection" connectionString="Data Source=.; Initial Catalog=aspnetdb; User Id=sa; Password=***********; Integrated Security=true" providerName="System.Data.sqlClient" /> </connectionStrings> <appSettings> <add key="webpages:Version" value="2.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="PreserveLoginUrl" value="true" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> <authentication mode="Forms"> <forms loginUrl="~/Account/Login" timeout="2880" /> </authentication> <pages> <namespaces> <add namespace="System.Web.Helpers" /> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Optimization" /> <add namespace="System.Web.Routing" /> <add namespace="System.Web.WebPages" /> </namespaces> </pages> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <handlers> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptprocessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,OPTIONS" modules="IsapiModule" scriptprocessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,bitness64" responseBufferLimit="0" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers></system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="DotNetopenAuth.Core" publicKeyToken="2780ccd10d57b246" /> <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="DotNetopenAuth.AspNet" publicKeyToken="2780ccd10d57b246" /> <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory,EntityFramework"> <parameters> <parameter value="v11.0" /> </parameters> </defaultConnectionFactory> </entityFramework> </configuration>
我在我的MVC应用程序中看不到< rolemanager enabled = true>即使我尝试了一个web应用程序,它已经有了< rolemanager enabled =“true”>但是甚至没有工作.
PS:值得一提的是,当我运行应用程序时,它自己运行得更好,我可以创建用户,更新用户密码等…而且结果也会反映回MS sql Server数据库表但是没有知道这里有什么魔力.
你有什么建议的?!
问候
Dostdar
解决方法
如果设置为true,则使用当前Windows帐户凭据进行身份验证.您的Windows用户可能没有适当的数据库权限.
https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx
c# – 无法连接到SQL Server会话数据库
直到上个月,我的网站开始在sqlsession状态服务器上遇到2-3次问题
跟随:
Blockquote
System.Web.HttpException Exception of type ‘System.Web.HttpException’ was thrown. at System.Web.HttpAsyncResult.End() at System.Web.SessionState.SessionStateModule.EndAcquireState(IAsyncResult ar) at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) ================================================== Exception: System.Web.HttpException Unable to connect to sql Server session database. at System.Web.SessionState.sqlSessionStateStore.ThrowsqlConnectionException(sqlConnection conn,Exception e) at System.Web.SessionState.sqlSessionStateStore.sqlStateConnection..ctor(sqlPartitionInfo sqlPartitionInfo) at System.Web.SessionState.sqlSessionStateStore.GetConnection(String id,Boolean& usePooling) at System.Web.SessionState.sqlSessionStateStore.DoGet(HttpContext context,String id,Boolean getExclusive,Boolean& locked,TimeSpan& lockAge,Object& lockId,SessionStateActions& actionFlags) at System.Web.SessionState.sqlSessionStateStore.GetItemExclusive(HttpContext context,SessionStateActions& actionFlags) at System.Web.SessionState.SessionStateModule.GetSessionStateItem() at System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(Object state) ================================================== Exception: system.invalidOperationException Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory) at System.Data.sqlClient.sqlConnection.open() at System.Web.SessionState.sqlSessionStateStore.sqlStateConnection..ctor(sqlPartitionInfo sqlPartitionInfo)
然后我开始查看我的会话数据库服务器并在我的sql客户端中执行了“exec sp_who”,它在结果中找到了很多AspState操作的记录.
我不知道是什么原因造成这种问题,因为我们没有改变任何严肃的事情
在out应用程序中,只修复了一些bug.
以下是我的Web应用程序环境的详细信息:
asp.net 3.5(从1.1转换)…工作得非常好
2个服务器场具有会话状态的sqlmode.
有没有人知道这个问题或者有任何想法进行调查?
谢谢
解决方法
using (sqlConnection cn = new sqlConnection(connectionString)) { using (sqlCommand cm = new sqlCommand(commandString,cn)) { cn.open(); cm.ExecuteNonQuery(); // or fill a dataset,etc. } }
一旦退出此“使用”语句,连接将自动关闭.
执行此操作将清除应用程序中的所有其他数据库连接,并且State Server连接将能够在需要时进行连接.
关于无法连接到我的SQL数据库和无法连接到我的sql数据库怎么办的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于Alfresco4.2.c使用MySQL数据库连接,安装完成后无法登陆,提示无法连接到远程服务器、android – 无法连接到我的Web服务、c# – 如何解决无法连接到SQL Server数据库?、c# – 无法连接到SQL Server会话数据库的相关信息,请在本站寻找。
本文标签: